# HG changeset patch # User Mikael Berthe # Date 1121631472 -3600 # Node ID a9013124ede630cb6448d5187da67d0b0a88def9 # Parent 7c53bf62a2a259f86872b79cfac85c54e6481f7d Add "/roster alternate" diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/doc/mcabber.1 --- a/mcabber/doc/mcabber.1 Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/doc/mcabber.1 Sun Jul 17 21:17:52 2005 +0100 @@ -180,6 +180,7 @@ \fBshow_offline\fR show offline buddies \fBtoggle_offline\fR toggle display of offline buddies \fBsearch\fR bud search for a buddy with a name or buddy containing "bud" (only in the displayed buddylist) + \fBalternate\fR jump to alternate buddy\&. The "alternate" buddy is the last buddy left while being in chat mode (this command is thus especially useful after commands like "/roster unread_first") \fBunread_first\fR jump to the first unread message \fBunread_next\fR jump to the next unread message diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/doc/mcabber.1.html --- a/mcabber/doc/mcabber.1.html Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/doc/mcabber.1.html Sun Jul 17 21:17:52 2005 +0100 @@ -390,7 +390,7 @@ the buddies to another group with the /move command).
-/roster bottom|top|hide_offline|show_offline|toggle_offline|unread_first|unread_next +/roster bottom|top|hide_offline|show_offline|toggle_offline|alternate|unread_first|unread_next
/roster search bud @@ -448,6 +448,14 @@ +alternate + + +jump to alternate buddy. The "alternate" buddy is the last buddy left while being in chat mode (this command is thus especially useful after commands like "/roster unread_first") + + + + unread_first @@ -504,7 +512,7 @@ diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/doc/mcabber.1.txt --- a/mcabber/doc/mcabber.1.txt Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/doc/mcabber.1.txt Sun Jul 17 21:17:52 2005 +0100 @@ -162,7 +162,8 @@ This command does not work for groups, at the moment (but you can move the buddies to another group with the /move command). -/roster bottom|top|hide_offline|show_offline|toggle_offline|unread_first|unread_next:: +/roster bottom|top|hide_offline|show_offline|toggle_offline:: +/roster alternate|unread_first|unread_next:: /roster search bud:: The 'roster' command manipulates the roster/buddylist. Here are the available parameters: @@ -172,6 +173,7 @@ 'show_offline';; show offline buddies 'toggle_offline';; toggle display of offline buddies 'search' bud;; search for a buddy with a name or buddy containing "bud" (only in the displayed buddylist) + 'alternate';; jump to alternate buddy. The "alternate" buddy is the last buddy left while being in chat mode (this command is thus especially useful after commands like "/roster unread_first") 'unread_first';; jump to the first unread message 'unread_next';; jump to the next unread message diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/src/commands.c --- a/mcabber/src/commands.c Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/src/commands.c Sun Jul 17 21:17:52 2005 +0100 @@ -118,6 +118,7 @@ compl_add_category_word(COMPL_ROSTER, "hide_offline"); compl_add_category_word(COMPL_ROSTER, "show_offline"); compl_add_category_word(COMPL_ROSTER, "toggle_offline"); + compl_add_category_word(COMPL_ROSTER, "alternate"); compl_add_category_word(COMPL_ROSTER, "search"); compl_add_category_word(COMPL_ROSTER, "unread_first"); compl_add_category_word(COMPL_ROSTER, "unread_next"); @@ -347,6 +348,8 @@ scr_RosterUnreadMessage(0); } else if (!strcasecmp(arg, "unread_next")) { scr_RosterUnreadMessage(1); + } else if (!strcasecmp(arg, "alternate")) { + scr_RosterJumpAlternate(); } else if (!strncasecmp(arg, "search", 6)) { char *string = arg+6; if (*string && (*string != ' ')) { diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/src/roster.c --- a/mcabber/src/roster.c Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/src/roster.c Sun Jul 17 21:17:52 2005 +0100 @@ -46,6 +46,7 @@ static GSList *unread_list; GList *buddylist; GList *current_buddy; +GList *alternate_buddy; /* ### Roster functions ### */ @@ -419,12 +420,16 @@ GSList *sl_roster_elt = groups; roster *roster_elt; roster *roster_current_buddy = NULL; + roster *roster_alternate_buddy = NULL; int shrunk_group; // We need to remember which buddy is selected. if (current_buddy) roster_current_buddy = BUDDATA(current_buddy); current_buddy = NULL; + if (alternate_buddy) + roster_alternate_buddy = BUDDATA(alternate_buddy); + alternate_buddy = NULL; // Destroy old buddylist if (buddylist) { @@ -487,6 +492,8 @@ // Check if we can find our saved current_buddy... if (roster_current_buddy) current_buddy = g_list_find(buddylist, roster_current_buddy); + if (roster_alternate_buddy) + alternate_buddy = g_list_find(buddylist, roster_alternate_buddy); // current_buddy initialization if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1)) current_buddy = g_list_first(buddylist); diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/src/roster.h --- a/mcabber/src/roster.h Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/src/roster.h Sun Jul 17 21:17:52 2005 +0100 @@ -23,6 +23,7 @@ extern GList *buddylist; extern GList *current_buddy; +extern GList *alternate_buddy; // Macros... diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/src/screen.c --- a/mcabber/src/screen.c Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/src/screen.c Sun Jul 17 21:17:52 2005 +0100 @@ -823,6 +823,8 @@ prev_st = buddy_getstatus(BUDDATA(current_buddy)); buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE); + if (chatmode) + alternate_buddy = current_buddy; current_buddy = newbuddy; // Lock the buddy in the buddylist if we're in chat mode if (chatmode) @@ -913,6 +915,17 @@ } else scr_LogPrint("Error: nbuddy == NULL"); } +// scr_RosterJumpAlternate() +// Try to jump to alternate (== previous) buddy +void scr_RosterJumpAlternate(void) +{ + if (!alternate_buddy || g_list_position(buddylist, alternate_buddy) == -1) + return; + set_current_buddy(alternate_buddy); + if (chatmode) + scr_ShowBuddyWindow(); +} + // scr_ScrollUp() // Scroll up the current buddy window, half a screen. void scr_ScrollUp(void) diff -r 7c53bf62a2a2 -r a9013124ede6 mcabber/src/screen.h --- a/mcabber/src/screen.h Sun Jul 17 21:16:15 2005 +0100 +++ b/mcabber/src/screen.h Sun Jul 17 21:17:52 2005 +0100 @@ -55,5 +55,6 @@ void scr_BufferBottom(void); void scr_Clear(void); void scr_RosterUnreadMessage(int); +void scr_RosterJumpAlternate(void); #endif