# HG changeset patch # User Mikael Berthe # Date 1412501435 -7200 # Node ID 798baf5db4ebf9f0a86e8094b14ceb8f9a125a83 # Parent 96427d9e993c9c35ab7c2993db90f687f7607fa8 Add /roster next_open_buffer Not documented yet. This command only applies to non-hidden entries; hidden buffers are ignored. diff -r 96427d9e993c -r 798baf5db4eb mcabber/mcabber/commands.c --- a/mcabber/mcabber/commands.c Sat Oct 04 21:45:27 2014 +0200 +++ b/mcabber/mcabber/commands.c Sun Oct 05 11:30:35 2014 +0200 @@ -878,6 +878,8 @@ scr_roster_unread_message(0); } else if (!strcasecmp(subcmd, "unread_next")) { scr_roster_unread_message(1); + } else if (!strcasecmp(subcmd, "next_open_buffer")) { + scr_roster_next_open_buffer(); } else if (!strcasecmp(subcmd, "alternate")) { scr_roster_jump_alternate(); } else if (!strncasecmp(subcmd, "search", 6)) { diff -r 96427d9e993c -r 798baf5db4eb mcabber/mcabber/screen.c --- a/mcabber/mcabber/screen.c Sat Oct 04 21:45:27 2014 +0200 +++ b/mcabber/mcabber/screen.c Sun Oct 05 11:30:35 2014 +0200 @@ -2678,6 +2678,41 @@ scr_LogPrint(LPRINT_LOGNORM, "Error: nbuddy == NULL"); // should not happen } +// scr_roster_next_open_buffer() +// Jump to the next open buffer (experimental XXX) +// This implementation ignores the hidden entries (folded groups). +void scr_roster_next_open_buffer(void) +{ + GList *bud = current_buddy; + + if (!current_buddy) return; + + for (;;) { + guint budtype; + bud = g_list_next(bud); + // End of list: jump to the first entry + if (!bud) + bud = buddylist; + // Check if we're back to the initial position + if (bud == current_buddy) + break; + // Ignore the special buffer(s), groups + budtype = buddy_gettype(BUDDATA(bud)); + if (budtype & (ROSTER_TYPE_GROUP | ROSTER_TYPE_SPECIAL)) + continue; + + // Check if a buffer/window exists + if (scr_search_window(buddy_getjid(BUDDATA(bud)), 0)) { + set_current_buddy(bud); + if (chatmode) { + last_activity_buddy = current_buddy; + scr_show_buddy_window(); + } + break; + } + } +} + // scr_roster_jump_alternate() // Try to jump to alternate (== previous) buddy void scr_roster_jump_alternate(void) diff -r 96427d9e993c -r 798baf5db4eb mcabber/mcabber/screen.h --- a/mcabber/mcabber/screen.h Sat Oct 04 21:45:27 2014 +0200 +++ b/mcabber/mcabber/screen.h Sun Oct 05 11:30:35 2014 +0200 @@ -148,6 +148,7 @@ void scr_roster_jump_alternate(void); void scr_roster_unread_message(int); void scr_roster_display(const char *); +void scr_roster_next_open_buffer(void); void scr_buffer_top_bottom(int topbottom); void scr_buffer_clear(void);