After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 604348 - /part not implemented
/part not implemented
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Multi User Chat
2.29.x
Other Linux
: Normal enhancement
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2009-12-11 08:42 UTC by Guillaume Desmottes
Modified: 2011-03-07 07:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Part command implementation and Join, Leave chat menuitems (12.66 KB, patch)
2011-02-22 02:10 UTC, Chandni Verma
reviewed Details | Review

Description Guillaume Desmottes 2009-12-11 08:42:40 UTC
From bug #573407:
/part is not working
Comment 1 Omer Akram 2010-01-07 10:25:41 UTC
any progress on this?
Comment 2 Omer Akram 2010-03-23 13:51:06 UTC
When I closed an IRC window telepathy-gabble logs show that part command was sent so this just needs a patch for the task?
Comment 3 Chandni Verma 2011-01-30 03:14:24 UTC
(In reply to comment #2)
> When I closed an IRC window telepathy-gabble logs show that part command was
> sent so this just needs a patch for the task?

I doubt that.
I checked the debug logs and found that PART command was sent for telepathy-idle but not in telepathy-gabble.

The part command has the following usage:
      PART [<channel>] [<reason>]

Idle definitely supports full command.

If just /PART (without channel and reason options) was to be supported (with current channel as default <channel>), one workaround could be to simply close the chat tab & current channel for the time being, but that would be wrong as we ultimately need a way to close the chat-rooms window without actually leaving it (see https://bugzilla.gnome.org/show_bug.cgi?id=599184)
Comment 4 Chandni Verma 2011-02-22 02:10:05 UTC
Created attachment 181549 [details] [review]
Part command implementation and Join, Leave chat menuitems

public branch: http://gitorious.org/glassrose-gnome/empathy/commits/muc-part-command-604348
Comment 5 Guillaume Desmottes 2011-02-22 09:42:47 UTC
Review of attachment 181549 [details] [review]:

You should make more atomic commits:
- One adding the tp-chat API
- One implementing /part
- One adding the menu entries

We are in UI freeze now, so I think we should focus on /part for now.

I tried the "leave chat" option in a XMPP muc and hit this error:


empathy-CRITICAL **: empathy_chat_window_find_chat: assertion `!EMP_STR_EMPTY (id)' failed
aborting...

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007fffe835c688 in g_logv (log_domain=0x495918 "empathy", log_level=G_LOG_LEVEL_CRITICAL, format=0x7fffe83e4818 "%s: assertion `%s' failed", 
    args1=0x7fffffffcc70) at gmessages.c:553
553			G_BREAKPOINT ();
(gdb) 
(gdb) 
(gdb) 
(gdb) bt
  • #0 g_logv
    at gmessages.c line 553
  • #1 g_log
    at gmessages.c line 577
  • #2 g_return_if_fail_warning
  • #3 empathy_chat_window_find_chat
    at empathy-chat-window.c line 2376
  • #4 empathy_chat_command_part
    at empathy-chat.c line 764
  • #5 chat_window_leave_chat_activate_cb
    at empathy-chat-window.c line 1002
  • #6 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 79
  • #7 g_closure_invoke
    at gclosure.c line 767
  • #8 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #9 g_signal_emit_valist
    at gsignal.c line 2983
  • #10 g_signal_emit
    at gsignal.c line 3040
  • #11 _gtk_action_emit_activate
    at gtkaction.c line 799
  • #12 gtk_action_activate
    at gtkaction.c line 829
  • #13 gtk_real_menu_item_activate
    at gtkmenuitem.c line 1727
  • #14 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 79
  • #15 g_type_class_meta_marshal
    at gclosure.c line 878
  • #16 g_closure_invoke
    at gclosure.c line 767
  • #17 signal_emit_unlocked_R
    at gsignal.c line 3182
  • #18 g_signal_emit_valist
    at gsignal.c line 2983
  • #19 g_signal_emit
    at gsignal.c line 3040
  • #20 gtk_widget_activate
    at gtkwidget.c line 6088
  • #21 gtk_menu_shell_activate_item
    at gtkmenushell.c line 1403
  • #22 gtk_menu_shell_button_release
    at gtkmenushell.c line 803
  • #23 gtk_menu_button_release
    at gtkmenu.c line 3486
  • #24 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 85
  • #25 g_type_class_meta_marshal
    at gclosure.c line 878
  • #26 g_closure_invoke
    at gclosure.c line 767
  • #27 signal_emit_unlocked_R
    at gsignal.c line 3290
  • #28 g_signal_emit_valist
    at gsignal.c line 2993
  • #29 g_signal_emit
    at gsignal.c line 3040
  • #30 gtk_widget_event_internal
    at gtkwidget.c line 6057
  • #31 gtk_widget_event
    at gtkwidget.c line 5771
  • #32 gtk_propagate_event
    at gtkmain.c line 2577
  • #33 gtk_main_do_event
    at gtkmain.c line 1852
  • #34 _gdk_event_emit
    at gdkevents.c line 71
  • #35 gdk_event_source_dispatch
    at gdkeventsource.c line 318
  • #36 g_main_dispatch
    at gmain.c line 2440
  • #37 g_main_context_dispatch
    at gmain.c line 3013
  • #38 g_main_context_iterate
    at gmain.c line 3091
  • #39 g_main_loop_run
    at gmain.c line 3299
  • #40 gtk_main
    at gtkmain.c line 1338
  • #41 gtk_application_run_mainloop
    at gtkapplication.c line 85
  • #42 g_application_run
    at gapplication.c line 1241
  • #43 main
    at empathy-chat.c line 160

::: libempathy-gtk/empathy-chat.c
@@ +766,3 @@
+	if (chat_to_be_parted != NULL) {
+		empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat_to_be_parted), strv[2]);
+	} else {

If a chat has been passed and we can't find it then we should raise an error rather than leaving the current chat.

::: libempathy/empathy-tp-chat.c
@@ +1186,3 @@
 	if (error) {
 		DEBUG ("Error: %s", error->message);
+		empathy_tp_chat_leave (EMPATHY_TP_CHAT (chat), "");

Are these 2 cases really such a big deal that we should leave?

@@ +1908,2 @@
 	tp_cli_channel_interface_group_call_remove_members (priv->channel, -1, array,
+		message, leave_remove_members_cb, self, NULL, G_OBJECT (self));

I think you can use tp_channel_leave_async() here.

::: src/empathy-chat-window.c
@@ +844,3 @@
+
+	gtk_action_set_sensitive (priv->menu_conv_join_chat, disconnected);
+	gtk_action_set_sensitive (priv->menu_conv_leave_chat, !disconnected);

You should group those; no need to make 2 calls.

@@ +1007,3 @@
+	strv = empathy_chat_command_parse ("part", 3);
+
+	empathy_chat_command_part (priv->current_chat, strv);

That's a bit hacky. We should call a proper part function rather than building a GStrv.
Comment 6 Chandni Verma 2011-02-22 15:23:27 UTC
hey, the Leave Chat option froze? It's working fine for me. maybe I need to update master, rebase branch to the tip of master and retest. i'll split the commits.
Comment 7 Chandni Verma 2011-02-23 06:47:47 UTC
(In reply to comment #6)
> hey, the Leave Chat option froze? It's working fine for me. maybe I need to
> update master, rebase branch to the tip of master and retest. i'll split the
> commits.

OK, this was an unnoticed error on my part. rectified.

Commit split and branch updated with other changes except a few things-

For this:

>::: libempathy-gtk/empathy-chat.c
>@@ +766,3 @@
>+    if (chat_to_be_parted != NULL) {
>+        empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat_to_be_parted),
>strv[2]);
>+    } else {
>
>If a chat has been passed and we can't find it then we should raise an error
>rather than leaving the current chat.


what if one wants to leave the current chat with some reason specified?
I presumed that since current chat-room ID is default, then user should not explicitly have to type the current chat's name and be able to use command also as:

/PART [<chatroom-ID>] [<reason>]
/PART                 I am sleepy

If "I" is not name of (an optional) MUC channel then shouldn't it be treated as part of the optional reason message?
I find absence of this feature in xchat particularly annoying when I have to type even the current chat's name if I need to specify a reason especially when the syntax states that I can provide a reason without a chatroom ID. If this seems odd to you, i'll change it.


I didn't put any new code in these lines:

>::: libempathy/empathy-tp-chat.c
>@@ +1186,3 @@
>     if (error) {
>         DEBUG ("Error: %s", error->message);
>+        empathy_tp_chat_leave (EMPATHY_TP_CHAT (chat), "");
>
>Are these 2 cases really such a big deal that we should leave?

I just adapted the code to invoke the changed method correctly. Also, if not leave then what else? After all, self handle and remote contact should be obtainable in constructor.

and for this:

>::: src/empathy-chat-window.c
>@@ +844,3 @@
>+
>+    gtk_action_set_sensitive (priv->menu_conv_join_chat, disconnected);
>+    gtk_action_set_sensitive (priv->menu_conv_leave_chat, !disconnected);
>
>You should group those; no need to make 2 calls.

is there a new API for grouping these for which I can't find the relevant function?
Comment 8 Guillaume Desmottes 2011-02-23 09:29:41 UTC
(In reply to comment #7)
> (In reply to comment #6)
> >::: libempathy-gtk/empathy-chat.c
> >@@ +766,3 @@
> >+    if (chat_to_be_parted != NULL) {
> >+        empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat_to_be_parted),
> >strv[2]);
> >+    } else {
> >
> >If a chat has been passed and we can't find it then we should raise an error
> >rather than leaving the current chat.
> 
> 
> what if one wants to leave the current chat with some reason specified?
> I presumed that since current chat-room ID is default, then user should not
> explicitly have to type the current chat's name and be able to use command also
> as:
> 
> /PART [<chatroom-ID>] [<reason>]
> /PART                 I am sleepy
> 
> If "I" is not name of (an optional) MUC channel then shouldn't it be treated as
> part of the optional reason message?
> I find absence of this feature in xchat particularly annoying when I have to
> type even the current chat's name if I need to specify a reason especially when
> the syntax states that I can provide a reason without a chatroom ID. If this
> seems odd to you, i'll change it.

Humm yeah I guess that makes sense.

> I didn't put any new code in these lines:

Oh you're right, sorry.

> and for this:
> 
> >::: src/empathy-chat-window.c
> >@@ +844,3 @@
> >+
> >+    gtk_action_set_sensitive (priv->menu_conv_join_chat, disconnected);
> >+    gtk_action_set_sensitive (priv->menu_conv_leave_chat, !disconnected);
> >
> >You should group those; no need to make 2 calls.
> 
> is there a new API for grouping these for which I can't find the relevant
> function?

Rahh I missread that too (seems that yesterday was not my day...).


tp_channel_leave_async (priv->channel,TP_CHANNEL_GROUP_CHANGE_REASON_NONE
missing space after the ','
Comment 9 Chandni Verma 2011-02-23 09:58:33 UTC
ok done :)
Comment 10 Guillaume Desmottes 2011-02-24 10:14:25 UTC
Rah sorry, I found some issues, I fail at reviewing :(


if (tp_channel_leave_finish (TP_CHANNEL(source_object), res, &error)) {
			if (error != NULL) {

That's the wrong pattern. You should do:
if (!tp_channel_leave_finish (...)) {
 DEBUG ()
 g_error_free ()
}

If the _finish function fails, you can be sure that the GError has been set.


No need to do all these check in empathy_tp_chat_leave, tp_channel_leave_async() will just do the right thing. empathy_tp_chat_leave just have to be a thin wrapper around tp_channel_leave_async().

Also, can you please rebase your branch on top of current master?
Comment 11 Chandni Verma 2011-02-24 20:16:39 UTC
ok done, looks good now.

I was wondering why this method tp_channel_leave_async() is not listed in my libtelepathy-glib-docs which is reported to be latest. Is it a new method not yet documented?

I resolved a conflict too! :)
Comment 12 Guillaume Desmottes 2011-02-25 09:26:08 UTC
(In reply to comment #11)
> ok done, looks good now.

Great, thanks. I merged the 2 first patches to master but not the one adding the menu entry as we are now in UI freeze.
Can you please open another bug about that?

> I was wondering why this method tp_channel_leave_async() is not listed in my
> libtelepathy-glib-docs which is reported to be latest. Is it a new method not
> yet documented?

Weird, it's documented, see http://telepathy.freedesktop.org/doc/telepathy-glib/telepathy-glib-channel.html#tp-channel-leave-async



This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 13 Chandni Verma 2011-03-07 07:50:58 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > ok done, looks good now.
> 
> Great, thanks. I merged the 2 first patches to master but not the one adding
> the menu entry as we are now in UI freeze.
> Can you please open another bug about that?

https://bugzilla.gnome.org/show_bug.cgi?id=643755 is opened for the menu items.