comparison mcabber/src/screen.c @ 773:e25b8a348ebd

Screen updating functions use UTF-8 scr_DrawRoster(), scr_UpdateMainStatus(), scr_UpdateChatStatus() and scr_WriteInWindow() expect UTF-8 data.
author Mikael Berthe <mikael@lilotux.net>
date Sat, 25 Mar 2006 18:14:37 +0100
parents 464be13343a9
children 057ffe7c43dc
comparison
equal deleted inserted replaced
772:464be13343a9 773:e25b8a348ebd
633 633
634 // scr_UpdateMainStatus() 634 // scr_UpdateMainStatus()
635 // Redraw the main (bottom) status line. 635 // Redraw the main (bottom) status line.
636 void scr_UpdateMainStatus(int forceupdate) 636 void scr_UpdateMainStatus(int forceupdate)
637 { 637 {
638 const char *sm = jb_getstatusmsg(); 638 char *sm = from_utf8(jb_getstatusmsg());
639 639
640 werase(mainstatusWnd); 640 werase(mainstatusWnd);
641 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s", 641 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s",
642 (unread_msg(NULL) ? '#' : ' '), 642 (unread_msg(NULL) ? '#' : ' '),
643 imstatus2char[jb_getstatus()], (sm ? sm : "")); 643 imstatus2char[jb_getstatus()], (sm ? sm : ""));
644 if (forceupdate) { 644 if (forceupdate) {
645 top_panel(inputPanel); 645 top_panel(inputPanel);
646 update_panels(); 646 update_panels();
647 doupdate(); 647 doupdate();
648 } 648 }
649 g_free(sm);
649 } 650 }
650 651
651 // scr_DrawMainWindow() 652 // scr_DrawMainWindow()
652 // Set fullinit to TRUE to also create panels. Set it to FALSE for a resize. 653 // Set fullinit to TRUE to also create panels. Set it to FALSE for a resize.
653 // 654 //
831 { 832 {
832 unsigned short btype, isgrp, ismuc; 833 unsigned short btype, isgrp, ismuc;
833 const char *fullname; 834 const char *fullname;
834 const char *msg = NULL; 835 const char *msg = NULL;
835 char status; 836 char status;
836 char *buf; 837 char *buf, *buf_locale;
837 838
838 // Usually we need to update the bottom status line too, 839 // Usually we need to update the bottom status line too,
839 // at least to refresh the pending message flag. 840 // at least to refresh the pending message flag.
840 scr_UpdateMainStatus(FALSE); 841 scr_UpdateMainStatus(FALSE);
841 842
850 851
851 if (chatmode) 852 if (chatmode)
852 wprintw(chatstatusWnd, "~"); 853 wprintw(chatstatusWnd, "~");
853 854
854 if (isgrp) { 855 if (isgrp) {
855 mvwprintw(chatstatusWnd, 0, 5, "Group: %s", fullname); 856 buf_locale = from_utf8(fullname);
857 mvwprintw(chatstatusWnd, 0, 5, "Group: %s", buf_locale);
858 g_free(buf_locale);
856 if (forceupdate) { 859 if (forceupdate) {
857 update_panels(); 860 update_panels();
858 doupdate(); 861 doupdate();
859 } 862 }
860 return; 863 return;
885 if (!msg) 888 if (!msg)
886 msg = ""; 889 msg = "";
887 890
888 buf = g_strdup_printf("[%c] Buddy: %s -- %s", status, fullname, msg); 891 buf = g_strdup_printf("[%c] Buddy: %s -- %s", status, fullname, msg);
889 replace_nl_with_dots(buf); 892 replace_nl_with_dots(buf);
890 mvwprintw(chatstatusWnd, 0, 1, "%s", buf); 893 buf_locale = from_utf8(buf);
894 mvwprintw(chatstatusWnd, 0, 1, "%s", buf_locale);
895 g_free(buf_locale);
891 g_free(buf); 896 g_free(buf);
892 897
893 if (forceupdate) { 898 if (forceupdate) {
894 update_panels(); 899 update_panels();
895 doupdate(); 900 doupdate();
968 buddy = buddylist; 973 buddy = buddylist;
969 rOffset = offset; 974 rOffset = offset;
970 975
971 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) { 976 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) {
972 unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid; 977 unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid;
978 gchar *rline_locale;
973 979
974 bflags = buddy_getflags(BUDDATA(buddy)); 980 bflags = buddy_getflags(BUDDATA(buddy));
975 btype = buddy_gettype(BUDDATA(buddy)); 981 btype = buddy_gettype(BUDDATA(buddy));
976 982
977 ismsg = bflags & ROSTER_FLAG_MSG; 983 ismsg = bflags & ROSTER_FLAG_MSG;
1034 snprintf(rline, Roster_Width, " %c%s %s", pending, sep, name); 1040 snprintf(rline, Roster_Width, " %c%s %s", pending, sep, name);
1035 } else { 1041 } else {
1036 snprintf(rline, Roster_Width, " %c[%c] %s", pending, status, name); 1042 snprintf(rline, Roster_Width, " %c[%c] %s", pending, status, name);
1037 } 1043 }
1038 1044
1039 mvwprintw(rosterWnd, i, 0, "%s", rline); 1045 rline_locale = from_utf8(rline);
1046 mvwprintw(rosterWnd, i, 0, "%s", rline_locale);
1047 g_free(rline_locale);
1040 i++; 1048 i++;
1041 } 1049 }
1042 1050
1043 g_free(rline); 1051 g_free(rline);
1044 g_free(name); 1052 g_free(name);