# HG changeset patch
# User Mikael Berthe
# Date 1131745648 -3600
# Node ID 74dcd0df532e9aa32dbc818979ba87da0686a1be
# Parent 7ffb1a3ed1b82f59c98691f198fd0b7739cd1379
"/move" does not jump to the buddy in the new group
diff -r 7ffb1a3ed1b8 -r 74dcd0df532e mcabber/doc/mcabber.1
--- a/mcabber/doc/mcabber.1 Mon Oct 31 23:06:55 2005 +0100
+++ b/mcabber/doc/mcabber.1 Fri Nov 11 22:47:28 2005 +0100
@@ -175,7 +175,7 @@
.TP
\fB/move\fR [groupname]
-Move the current buddy to the requested group\&. If no group is specified, then the buddy is moved to the default group\&. This command only works with users (not agents), at the moment\&.
+Move the current buddy to the requested group\&. If no group is specified, then the buddy is moved to the default group\&. This command only works with users (not agents), at the moment\&. Tip: if the chatmode is enabled, you can use "/roster alternate" to jump to the moved buddy\&.
.TP
\fB/msay\fR begin|verbatim|send|abort
diff -r 7ffb1a3ed1b8 -r 74dcd0df532e mcabber/doc/mcabber.1.html
--- a/mcabber/doc/mcabber.1.html Mon Oct 31 23:06:55 2005 +0100
+++ b/mcabber/doc/mcabber.1.html Fri Nov 11 22:47:28 2005 +0100
@@ -2,7 +2,7 @@
-
+
@@ -366,7 +366,9 @@
Move the current buddy to the requested group. If no group is
specified, then the buddy is moved to the default group.
- This command only works with users (not agents), at the moment.
+ This command only works with users (not agents), at the moment.
+ Tip: if the chatmode is enabled, you can use "/roster alternate"
+ to jump to the moved buddy.
diff -r 7ffb1a3ed1b8 -r 74dcd0df532e mcabber/doc/mcabber.1.txt
--- a/mcabber/doc/mcabber.1.txt Mon Oct 31 23:06:55 2005 +0100
+++ b/mcabber/doc/mcabber.1.txt Fri Nov 11 22:47:28 2005 +0100
@@ -146,7 +146,9 @@
/move [groupname]::
Move the current buddy to the requested group. If no group is
specified, then the buddy is moved to the default group.
- This command only works with users (not agents), at the moment.
+ This command only works with users (not agents), at the moment. +
+ Tip: if the chatmode is enabled, you can use "/roster alternate"
+ to jump to the moved buddy.
/msay begin|verbatim|send|abort::
Send a multi-line message. To write a single message with several
diff -r 7ffb1a3ed1b8 -r 74dcd0df532e mcabber/src/commands.c
--- a/mcabber/src/commands.c Mon Oct 31 23:06:55 2005 +0100
+++ b/mcabber/src/commands.c Fri Nov 11 22:47:28 2005 +0100
@@ -944,6 +944,7 @@
// clones the buddy and deletes the old one (and thus, jid and name are
// freed)
jb_updatebuddy(jid, name, newgroupname);
+ scr_RosterUp();
buddy_setgroup(bud, newgroupname);
g_free(newgroupname);
diff -r 7ffb1a3ed1b8 -r 74dcd0df532e mcabber/src/roster.c
--- a/mcabber/src/roster.c Mon Oct 31 23:06:55 2005 +0100
+++ b/mcabber/src/roster.c Fri Nov 11 22:47:28 2005 +0100
@@ -676,16 +676,15 @@
// buddy_setgroup()
// Change the group of current buddy
//
-// Warning! This function changes current_buddy!
-// Warning! Old buddy is deleted, so you can't acces to its jid/name after
-// calling this function.
+// Warning! This function changes the specified buddy!
+// Warning! Old buddy is deleted, so you can't access to its jid/name after
+// calling this function (they are free'd).
void buddy_setgroup(gpointer rosterdata, char *newgroupname)
{
roster *roster_usr = rosterdata;
GSList **sl_group;
GSList *sl_clone;
roster *roster_clone;
- int is_alternate;
// A group has no group :)
if (roster_usr->type & ROSTER_TYPE_GROUP) return;
@@ -709,16 +708,17 @@
free_all_resources(&roster_usr->resource);
g_free(roster_usr);
- // If new new group is folded, the curren_buddy will be lost, and the
- // chat window won't be correctly refreshed. So we make sure it isn't...
- ((roster*)((GSList*)roster_clone->list)->data)->flags &= ~ROSTER_FLAG_HIDE;
-
- // Little trick to have current_body pointing to the cloned buddy
- is_alternate = (alternate_buddy == current_buddy);
buddylist = g_list_append(buddylist, roster_clone);
- current_buddy = g_list_find(buddylist, roster_clone);
- if (is_alternate)
- alternate_buddy = current_buddy;
+ // We must have current_buddy pointing to the cloned buddy, if this is
+ // the one we have moved. Same for alternate_buddy.
+ if (rosterdata == BUDDATA(current_buddy)) {
+ current_buddy = g_list_find(buddylist, roster_clone);
+ // If new new group is folded, the current_buddy will be lost, and the
+ // chat window won't be correctly refreshed. So we make sure it isn't...
+ ((roster*)((GSList*)roster_clone->list)->data)->flags &= ~ROSTER_FLAG_HIDE;
+ }
+ if (alternate_buddy && BUDDATA(alternate_buddy) == rosterdata)
+ alternate_buddy = g_list_find(buddylist, roster_clone);
buddylist_build();
}