comparison mcabber/mcabber/screen.c @ 2045:7f06eb956734

Correctly set the alternate buffer after roster up|down N with N > 1
author Mikael Berthe <mikael@lilotux.net>
date Tue, 27 Nov 2012 19:09:39 +0100
parents f8958ab545ac
children a60b933d04cc
comparison
equal deleted inserted replaced
2044:c00b919cf4ac 2045:7f06eb956734
2447 // Go to the nth next buddy in the buddylist 2447 // Go to the nth next buddy in the buddylist
2448 // (up if updown == -1, down if updown == 1) 2448 // (up if updown == -1, down if updown == 1)
2449 void scr_roster_up_down(int updown, unsigned int n) 2449 void scr_roster_up_down(int updown, unsigned int n)
2450 { 2450 {
2451 unsigned int i; 2451 unsigned int i;
2452 GList *new_buddy = current_buddy;
2453 GList *tmp_buddy;
2454
2455 if (!current_buddy)
2456 return;
2452 2457
2453 if (updown < 0) { 2458 if (updown < 0) {
2454 for (i = 0; i < n; i++) 2459 for (i = 0; i < n; i++) {
2455 set_current_buddy(g_list_previous(current_buddy)); 2460 tmp_buddy = g_list_previous(new_buddy);
2461 if (tmp_buddy)
2462 new_buddy = tmp_buddy;
2463 }
2456 } else { 2464 } else {
2457 for (i = 0; i < n; i++) 2465 for (i = 0; i < n; i++) {
2458 set_current_buddy(g_list_next(current_buddy)); 2466 tmp_buddy = g_list_next(new_buddy);
2459 } 2467 if (tmp_buddy)
2468 new_buddy = tmp_buddy;
2469 }
2470 }
2471 if (new_buddy == current_buddy)
2472 return;
2473
2474 set_current_buddy(new_buddy);
2460 if (chatmode) { 2475 if (chatmode) {
2461 last_activity_buddy = current_buddy; 2476 last_activity_buddy = current_buddy;
2462 scr_show_buddy_window(); 2477 scr_show_buddy_window();
2463 } 2478 }
2464 } 2479 }