diff -r 2353730dae7f -r 15256be9cf8b pidgin/gtkconv.c --- a/pidgin/gtkconv.c Thu May 17 07:29:26 2007 +0000 +++ b/pidgin/gtkconv.c Fri May 18 22:31:37 2007 +0000 @@ -1755,7 +1755,8 @@ static void move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward) { - PidginConversation *next_gtkconv = NULL; + PidginConversation *next_gtkconv = NULL, *most_active = NULL; + PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE; PidginWindow *win; int initial, i, total, diff; @@ -1771,17 +1772,21 @@ for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) { next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); - if (next_gtkconv->unseen_state > 0) - break; - } - - if (i == initial) { /* no new messages */ + if (next_gtkconv->unseen_state > unseen_state) { + most_active = next_gtkconv; + unseen_state = most_active->unseen_state; + if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */ + break; + } + } + + if (most_active == NULL) { /* no new messages */ i = (i + diff) % total; - next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); - } - - if (next_gtkconv != NULL && next_gtkconv != gtkconv) - pidgin_conv_window_switch_gtkconv(win, next_gtkconv); + most_active = pidgin_conv_window_get_gtkconv_at_index(win, i); + } + + if (most_active != NULL && most_active != gtkconv) + pidgin_conv_window_switch_gtkconv(win, most_active); } static gboolean