Mercurial > ~mikael > mcabber > hg
changeset 2160:798baf5db4eb
Add /roster next_open_buffer
Not documented yet.
This command only applies to non-hidden entries; hidden buffers are ignored.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 05 Oct 2014 11:30:35 +0200 |
parents | 96427d9e993c |
children | 28ee843ddc02 |
files | mcabber/mcabber/commands.c mcabber/mcabber/screen.c mcabber/mcabber/screen.h |
diffstat | 3 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)) {
--- 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)
--- 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);