Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/screen.c @ 1996:7837d5a3f509
Going back to the first buddy with /roster next_unread when there is no more unread messages.
author | Simon Jacquin |
---|---|
date | Sun, 22 May 2011 23:30:37 +0200 |
parents | 0870005f7efc |
children | 555e342556e7 |
comparison
equal
deleted
inserted
replaced
1995:7f7c6b87f1b1 | 1996:7837d5a3f509 |
---|---|
2391 // scr_roster_top() | 2391 // scr_roster_top() |
2392 // Go to the first buddy in the buddylist | 2392 // Go to the first buddy in the buddylist |
2393 void scr_roster_top(void) | 2393 void scr_roster_top(void) |
2394 { | 2394 { |
2395 set_current_buddy(buddylist); | 2395 set_current_buddy(buddylist); |
2396 if (chatmode) | 2396 if (chatmode) { |
2397 last_activity_buddy = current_buddy; | |
2397 scr_show_buddy_window(); | 2398 scr_show_buddy_window(); |
2399 } | |
2398 } | 2400 } |
2399 | 2401 |
2400 // scr_roster_bottom() | 2402 // scr_roster_bottom() |
2401 // Go to the last buddy in the buddylist | 2403 // Go to the last buddy in the buddylist |
2402 void scr_roster_bottom(void) | 2404 void scr_roster_bottom(void) |
2403 { | 2405 { |
2404 set_current_buddy(g_list_last(buddylist)); | 2406 set_current_buddy(g_list_last(buddylist)); |
2405 if (chatmode) | 2407 if (chatmode) { |
2408 last_activity_buddy = current_buddy; | |
2406 scr_show_buddy_window(); | 2409 scr_show_buddy_window(); |
2410 } | |
2407 } | 2411 } |
2408 | 2412 |
2409 // scr_roster_up_down(updown, n) | 2413 // scr_roster_up_down(updown, n) |
2410 // Go to the nth next buddy in the buddylist | 2414 // Go to the nth next buddy in the buddylist |
2411 // (up if updown == -1, down if updown == 1) | 2415 // (up if updown == -1, down if updown == 1) |
2418 set_current_buddy(g_list_previous(current_buddy)); | 2422 set_current_buddy(g_list_previous(current_buddy)); |
2419 } else { | 2423 } else { |
2420 for (i = 0; i < n; i++) | 2424 for (i = 0; i < n; i++) |
2421 set_current_buddy(g_list_next(current_buddy)); | 2425 set_current_buddy(g_list_next(current_buddy)); |
2422 } | 2426 } |
2423 if (chatmode) | 2427 if (chatmode) { |
2428 last_activity_buddy = current_buddy; | |
2424 scr_show_buddy_window(); | 2429 scr_show_buddy_window(); |
2430 } | |
2425 } | 2431 } |
2426 | 2432 |
2427 // scr_roster_prev_group() | 2433 // scr_roster_prev_group() |
2428 // Go to the previous group in the buddylist | 2434 // Go to the previous group in the buddylist |
2429 void scr_roster_prev_group(void) | 2435 void scr_roster_prev_group(void) |
2434 bud = g_list_previous(bud); | 2440 bud = g_list_previous(bud); |
2435 if (!bud) | 2441 if (!bud) |
2436 break; | 2442 break; |
2437 if (buddy_gettype(BUDDATA(bud)) & ROSTER_TYPE_GROUP) { | 2443 if (buddy_gettype(BUDDATA(bud)) & ROSTER_TYPE_GROUP) { |
2438 set_current_buddy(bud); | 2444 set_current_buddy(bud); |
2439 if (chatmode) | 2445 if (chatmode) { |
2446 last_activity_buddy = current_buddy; | |
2440 scr_show_buddy_window(); | 2447 scr_show_buddy_window(); |
2448 } | |
2441 break; | 2449 break; |
2442 } | 2450 } |
2443 } | 2451 } |
2444 } | 2452 } |
2445 | 2453 |
2453 bud = g_list_next(bud); | 2461 bud = g_list_next(bud); |
2454 if (!bud) | 2462 if (!bud) |
2455 break; | 2463 break; |
2456 if (buddy_gettype(BUDDATA(bud)) & ROSTER_TYPE_GROUP) { | 2464 if (buddy_gettype(BUDDATA(bud)) & ROSTER_TYPE_GROUP) { |
2457 set_current_buddy(bud); | 2465 set_current_buddy(bud); |
2458 if (chatmode) | 2466 if (chatmode) { |
2467 last_activity_buddy = current_buddy; | |
2459 scr_show_buddy_window(); | 2468 scr_show_buddy_window(); |
2469 } | |
2460 break; | 2470 break; |
2461 } | 2471 } |
2462 } | 2472 } |
2463 } | 2473 } |
2464 | 2474 |
2465 // scr_roster_search(str) | 2475 // scr_roster_search(str) |
2466 // Look forward for a buddy with jid/name containing str. | 2476 // Look forward for a buddy with jid/name containing str. |
2467 void scr_roster_search(char *str) | 2477 void scr_roster_search(char *str) |
2468 { | 2478 { |
2469 set_current_buddy(buddy_search(str)); | 2479 set_current_buddy(buddy_search(str)); |
2470 if (chatmode) | 2480 if (chatmode) { |
2481 last_activity_buddy = current_buddy; | |
2471 scr_show_buddy_window(); | 2482 scr_show_buddy_window(); |
2483 } | |
2472 } | 2484 } |
2473 | 2485 |
2474 // scr_roster_jump_jid(bjid) | 2486 // scr_roster_jump_jid(bjid) |
2475 // Jump to buddy bjid. | 2487 // Jump to buddy bjid. |
2476 // NOTE: With this function, the buddy is added to the roster if doesn't exist. | 2488 // NOTE: With this function, the buddy is added to the roster if doesn't exist. |
2487 // Set a lock to see it in the buddylist | 2499 // Set a lock to see it in the buddylist |
2488 buddy_setflags(BUDDATA(roster_elt), ROSTER_FLAG_LOCK, TRUE); | 2500 buddy_setflags(BUDDATA(roster_elt), ROSTER_FLAG_LOCK, TRUE); |
2489 buddylist_build(); | 2501 buddylist_build(); |
2490 // Jump to the buddy | 2502 // Jump to the buddy |
2491 set_current_buddy(buddy_search_jid(barejid)); | 2503 set_current_buddy(buddy_search_jid(barejid)); |
2492 if (chatmode) | 2504 if (chatmode) { |
2505 last_activity_buddy = current_buddy; | |
2493 scr_show_buddy_window(); | 2506 scr_show_buddy_window(); |
2507 } | |
2494 } | 2508 } |
2495 | 2509 |
2496 // scr_roster_unread_message(next) | 2510 // scr_roster_unread_message(next) |
2497 // Go to a new message. If next is not null, try to go to the next new | 2511 // Go to a new message. If next is not null, try to go to the next new |
2498 // message. If it is not possible or if next is NULL, go to the first new | 2512 // message. If it is not possible or if next is NULL, go to the first new |
2507 | 2521 |
2508 if (next) refbuddata = BUDDATA(current_buddy); | 2522 if (next) refbuddata = BUDDATA(current_buddy); |
2509 else refbuddata = NULL; | 2523 else refbuddata = NULL; |
2510 | 2524 |
2511 unread_ptr = unread_msg(refbuddata); | 2525 unread_ptr = unread_msg(refbuddata); |
2512 if (!unread_ptr) return; | 2526 if (!unread_ptr) { |
2527 if (!last_activity_buddy || g_list_position(buddylist, last_activity_buddy) == -1) | |
2528 return; | |
2529 unread_ptr = BUDDATA(last_activity_buddy); | |
2530 } | |
2513 | 2531 |
2514 if (!(buddy_gettype(unread_ptr) & ROSTER_TYPE_SPECIAL)) { | 2532 if (!(buddy_gettype(unread_ptr) & ROSTER_TYPE_SPECIAL)) { |
2515 gpointer ngroup; | 2533 gpointer ngroup; |
2516 // If buddy is in a folded group, we need to expand it | 2534 // If buddy is in a folded group, we need to expand it |
2517 ngroup = buddy_getgroup(unread_ptr); | 2535 ngroup = buddy_getgroup(unread_ptr); |
3485 // Validate current command line. | 3503 // Validate current command line. |
3486 // If down_history is true, load the next history line. | 3504 // If down_history is true, load the next history line. |
3487 int readline_accept_line(int down_history) | 3505 int readline_accept_line(int down_history) |
3488 { | 3506 { |
3489 scr_check_auto_away(TRUE); | 3507 scr_check_auto_away(TRUE); |
3508 last_activity_buddy = current_buddy; | |
3490 if (process_line(inputLine)) | 3509 if (process_line(inputLine)) |
3491 return 255; | 3510 return 255; |
3492 // Add line to history | 3511 // Add line to history |
3493 scr_cmdhisto_addline(inputLine); | 3512 scr_cmdhisto_addline(inputLine); |
3494 // Reset the line | 3513 // Reset the line |