comparison mcabber/src/screen.c @ 119:d7fbd5293385

[/trunk] Changeset 132 by mikael * Current buddy should not be removed from the buddylist * It should be removed if it is offline and the cursor moves.
author mikael
date Mon, 25 Apr 2005 20:34:59 +0000
parents 33bff2c57293
children cfd3df636d5f
comparison
equal deleted inserted replaced
118:1e8f646e2c5b 119:d7fbd5293385
286 if (win_entry != NULL) { 286 if (win_entry != NULL) {
287 top_panel(win_entry->panel); 287 top_panel(win_entry->panel);
288 currentWindow = win_entry; 288 currentWindow = win_entry;
289 chatmode = TRUE; 289 chatmode = TRUE;
290 roster_setflags(winId, ROSTER_FLAG_MSG, FALSE); 290 roster_setflags(winId, ROSTER_FLAG_MSG, FALSE);
291 roster_setflags(winId, ROSTER_FLAG_LOCK, TRUE);
291 update_roster = TRUE; 292 update_roster = TRUE;
292 293
293 // Refresh the window 294 // Refresh the window
294 scr_UpdateWindow(win_entry); 295 scr_UpdateWindow(win_entry);
295 296
562 return inputWnd; 563 return inputWnd;
563 } 564 }
564 565
565 void scr_RosterTop(void) 566 void scr_RosterTop(void)
566 { 567 {
568 enum imstatus prev_st;
569
570 if (current_buddy) {
571 prev_st = buddy_getstatus(BUDDATA(current_buddy));
572 if (chatmode)
573 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
574 }
567 current_buddy = buddylist; 575 current_buddy = buddylist;
568 // XXX We should rebuild the buddylist but perhaps not everytime? 576 if (chatmode && current_buddy)
577 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE);
578
579 // We should rebuild the buddylist but not everytime
580 if (current_buddy && prev_st == offline)
581 buddylist_build();
569 if (chatmode) 582 if (chatmode)
570 scr_ShowBuddyWindow(); 583 scr_ShowBuddyWindow();
571 } 584 }
572 585
573 void scr_RosterBottom(void) 586 void scr_RosterBottom(void)
574 { 587 {
588 enum imstatus prev_st;
589
590 if (current_buddy) {
591 prev_st = buddy_getstatus(BUDDATA(current_buddy));
592 if (chatmode)
593 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
594 }
575 current_buddy = g_list_last(buddylist); 595 current_buddy = g_list_last(buddylist);
576 // XXX We should rebuild the buddylist but perhaps not everytime? 596 if (chatmode && current_buddy)
597 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE);
598
599 // We should rebuild the buddylist but not everytime
600 if (current_buddy && prev_st == offline)
601 buddylist_build();
577 if (chatmode) 602 if (chatmode)
578 scr_ShowBuddyWindow(); 603 scr_ShowBuddyWindow();
579 } 604 }
580 605
581 void scr_RosterUp(void) 606 void scr_RosterUp(void)
582 { 607 {
608 enum imstatus prev_st;
609
583 if (current_buddy) { 610 if (current_buddy) {
611 prev_st = buddy_getstatus(BUDDATA(current_buddy));
584 if (g_list_previous(current_buddy)) { 612 if (g_list_previous(current_buddy)) {
613 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
585 current_buddy = g_list_previous(current_buddy); 614 current_buddy = g_list_previous(current_buddy);
615 if (chatmode)
616 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE);
617 // We should rebuild the buddylist but not everytime
618 if (prev_st == offline)
619 buddylist_build();
586 scr_DrawRoster(); 620 scr_DrawRoster();
587 } 621 }
588 } 622 }
589 // XXX We should rebuild the buddylist but perhaps not everytime?
590 623
591 if (chatmode) 624 if (chatmode)
592 scr_ShowBuddyWindow(); 625 scr_ShowBuddyWindow();
593 } 626 }
594 627
595 void scr_RosterDown(void) 628 void scr_RosterDown(void)
596 { 629 {
630 enum imstatus prev_st;
631
597 if (current_buddy) { 632 if (current_buddy) {
633 prev_st = buddy_getstatus(BUDDATA(current_buddy));
598 if (g_list_next(current_buddy)) { 634 if (g_list_next(current_buddy)) {
635 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
599 current_buddy = g_list_next(current_buddy); 636 current_buddy = g_list_next(current_buddy);
637 if (chatmode)
638 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE);
639 // We should rebuild the buddylist but not everytime
640 if (prev_st == offline)
641 buddylist_build();
600 scr_DrawRoster(); 642 scr_DrawRoster();
601 } 643 }
602 } 644 }
603 // XXX We should rebuild the buddylist but perhaps not everytime?
604 645
605 if (chatmode) 646 if (chatmode)
606 scr_ShowBuddyWindow(); 647 scr_ShowBuddyWindow();
607 } 648 }
608 649
929 scr_handle_tab(); 970 scr_handle_tab();
930 check_offset(0); 971 check_offset(0);
931 break; 972 break;
932 case '\n': // Enter 973 case '\n': // Enter
933 chatmode = TRUE; 974 chatmode = TRUE;
975 if (current_buddy)
976 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, TRUE);
934 if (inputLine[0] == 0) { 977 if (inputLine[0] == 0) {
935 scr_ShowBuddyWindow(); 978 scr_ShowBuddyWindow();
936 break; 979 break;
937 } 980 }
938 if (process_line(inputLine)) 981 if (process_line(inputLine))
979 scr_LogPrint("Ctrl-n not yet implemented"); 1022 scr_LogPrint("Ctrl-n not yet implemented");
980 break; 1023 break;
981 case 27: // ESC 1024 case 27: // ESC
982 currentWindow = NULL; 1025 currentWindow = NULL;
983 chatmode = FALSE; 1026 chatmode = FALSE;
1027 if (current_buddy)
1028 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
984 top_panel(chatPanel); 1029 top_panel(chatPanel);
985 top_panel(inputPanel); 1030 top_panel(inputPanel);
986 break; 1031 break;
987 default: 1032 default:
988 scr_LogPrint("Unkown key=%d", key); 1033 scr_LogPrint("Unkown key=%d", key);