diff options
-rwxr-xr-x | vchat-config.h | 1 | ||||
-rwxr-xr-x | vchat-ui.c | 33 | ||||
-rwxr-xr-x | vchat.h | 4 |
3 files changed, 24 insertions, 14 deletions
diff --git a/vchat-config.h b/vchat-config.h index ca938b7..8a680de 100755 --- a/vchat-config.h +++ b/vchat-config.h | |||
@@ -43,6 +43,7 @@ static volatile configoption configoptions[] = { | |||
43 | {CF_USESSL, CO_INT, "usessl", (char *) 1, (char *)-1, (unsigned char **)&usessl }, | 43 | {CF_USESSL, CO_INT, "usessl", (char *) 1, (char *)-1, (unsigned char **)&usessl }, |
44 | {CF_USECERT, CO_INT, "usecert", (char *) 1, (char *)-1, NULL }, | 44 | {CF_USECERT, CO_INT, "usecert", (char *) 1, (char *)-1, NULL }, |
45 | {CF_USETIME, CO_INT, "usetime", (char *) 1, (char *)-1, (unsigned char **)&usetime }, | 45 | {CF_USETIME, CO_INT, "usetime", (char *) 1, (char *)-1, (unsigned char **)&usetime }, |
46 | {CF_USETOPIC, CO_INT, "usetopicbar",(char *) 1, (char *)-1, NULL }, | ||
46 | {CF_PRIVHEIGHT, CO_INT, "messages", (char *) 0, (char *)-1, NULL }, | 47 | {CF_PRIVHEIGHT, CO_INT, "messages", (char *) 0, (char *)-1, NULL }, |
47 | {CF_HSCROLL, CO_INT, "hscroll", (char *) 5, (char *)-1, (unsigned char **)&hscroll }, | 48 | {CF_HSCROLL, CO_INT, "hscroll", (char *) 5, (char *)-1, (unsigned char **)&hscroll }, |
48 | {CF_CHANNEL, CO_INT, "channel", (char *) 0, (char *)-1, NULL }, | 49 | {CF_CHANNEL, CO_INT, "channel", (char *) 0, (char *)-1, NULL }, |
@@ -784,7 +784,7 @@ redraw (void) | |||
784 | void | 784 | void |
785 | resize (int signal) | 785 | resize (int signal) |
786 | { | 786 | { |
787 | int xsize,ysize; | 787 | int xsize,ysize,topicheight=topic?1:0; |
788 | //errmsg ("! SIGWINCH raised without code for it, hope you didn't make it smaller ;)"); | 788 | //errmsg ("! SIGWINCH raised without code for it, hope you didn't make it smaller ;)"); |
789 | //endwin(); | 789 | //endwin(); |
790 | ttgtsz(&xsize,&ysize); | 790 | ttgtsz(&xsize,&ysize); |
@@ -813,16 +813,18 @@ resize (int signal) | |||
813 | wresize(console,1,screensx); | 813 | wresize(console,1,screensx); |
814 | wresize(input,1,screensx); | 814 | wresize(input,1,screensx); |
815 | if (private && !privwinhidden) | 815 | if (private && !privwinhidden) |
816 | wresize(private,privheight,screensx); | 816 | wresize(private,privheight,screensx); |
817 | wresize(topic,1,screensx); | 817 | if( topic ) |
818 | wresize(channel, privwinhidden ? screensy - 3 : screensy - (privheight + 3), screensx); | 818 | wresize(topic,1,screensx); |
819 | wresize(channel, privwinhidden ? screensy - ( topicheight + 2 ) : screensy - (privheight + ( topicheight + 2 )), screensx); | ||
819 | 820 | ||
820 | mvwin(console,screensy-2,0); | 821 | mvwin(console,screensy-2,0); |
821 | mvwin(input,screensy-1,0); | 822 | mvwin(input,screensy-1,0); |
822 | if(private && !privwinhidden) | 823 | if(private && !privwinhidden) |
823 | mvwin(private,0,0); | 824 | mvwin(private,0,0); |
824 | mvwin(topic,privwinhidden ? 0 : privheight, 0); | 825 | if( topic ) |
825 | mvwin(channel,privwinhidden ? 1 : privheight + 1, 0); | 826 | mvwin(topic,privwinhidden ? 0 : privheight, 0); |
827 | mvwin(channel,privwinhidden ? topicheight : privheight + topicheight, 0); | ||
826 | 828 | ||
827 | drawwin(channel, sb_pub); | 829 | drawwin(channel, sb_pub); |
828 | if(private && !privwinhidden ) | 830 | if(private && !privwinhidden ) |
@@ -1070,12 +1072,13 @@ initui (void) | |||
1070 | console = newwin (1, screensx, screensy - 2, 0); | 1072 | console = newwin (1, screensx, screensy - 2, 0); |
1071 | input = newwin (1, screensx, screensy - 1, 0); | 1073 | input = newwin (1, screensx, screensy - 1, 0); |
1072 | if (privheight) private = newwin (privheight, screensx, 0, 0); | 1074 | if (privheight) private = newwin (privheight, screensx, 0, 0); |
1073 | topic = newwin (1, screensx, privheight, 0); | 1075 | if( private || getintoption(CF_USETOPIC)) |
1076 | topic = newwin (1, screensx, privheight, 0); | ||
1074 | channel = newwin (screensy - (privheight+3), screensx, (privheight+1), 0); | 1077 | channel = newwin (screensy - (privheight+3), screensx, (privheight+1), 0); |
1075 | output = newwin (1, screensx, 1, 0); | 1078 | output = newwin (1, screensx, 1, 0); |
1076 | 1079 | ||
1077 | /* promblems opening windows? bye! */ | 1080 | /* promblems opening windows? bye! */ |
1078 | if (!console || !input || !topic || !channel || !output ) | 1081 | if (!console || !input || (!topic && getintoption(CF_USETOPIC))|| !channel || !output || ( !private && privheight )) |
1079 | { | 1082 | { |
1080 | fprintf (stderr, "vchat-client: could not open windows, bailing out.\n"); | 1083 | fprintf (stderr, "vchat-client: could not open windows, bailing out.\n"); |
1081 | cleanup (0); | 1084 | cleanup (0); |
@@ -1097,19 +1100,22 @@ initui (void) | |||
1097 | if (has_colors()) { | 1100 | if (has_colors()) { |
1098 | wattrset (console, COLOR_PAIR (9)); | 1101 | wattrset (console, COLOR_PAIR (9)); |
1099 | wattrset (input, COLOR_PAIR (0)); | 1102 | wattrset (input, COLOR_PAIR (0)); |
1100 | wattrset (topic, COLOR_PAIR (9)); | ||
1101 | wbkgd (output, COLOR_PAIR(8)); | 1103 | wbkgd (output, COLOR_PAIR(8)); |
1102 | wbkgd (console, COLOR_PAIR (9)); | 1104 | wbkgd (console, COLOR_PAIR (9)); |
1103 | wbkgd (channel, COLOR_PAIR (0)); | 1105 | wbkgd (channel, COLOR_PAIR (0)); |
1104 | wbkgd (input, COLOR_PAIR (0)); | 1106 | wbkgd (input, COLOR_PAIR (0)); |
1105 | if (private) | 1107 | if (private) |
1106 | wbkgd (private, COLOR_PAIR (0)); | 1108 | wbkgd (private, COLOR_PAIR (0)); |
1107 | wbkgd (topic, COLOR_PAIR (9)); | 1109 | if( topic ) { |
1110 | wattrset (topic, COLOR_PAIR (9)); | ||
1111 | wbkgd (topic, COLOR_PAIR (9)); | ||
1112 | } | ||
1108 | } else { | 1113 | } else { |
1109 | wattron (console, A_REVERSE); | 1114 | wattron (console, A_REVERSE); |
1110 | wattron (topic, A_REVERSE); | ||
1111 | wattron (output, A_REVERSE); | 1115 | wattron (output, A_REVERSE); |
1112 | wbkgd(output, A_REVERSE); | 1116 | wbkgd(output, A_REVERSE); |
1117 | if( topic ) | ||
1118 | wattron (topic, A_REVERSE); | ||
1113 | } | 1119 | } |
1114 | 1120 | ||
1115 | /* set some options */ | 1121 | /* set some options */ |
@@ -1293,6 +1299,9 @@ topicline (unsigned char *message) | |||
1293 | int i; | 1299 | int i; |
1294 | ncurs_attr old_att, new_att; | 1300 | ncurs_attr old_att, new_att; |
1295 | 1301 | ||
1302 | if( !topic ) | ||
1303 | return; | ||
1304 | |||
1296 | memset( &new_att, 0, sizeof(new_att)); | 1305 | memset( &new_att, 0, sizeof(new_att)); |
1297 | BCOLR_SET( (&new_att), 8 ); | 1306 | BCOLR_SET( (&new_att), 8 ); |
1298 | 1307 | ||
@@ -38,8 +38,8 @@ typedef enum { CO_NIL, CO_STR, CO_INT } conftype; | |||
38 | typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, | 38 | typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, |
39 | CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, CF_LOGFILE, | 39 | CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, CF_LOGFILE, |
40 | CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME, | 40 | CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME, |
41 | CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, CF_KEEPLOG, | 41 | CF_USETOPIC, CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, |
42 | CF_ENCODING } confopt; | 42 | CF_KEEPLOG, CF_ENCODING } confopt; |
43 | 43 | ||
44 | /* format strings */ | 44 | /* format strings */ |
45 | typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, | 45 | typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, |