Mercurial > hg
changeset 330:a9013124ede6
Add "/roster alternate"
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 17 Jul 2005 21:17:52 +0100 |
parents | 7c53bf62a2a2 |
children | 1510dda4ad71 |
files | mcabber/doc/mcabber.1 mcabber/doc/mcabber.1.html mcabber/doc/mcabber.1.txt mcabber/src/commands.c mcabber/src/roster.c mcabber/src/roster.h mcabber/src/screen.c mcabber/src/screen.h |
diffstat | 8 files changed, 39 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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). </dd> <dt><b> -/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 </b></dt> <dt><b> /roster search bud @@ -448,6 +448,14 @@ </tr> <tr valign="top"> <td> +<b>alternate</b> +</td> +<td> +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") +</td> +</tr> +<tr valign="top"> +<td> <b>unread_first</b> </td> <td> @@ -504,7 +512,7 @@ <div id="footer"> <p> Version 0.6.4-dev<br /> -Last updated 15-Jul-2005 19:50:59 CEST +Last updated 17-Jul-2005 21:49:05 CEST </p> </div> </div>
--- 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
--- 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 != ' ')) {
--- 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);
--- 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...
--- 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)