comparison mcabber/src/screen.c @ 716:ba1137a01078

Add a chatmode flag (©) in the chat status line
author Mikael Berthe <mikael@lilotux.net>
date Sat, 04 Mar 2006 23:19:24 +0100
parents be9f6224c3ca
children 8ce2bfdc4143
comparison
equal deleted inserted replaced
715:be9f6224c3ca 716:ba1137a01078
714 // Refresh current buddy window 714 // Refresh current buddy window
715 if (chatmode) 715 if (chatmode)
716 scr_ShowBuddyWindow(); 716 scr_ShowBuddyWindow();
717 } 717 }
718 718
719 // update_chat_status_window() 719 // update_chat_status_window(forceupdate)
720 // Redraw the buddy status bar. 720 // Redraw the buddy status bar.
721 static void update_chat_status_window(void) 721 // Set forceupdate to TRUE if doupdate() must be called.
722 static void update_chat_status_window(int forceupdate)
722 { 723 {
723 unsigned short btype, isgrp, ismuc; 724 unsigned short btype, isgrp, ismuc;
724 const char *fullname; 725 const char *fullname;
725 const char *msg = NULL; 726 const char *msg = NULL;
726 char status; 727 char status;
733 ismuc = btype & ROSTER_TYPE_ROOM; 734 ismuc = btype & ROSTER_TYPE_ROOM;
734 735
735 // Clear the line 736 // Clear the line
736 werase(chatstatusWnd); 737 werase(chatstatusWnd);
737 738
739 if (chatmode)
740 wprintw(chatstatusWnd, "©");
741
738 if (isgrp) { 742 if (isgrp) {
739 mvwprintw(chatstatusWnd, 0, 5, "Group: %s", fullname); 743 mvwprintw(chatstatusWnd, 0, 5, "Group: %s", fullname);
744 if (forceupdate) {
745 update_panels();
746 doupdate();
747 }
740 return; 748 return;
741 } 749 }
742 750
743 status = '?'; 751 status = '?';
744 752
765 773
766 buf = g_strdup_printf("[%c] Buddy: %s -- %s", status, fullname, msg); 774 buf = g_strdup_printf("[%c] Buddy: %s -- %s", status, fullname, msg);
767 replace_nl_with_dots(buf); 775 replace_nl_with_dots(buf);
768 mvwprintw(chatstatusWnd, 0, 1, "%s", buf); 776 mvwprintw(chatstatusWnd, 0, 1, "%s", buf);
769 g_free(buf); 777 g_free(buf);
778
779 if (forceupdate) {
780 update_panels();
781 doupdate();
782 }
770 } 783 }
771 784
772 // scr_DrawRoster() 785 // scr_DrawRoster()
773 // Display the buddylist (not really the roster) on the screen 786 // Display the buddylist (not really the roster) on the screen
774 void scr_DrawRoster(void) 787 void scr_DrawRoster(void)
802 } 815 }
803 816
804 if (!buddylist) 817 if (!buddylist)
805 offset = 0; 818 offset = 0;
806 else 819 else
807 update_chat_status_window(); 820 update_chat_status_window(FALSE);
808 821
809 // Leave now if buddylist is empty or the roster is hidden 822 // Leave now if buddylist is empty or the roster is hidden
810 if (!buddylist || !Roster_Width) { 823 if (!buddylist || !Roster_Width) {
811 update_panels(); 824 update_panels();
812 doupdate(); 825 doupdate();
1364 // scr_set_chatmode() 1377 // scr_set_chatmode()
1365 // Public function to (un)set chatmode... 1378 // Public function to (un)set chatmode...
1366 inline void scr_set_chatmode(int enable) 1379 inline void scr_set_chatmode(int enable)
1367 { 1380 {
1368 chatmode = enable; 1381 chatmode = enable;
1382 update_chat_status_window(TRUE);
1369 } 1383 }
1370 1384
1371 // scr_get_multimode() 1385 // scr_get_multimode()
1372 // Public function to get multimode status... 1386 // Public function to get multimode status...
1373 inline int scr_get_multimode() 1387 inline int scr_get_multimode()
1893 currentWindow = NULL; 1907 currentWindow = NULL;
1894 chatmode = FALSE; 1908 chatmode = FALSE;
1895 if (current_buddy) 1909 if (current_buddy)
1896 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE); 1910 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);
1897 scr_RosterVisibility(1); 1911 scr_RosterVisibility(1);
1912 update_chat_status_window(FALSE);
1898 top_panel(chatPanel); 1913 top_panel(chatPanel);
1899 top_panel(inputPanel); 1914 top_panel(inputPanel);
1900 update_panels(); 1915 update_panels();
1901 break; 1916 break;
1902 case 12: // Ctrl-l 1917 case 12: // Ctrl-l