Mercurial > hg
comparison mcabber/src/screen.c @ 848:a9161d2dc414
Introduce special buffer stuff
Update roster and commands: add support for a new "special" kind of buffer.
A special buffer "[status]" is automatically created at startup.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 08 May 2006 23:45:58 +0200 |
parents | 915a7f17474a |
children | 42c43a88d823 |
comparison
equal
deleted
inserted
replaced
847:e1b7f71b0b1c | 848:a9161d2dc414 |
---|---|
831 // scr_UpdateChatStatus(forceupdate) | 831 // scr_UpdateChatStatus(forceupdate) |
832 // Redraw the buddy status bar. | 832 // Redraw the buddy status bar. |
833 // Set forceupdate to TRUE if doupdate() must be called. | 833 // Set forceupdate to TRUE if doupdate() must be called. |
834 void scr_UpdateChatStatus(int forceupdate) | 834 void scr_UpdateChatStatus(int forceupdate) |
835 { | 835 { |
836 unsigned short btype, isgrp, ismuc; | 836 unsigned short btype, isgrp, ismuc, isspe; |
837 const char *fullname; | 837 const char *fullname; |
838 const char *msg = NULL; | 838 const char *msg = NULL; |
839 char status; | 839 char status; |
840 char *buf, *buf_locale; | 840 char *buf, *buf_locale; |
841 | 841 |
860 fullname = buddy_getname(BUDDATA(current_buddy)); | 860 fullname = buddy_getname(BUDDATA(current_buddy)); |
861 btype = buddy_gettype(BUDDATA(current_buddy)); | 861 btype = buddy_gettype(BUDDATA(current_buddy)); |
862 | 862 |
863 isgrp = btype & ROSTER_TYPE_GROUP; | 863 isgrp = btype & ROSTER_TYPE_GROUP; |
864 ismuc = btype & ROSTER_TYPE_ROOM; | 864 ismuc = btype & ROSTER_TYPE_ROOM; |
865 | 865 isspe = btype & ROSTER_TYPE_SPECIAL; |
866 if (isgrp) { | 866 |
867 if (isgrp || isspe) { | |
867 buf_locale = from_utf8(fullname); | 868 buf_locale = from_utf8(fullname); |
868 mvwprintw(chatstatusWnd, 0, 5, "Group: %s", buf_locale); | 869 if (isgrp) |
870 mvwprintw(chatstatusWnd, 0, 5, "Group: %s", buf_locale); | |
871 else | |
872 mvwprintw(chatstatusWnd, 0, 5, "Special buffer: %s", buf_locale); | |
869 g_free(buf_locale); | 873 g_free(buf_locale); |
870 if (forceupdate) { | 874 if (forceupdate) { |
871 update_panels(); | 875 update_panels(); |
872 doupdate(); | 876 doupdate(); |
873 } | 877 } |
983 | 987 |
984 buddy = buddylist; | 988 buddy = buddylist; |
985 rOffset = offset; | 989 rOffset = offset; |
986 | 990 |
987 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) { | 991 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) { |
988 unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid; | 992 unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid, isspe; |
989 gchar *rline_locale; | 993 gchar *rline_locale; |
990 | 994 |
991 bflags = buddy_getflags(BUDDATA(buddy)); | 995 bflags = buddy_getflags(BUDDATA(buddy)); |
992 btype = buddy_gettype(BUDDATA(buddy)); | 996 btype = buddy_gettype(BUDDATA(buddy)); |
993 | 997 |
994 ismsg = bflags & ROSTER_FLAG_MSG; | 998 ismsg = bflags & ROSTER_FLAG_MSG; |
995 ishid = bflags & ROSTER_FLAG_HIDE; | 999 ishid = bflags & ROSTER_FLAG_HIDE; |
996 isgrp = btype & ROSTER_TYPE_GROUP; | 1000 isgrp = btype & ROSTER_TYPE_GROUP; |
997 ismuc = btype & ROSTER_TYPE_ROOM; | 1001 ismuc = btype & ROSTER_TYPE_ROOM; |
1002 isspe = btype & ROSTER_TYPE_SPECIAL; | |
998 | 1003 |
999 if (rOffset > 0) { | 1004 if (rOffset > 0) { |
1000 rOffset--; | 1005 rOffset--; |
1001 continue; | 1006 continue; |
1002 } | 1007 } |
1047 if (ishid) | 1052 if (ishid) |
1048 sep = "+++"; | 1053 sep = "+++"; |
1049 else | 1054 else |
1050 sep = "---"; | 1055 sep = "---"; |
1051 snprintf(rline, Roster_Width, " %c%s %s", pending, sep, name); | 1056 snprintf(rline, Roster_Width, " %c%s %s", pending, sep, name); |
1057 } else if (isspe) { | |
1058 snprintf(rline, Roster_Width, " %c%s", pending, name); | |
1052 } else { | 1059 } else { |
1053 char sepleft = '['; | 1060 char sepleft = '['; |
1054 char sepright = ']'; | 1061 char sepright = ']'; |
1055 if (btype & ROSTER_TYPE_USER) { | 1062 if (btype & ROSTER_TYPE_USER) { |
1056 guint subtype = buddy_getsubscription(BUDDATA(buddy)); | 1063 guint subtype = buddy_getsubscription(BUDDATA(buddy)); |