diff options
Diffstat (limited to 'vchat.h')
-rwxr-xr-x | vchat.h | 217 |
1 files changed, 146 insertions, 71 deletions
@@ -10,7 +10,7 @@ | |||
10 | * without even the implied warranty of merchantability or fitness for a | 10 | * without even the implied warranty of merchantability or fitness for a |
11 | * particular purpose. In no event shall the copyright holder be liable for | 11 | * particular purpose. In no event shall the copyright holder be liable for |
12 | * any direct, indirect, incidental or special damages arising in any way out | 12 | * any direct, indirect, incidental or special damages arising in any way out |
13 | * of the use of this software. | 13 | * of the use of this software. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
@@ -18,56 +18,126 @@ | |||
18 | typedef enum { SM_IGNORE, SM_INFO, SM_USERINFO, SM_CHANNEL, SM_ERROR } smtype; | 18 | typedef enum { SM_IGNORE, SM_INFO, SM_USERINFO, SM_CHANNEL, SM_ERROR } smtype; |
19 | 19 | ||
20 | /* servermessage structure */ | 20 | /* servermessage structure */ |
21 | struct servermessage | 21 | struct servermessage { |
22 | { | 22 | char id[4]; /* three-character message id */ |
23 | char id[4]; /* three-character message id */ | 23 | smtype type; /* message type */ |
24 | smtype type; /* message type */ | 24 | void (*funct)(char *); /* function used by client */ |
25 | void (*funct) (char *); /* function used by client */ | 25 | void (*hook)(char *); /* function hook for scripting */ |
26 | void (*hook) (char *); /* function hook for scripting */ | ||
27 | }; | 26 | }; |
28 | typedef struct servermessage servermessage; | 27 | typedef struct servermessage servermessage; |
29 | 28 | ||
30 | /* configuration types and variable numbers */ | 29 | /* configuration types and variable numbers */ |
31 | typedef enum { CO_NIL, CO_STR, CO_INT } conftype; | 30 | typedef enum { CO_NIL, CO_STR, CO_INT } conftype; |
32 | typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, | 31 | typedef enum { |
33 | CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_CAFILE, CF_FORMFILE, | 32 | CF_NIL, |
34 | CF_LOGINSCRIPT, CF_FINGERPRINT, CF_PINFINGER, CF_USESSL, CF_IGNSSL, CF_VERIFYSSL, CF_USECERT, | 33 | CF_NICK, |
35 | CF_PRIVHEIGHT, CF_PRIVCOLLAPS, CF_INVWINBAR, CF_HSCROLL, CF_CHANNEL, CF_USETIME, CF_USETOPIC, | 34 | CF_FROM, |
36 | CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, CF_ENCODING, | 35 | CF_SERVERHOST, |
37 | CF_BELLPRIV, CF_CASEFIRST, CF_AUTORECONN, CF_KEEPALIVE } confopt; | 36 | CF_SERVERPORT, |
37 | CF_CIPHERSUITE, | ||
38 | CF_CONFIGFILE, | ||
39 | CF_CERTFILE, | ||
40 | CF_KEYFILE, | ||
41 | CF_CAFILE, | ||
42 | CF_FORMFILE, | ||
43 | CF_LOGINSCRIPT, | ||
44 | CF_FINGERPRINT, | ||
45 | CF_PINFINGER, | ||
46 | CF_USESSL, | ||
47 | CF_IGNSSL, | ||
48 | CF_VERIFYSSL, | ||
49 | CF_USECERT, | ||
50 | CF_PRIVHEIGHT, | ||
51 | CF_PRIVCOLLAPS, | ||
52 | CF_INVWINBAR, | ||
53 | CF_HSCROLL, | ||
54 | CF_CHANNEL, | ||
55 | CF_USETIME, | ||
56 | CF_USETOPIC, | ||
57 | CF_SCROLLBPRIV, | ||
58 | CF_SCROLLBACK, | ||
59 | CF_SCROLLBPRIVT, | ||
60 | CF_SCROLLBACKT, | ||
61 | CF_ENCODING, | ||
62 | CF_BELLPRIV, | ||
63 | CF_CASEFIRST, | ||
64 | CF_AUTORECONN, | ||
65 | CF_KEEPALIVE | ||
66 | } confopt; | ||
38 | 67 | ||
39 | /* format strings */ | 68 | /* format strings */ |
40 | typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, | 69 | typedef enum { |
41 | FS_IDLE, FS_TIME, FS_CONSOLETIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, FS_CANTCONNECT, | 70 | FS_PLAIN, |
42 | FS_TOPIC, FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, | 71 | FS_CHAN, |
43 | FS_JOIN, FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, | 72 | FS_PRIV, |
44 | FS_MYPUBURL, FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG, | 73 | FS_SERV, |
45 | FS_BGPRIVMSG, FS_PUBTHOUGHT, FS_TXPUBTHOUGHT, FS_TXPUBNTHOUGHT, FS_PUBACTION, | 74 | FS_GLOB, |
46 | FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND, FS_LOCALCOMMAND, FS_BOGUSCOMMAND, | 75 | FS_DBG, |
47 | FS_SBINF, FS_MISSTYPED, FS_UNKNCMD, FS_BADREGEX, FS_ERR_STRING } formtstr; | 76 | FS_ERR, |
77 | FS_IDLE, | ||
78 | FS_TIME, | ||
79 | FS_CONSOLETIME, | ||
80 | FS_TOPICW, | ||
81 | FS_NOTOPICW, | ||
82 | FS_CONSOLE, | ||
83 | FS_CONNECTED, | ||
84 | FS_CANTCONNECT, | ||
85 | FS_TOPIC, | ||
86 | FS_NOTOPIC, | ||
87 | FS_CHGTOPIC, | ||
88 | FS_USONLINE, | ||
89 | FS_USMATCH, | ||
90 | FS_SIGNON, | ||
91 | FS_SIGNOFF, | ||
92 | FS_JOIN, | ||
93 | FS_LEAVE, | ||
94 | FS_NICKCHANGE, | ||
95 | FS_UNKNOWNMSG, | ||
96 | FS_BOGUSMSG, | ||
97 | FS_RXPUBURL, | ||
98 | FS_MYPUBURL, | ||
99 | FS_RXPUBMSG, | ||
100 | FS_MYPUBMSG, | ||
101 | FS_TXPUBMSG, | ||
102 | FS_RXPRIVMSG, | ||
103 | FS_TXPRIVMSG, | ||
104 | FS_BGPRIVMSG, | ||
105 | FS_PUBTHOUGHT, | ||
106 | FS_TXPUBTHOUGHT, | ||
107 | FS_TXPUBNTHOUGHT, | ||
108 | FS_PUBACTION, | ||
109 | FS_TXPUBACTION, | ||
110 | FS_BGTXPUBACTION, | ||
111 | FS_COMMAND, | ||
112 | FS_LOCALCOMMAND, | ||
113 | FS_BOGUSCOMMAND, | ||
114 | FS_SBINF, | ||
115 | FS_MISSTYPED, | ||
116 | FS_UNKNCMD, | ||
117 | FS_BADREGEX, | ||
118 | FS_ERR_STRING | ||
119 | } formtstr; | ||
48 | 120 | ||
49 | /* configoption structure */ | 121 | /* configoption structure */ |
50 | struct configoption | 122 | struct configoption { |
51 | { | 123 | confopt id; |
52 | confopt id; | ||
53 | conftype type; | 124 | conftype type; |
54 | char *varname; | 125 | char *varname; |
55 | char *defaultvalue; | 126 | char *defaultvalue; |
56 | char *value; | 127 | char *value; |
57 | union { | 128 | union { |
58 | char **pstr; | 129 | char **pstr; |
59 | unsigned int *pint; | 130 | unsigned int *pint; |
60 | } localvar; | 131 | } localvar; |
61 | }; | 132 | }; |
62 | 133 | ||
63 | typedef struct configoption configoption; | 134 | typedef struct configoption configoption; |
64 | 135 | ||
65 | /* format strings */ | 136 | /* format strings */ |
66 | struct formatstring | 137 | struct formatstring { |
67 | { | ||
68 | formtstr id; | 138 | formtstr id; |
69 | char *idstring; | 139 | char *idstring; |
70 | char *formatstr; | 140 | char *formatstr; |
71 | }; | 141 | }; |
72 | typedef struct formatstring formatstring; | 142 | typedef struct formatstring formatstring; |
73 | 143 | ||
@@ -82,16 +152,16 @@ extern unsigned int want_tcp_keepalive; | |||
82 | #define ERRSTRSIZE 1024 | 152 | #define ERRSTRSIZE 1024 |
83 | extern char errstr[]; | 153 | extern char errstr[]; |
84 | extern const char *vchat_cl_version; | 154 | extern const char *vchat_cl_version; |
85 | void loadcfg (char *file,int complain,void (*lineparser) (char *)); | 155 | void loadcfg(char *file, int complain, void (*lineparser)(char *)); |
86 | void loadformats (char *file); | 156 | void loadformats(char *file); |
87 | void cleanup(int signal); | 157 | void cleanup(int signal); |
88 | 158 | ||
89 | /* configuration helper functions from vchat-client.c */ | 159 | /* configuration helper functions from vchat-client.c */ |
90 | char *getformatstr (formtstr id); | 160 | char *getformatstr(formtstr id); |
91 | char *getstroption (confopt option); | 161 | char *getstroption(confopt option); |
92 | void setstroption (confopt option, char *string); | 162 | void setstroption(confopt option, char *string); |
93 | int getintoption (confopt option); | 163 | int getintoption(confopt option); |
94 | void setintoption (confopt option, int value); | 164 | void setintoption(confopt option, int value); |
95 | 165 | ||
96 | /* vchat-ui.c */ | 166 | /* vchat-ui.c */ |
97 | extern const char *vchat_ui_version; | 167 | extern const char *vchat_ui_version; |
@@ -104,66 +174,71 @@ extern char consolestr[]; | |||
104 | extern char *encoding; | 174 | extern char *encoding; |
105 | 175 | ||
106 | /* init / exit functions */ | 176 | /* init / exit functions */ |
107 | void initui (void); | 177 | void initui(void); |
108 | void exitui (void); | 178 | void exitui(void); |
109 | 179 | ||
110 | /* called from eventloop in vchat-client.c */ | 180 | /* called from eventloop in vchat-client.c */ |
111 | void userinput (void); | 181 | void userinput(void); |
112 | 182 | ||
113 | /* display various messages */ | 183 | /* display various messages */ |
114 | int writechan (char *str); | 184 | int writechan(char *str); |
115 | int writepriv (char *str, int maybeep ); | 185 | int writepriv(char *str, int maybeep); |
116 | void writeout (const char *str); | 186 | void writeout(const char *str); |
117 | void showout (void); | 187 | void showout(void); |
118 | void flushout (void); | 188 | void flushout(void); |
119 | #define msgout(STR) {flushout();writeout(STR);showout();} | 189 | #define msgout(STR) \ |
120 | void hideout (void); | 190 | { \ |
121 | int writecf (formtstr id, char *str); | 191 | flushout(); \ |
192 | writeout(STR); \ | ||
193 | showout(); \ | ||
194 | } | ||
195 | void hideout(void); | ||
196 | int writecf(formtstr id, char *str); | ||
122 | 197 | ||
123 | extern int outputcountdown; | 198 | extern int outputcountdown; |
124 | 199 | ||
125 | /* update console / topic window */ | 200 | /* update console / topic window */ |
126 | void consoleline (char *); | 201 | void consoleline(char *); |
127 | void topicline (char *); | 202 | void topicline(char *); |
128 | 203 | ||
129 | /* prompt for nick or password */ | 204 | /* prompt for nick or password */ |
130 | void nickprompt (void); | 205 | void nickprompt(void); |
131 | int passprompt (char *buf, int size, int rwflag, void *userdata); | 206 | int passprompt(char *buf, int size, int rwflag, void *userdata); |
132 | 207 | ||
133 | /* filter functions */ | 208 | /* filter functions */ |
134 | void refilterscrollback( void); | 209 | void refilterscrollback(void); |
135 | 210 | ||
136 | unsigned int addfilter ( char colour, char *regex ); | 211 | unsigned int addfilter(char colour, char *regex); |
137 | void removefilter ( char *line ); | 212 | void removefilter(char *line); |
138 | void listfilters ( void ); | 213 | void listfilters(void); |
139 | void clearfilters ( char colour ); | 214 | void clearfilters(char colour); |
140 | 215 | ||
141 | void handlequery ( char *line ); | 216 | void handlequery(char *line); |
142 | 217 | ||
143 | /* vchat-protocol.c */ | 218 | /* vchat-protocol.c */ |
144 | extern const char *vchat_io_version; | 219 | extern const char *vchat_io_version; |
145 | void protocol_parsemsg (char *message); | 220 | void protocol_parsemsg(char *message); |
146 | 221 | ||
147 | /* helpers for vchat-user.c */ | 222 | /* helpers for vchat-user.c */ |
148 | void ownjoin (int channel); | 223 | void ownjoin(int channel); |
149 | void ownleave (int channel); | 224 | void ownleave(int channel); |
150 | void ownnickchange (const char *newnick); | 225 | void ownnickchange(const char *newnick); |
151 | 226 | ||
152 | /* vchat-commands.c */ | 227 | /* vchat-commands.c */ |
153 | extern const char *vchat_cm_version; | 228 | extern const char *vchat_cm_version; |
154 | void command_version ( char *tail); | 229 | void command_version(char *tail); |
155 | 230 | ||
156 | /* user input */ | 231 | /* user input */ |
157 | void handleline (char *); | 232 | void handleline(char *); |
158 | 233 | ||
159 | /* struct for defining "/command" handlers */ | 234 | /* struct for defining "/command" handlers */ |
160 | typedef struct { | 235 | typedef struct { |
161 | int number; | 236 | int number; |
162 | char name[10]; | 237 | char name[10]; |
163 | int len; | 238 | int len; |
164 | void (*handler)(char *); | 239 | void (*handler)(char *); |
165 | char *short_help; | 240 | char *short_help; |
166 | char *help; | 241 | char *help; |
167 | } commandentry; | 242 | } commandentry; |
168 | 243 | ||
169 | /* vchat-tls.c */ | 244 | /* vchat-tls.c */ |