diff options
Diffstat (limited to 'vchat.h')
-rw-r--r--[-rwxr-xr-x] | vchat.h | 236 |
1 files changed, 153 insertions, 83 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,127 @@ | |||
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_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_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_TLSLIB, | ||
48 | CF_IGNSSL, | ||
49 | CF_VERIFYSSL, | ||
50 | CF_USECERT, | ||
51 | CF_PRIVHEIGHT, | ||
52 | CF_PRIVCOLLAPS, | ||
53 | CF_INVWINBAR, | ||
54 | CF_HSCROLL, | ||
55 | CF_CHANNEL, | ||
56 | CF_USETIME, | ||
57 | CF_USETOPIC, | ||
58 | CF_SCROLLBPRIV, | ||
59 | CF_SCROLLBACK, | ||
60 | CF_SCROLLBPRIVT, | ||
61 | CF_SCROLLBACKT, | ||
62 | CF_ENCODING, | ||
63 | CF_BELLPRIV, | ||
64 | CF_CASEFIRST, | ||
65 | CF_AUTORECONN, | ||
66 | CF_KEEPALIVE | ||
67 | } confopt; | ||
38 | 68 | ||
39 | /* format strings */ | 69 | /* format strings */ |
40 | typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, | 70 | typedef enum { |
41 | FS_IDLE, FS_TIME, FS_CONSOLETIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, FS_CANTCONNECT, | 71 | FS_PLAIN, |
42 | FS_TOPIC, FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, | 72 | FS_CHAN, |
43 | FS_JOIN, FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, | 73 | FS_PRIV, |
44 | FS_MYPUBURL, FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG, | 74 | FS_SERV, |
45 | FS_BGPRIVMSG, FS_PUBTHOUGHT, FS_TXPUBTHOUGHT, FS_TXPUBNTHOUGHT, FS_PUBACTION, | 75 | FS_GLOB, |
46 | FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND, FS_LOCALCOMMAND, FS_BOGUSCOMMAND, | 76 | FS_DBG, |
47 | FS_SBINF, FS_MISSTYPED, FS_UNKNCMD, FS_BADREGEX, FS_ERR_STRING } formtstr; | 77 | FS_ERR, |
78 | FS_IDLE, | ||
79 | FS_TIME, | ||
80 | FS_CONSOLETIME, | ||
81 | FS_TOPICW, | ||
82 | FS_NOTOPICW, | ||
83 | FS_CONSOLE, | ||
84 | FS_CONNECTED, | ||
85 | FS_CANTCONNECT, | ||
86 | FS_TOPIC, | ||
87 | FS_NOTOPIC, | ||
88 | FS_CHGTOPIC, | ||
89 | FS_USONLINE, | ||
90 | FS_USMATCH, | ||
91 | FS_SIGNON, | ||
92 | FS_SIGNOFF, | ||
93 | FS_JOIN, | ||
94 | FS_LEAVE, | ||
95 | FS_NICKCHANGE, | ||
96 | FS_UNKNOWNMSG, | ||
97 | FS_BOGUSMSG, | ||
98 | FS_RXPUBURL, | ||
99 | FS_MYPUBURL, | ||
100 | FS_RXPUBMSG, | ||
101 | FS_MYPUBMSG, | ||
102 | FS_TXPUBMSG, | ||
103 | FS_RXPRIVMSG, | ||
104 | FS_TXPRIVMSG, | ||
105 | FS_BGPRIVMSG, | ||
106 | FS_PUBTHOUGHT, | ||
107 | FS_TXPUBTHOUGHT, | ||
108 | FS_TXPUBNTHOUGHT, | ||
109 | FS_PUBACTION, | ||
110 | FS_TXPUBACTION, | ||
111 | FS_BGTXPUBACTION, | ||
112 | FS_COMMAND, | ||
113 | FS_LOCALCOMMAND, | ||
114 | FS_BOGUSCOMMAND, | ||
115 | FS_SBINF, | ||
116 | FS_MISSTYPED, | ||
117 | FS_UNKNCMD, | ||
118 | FS_BADREGEX, | ||
119 | FS_ERR_STRING | ||
120 | } formtstr; | ||
48 | 121 | ||
49 | /* configoption structure */ | 122 | /* configoption structure */ |
50 | struct configoption | 123 | struct configoption { |
51 | { | 124 | confopt id; |
52 | confopt id; | ||
53 | conftype type; | 125 | conftype type; |
54 | char *varname; | 126 | char *varname; |
55 | char *defaultvalue; | 127 | char *defaultvalue; |
56 | char *value; | 128 | char *value; |
57 | union { | 129 | union { |
58 | char **pstr; | 130 | char **pstr; |
59 | unsigned int *pint; | 131 | unsigned int *pint; |
60 | } localvar; | 132 | } localvar; |
61 | }; | 133 | }; |
62 | 134 | ||
63 | typedef struct configoption configoption; | 135 | typedef struct configoption configoption; |
64 | 136 | ||
65 | /* format strings */ | 137 | /* format strings */ |
66 | struct formatstring | 138 | struct formatstring { |
67 | { | ||
68 | formtstr id; | 139 | formtstr id; |
69 | char *idstring; | 140 | char *idstring; |
70 | char *formatstr; | 141 | char *formatstr; |
71 | }; | 142 | }; |
72 | typedef struct formatstring formatstring; | 143 | typedef struct formatstring formatstring; |
73 | 144 | ||
@@ -82,16 +153,16 @@ extern unsigned int want_tcp_keepalive; | |||
82 | #define ERRSTRSIZE 1024 | 153 | #define ERRSTRSIZE 1024 |
83 | extern char errstr[]; | 154 | extern char errstr[]; |
84 | extern const char *vchat_cl_version; | 155 | extern const char *vchat_cl_version; |
85 | void loadcfg (char *file,int complain,void (*lineparser) (char *)); | 156 | void loadcfg(char *file, int complain, void (*lineparser)(char *)); |
86 | void loadformats (char *file); | 157 | void loadformats(char *file); |
87 | void cleanup(int signal); | 158 | void cleanup(int signal); |
88 | 159 | ||
89 | /* configuration helper funktions from vchat-client.c */ | 160 | /* configuration helper functions from vchat-client.c */ |
90 | char *getformatstr (formtstr id); | 161 | char *getformatstr(formtstr id); |
91 | char *getstroption (confopt option); | 162 | char *getstroption(confopt option); |
92 | void setstroption (confopt option, char *string); | 163 | void setstroption(confopt option, char *string); |
93 | int getintoption (confopt option); | 164 | int getintoption(confopt option); |
94 | void setintoption (confopt option, int value); | 165 | void setintoption(confopt option, int value); |
95 | 166 | ||
96 | /* vchat-ui.c */ | 167 | /* vchat-ui.c */ |
97 | extern const char *vchat_ui_version; | 168 | extern const char *vchat_ui_version; |
@@ -104,76 +175,75 @@ extern char consolestr[]; | |||
104 | extern char *encoding; | 175 | extern char *encoding; |
105 | 176 | ||
106 | /* init / exit functions */ | 177 | /* init / exit functions */ |
107 | void initui (void); | 178 | void initui(void); |
108 | void exitui (void); | 179 | void exitui(void); |
109 | 180 | ||
110 | /* called from eventloop in vchat-client.c */ | 181 | /* called from eventloop in vchat-client.c */ |
111 | void userinput (void); | 182 | void userinput(void); |
112 | 183 | ||
113 | /* display various messages */ | 184 | /* display various messages */ |
114 | int writechan (char *str); | 185 | int writechan(char *str); |
115 | int writepriv (char *str, int maybeep ); | 186 | int writepriv(char *str, int maybeep); |
116 | void writeout (const char *str); | 187 | void writeout(const char *str); |
117 | void showout (void); | 188 | void showout(void); |
118 | void flushout (void); | 189 | void flushout(void); |
119 | #define msgout(STR) {flushout();writeout(STR);showout();} | 190 | #define msgout(STR) \ |
120 | void hideout (void); | 191 | { \ |
121 | int writecf (formtstr id, char *str); | 192 | flushout(); \ |
193 | writeout(STR); \ | ||
194 | showout(); \ | ||
195 | } | ||
196 | void hideout(void); | ||
197 | int writecf(formtstr id, char *str); | ||
198 | /* dumps aggregated connect output in case of a connection error */ | ||
199 | void dumpconnect(); | ||
200 | void flushconnect(); | ||
122 | 201 | ||
123 | extern int outputcountdown; | 202 | extern int outputcountdown; |
124 | 203 | ||
125 | /* update console / topic window */ | 204 | /* update console / topic window */ |
126 | void consoleline (char *); | 205 | void consoleline(char *); |
127 | void topicline (char *); | 206 | void topicline(char *); |
128 | 207 | ||
129 | /* prompt for nick or password */ | 208 | /* prompt for nick or password */ |
130 | void nickprompt (void); | 209 | void nickprompt(void); |
131 | int passprompt (char *buf, int size, int rwflag, void *userdata); | 210 | int passprompt(char *buf, int size, int rwflag, void *userdata); |
132 | 211 | ||
133 | /* filter functions */ | 212 | /* filter functions */ |
134 | void refilterscrollback( void); | 213 | void refilterscrollback(void); |
135 | 214 | ||
136 | unsigned int addfilter ( char colour, char *regex ); | 215 | unsigned int addfilter(char colour, char *regex); |
137 | void removefilter ( char *line ); | 216 | void removefilter(char *line); |
138 | void listfilters ( void ); | 217 | void listfilters(void); |
139 | void clearfilters ( char colour ); | 218 | void clearfilters(char colour); |
140 | 219 | ||
141 | void handlequery ( char *line ); | 220 | void handlequery(char *line); |
142 | 221 | ||
143 | /* vchat-protocol.c */ | 222 | /* vchat-protocol.c */ |
144 | extern const char *vchat_io_version; | 223 | extern const char *vchat_io_version; |
145 | 224 | void protocol_parsemsg(char *message); | |
146 | /* connect/disconnect */ | ||
147 | int vcconnect (char *server, char *port); | ||
148 | void vcdisconnect (); | ||
149 | |||
150 | /* network I/O */ | ||
151 | void networkinput (void); | ||
152 | void networkoutput (char *); | ||
153 | 225 | ||
154 | /* helpers for vchat-user.c */ | 226 | /* helpers for vchat-user.c */ |
155 | void ownjoin (int channel); | 227 | void ownjoin(int channel); |
156 | void ownleave (int channel); | 228 | void ownleave(int channel); |
157 | void ownnickchange (char *newnick); | 229 | void ownnickchange(const char *newnick); |
158 | 230 | ||
159 | /* vchat-commands.c */ | 231 | /* vchat-commands.c */ |
160 | extern const char *vchat_cm_version; | 232 | extern const char *vchat_cm_version; |
161 | void command_version ( char *tail); | 233 | void command_version(char *tail); |
162 | 234 | ||
163 | /* user input */ | 235 | /* user input */ |
164 | void handleline (char *); | 236 | void handleline(char *); |
165 | 237 | ||
166 | /* struct for defining "/command" handlers */ | 238 | /* struct for defining "/command" handlers */ |
167 | typedef struct { | 239 | typedef struct { |
168 | int number; | 240 | int number; |
169 | char name[10]; | 241 | char name[10]; |
170 | int len; | 242 | int len; |
171 | void (*handler)(char *); | 243 | void (*handler)(char *); |
172 | char *short_help; | 244 | char *short_help; |
173 | char *help; | 245 | char *help; |
174 | } commandentry; | 246 | } commandentry; |
175 | 247 | ||
176 | /* vchat-ssl.c */ | 248 | /* vchat-tls.c */ |
177 | extern const char *vchat_ssl_version; | 249 | extern const char *vchat_tls_version; |
178 | extern const char *vchat_ssl_version_external; | ||
179 | void vchat_ssl_get_version_external(); | ||