summaryrefslogtreecommitdiff
path: root/vchat.h
diff options
context:
space:
mode:
Diffstat (limited to 'vchat.h')
-rw-r--r--[-rwxr-xr-x]vchat.h236
1 files changed, 153 insertions, 83 deletions
diff --git a/vchat.h b/vchat.h
index 4e33190..3fdbb37 100755..100644
--- a/vchat.h
+++ b/vchat.h
@@ -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 @@
18typedef enum { SM_IGNORE, SM_INFO, SM_USERINFO, SM_CHANNEL, SM_ERROR } smtype; 18typedef enum { SM_IGNORE, SM_INFO, SM_USERINFO, SM_CHANNEL, SM_ERROR } smtype;
19 19
20/* servermessage structure */ 20/* servermessage structure */
21struct servermessage 21struct 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};
28typedef struct servermessage servermessage; 27typedef struct servermessage servermessage;
29 28
30/* configuration types and variable numbers */ 29/* configuration types and variable numbers */
31typedef enum { CO_NIL, CO_STR, CO_INT } conftype; 30typedef enum { CO_NIL, CO_STR, CO_INT } conftype;
32typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, 31typedef enum {
33CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, 32 CF_NIL,
34CF_LOGINSCRIPT, CF_FINGERPRINT, CF_PINFINGER, CF_USESSL, CF_IGNSSL, CF_VERIFYSSL, CF_USECERT, 33 CF_NICK,
35CF_PRIVHEIGHT, CF_PRIVCOLLAPS, CF_HSCROLL, CF_CHANNEL, CF_USETIME, CF_USETOPIC, 34 CF_FROM,
36CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, CF_ENCODING, 35 CF_SERVERHOST,
37CF_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 */
40typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, 70typedef enum {
41FS_IDLE, FS_TIME, FS_CONSOLETIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, FS_CANTCONNECT, 71 FS_PLAIN,
42FS_TOPIC, FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, 72 FS_CHAN,
43FS_JOIN, FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, 73 FS_PRIV,
44FS_MYPUBURL, FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG, 74 FS_SERV,
45FS_BGPRIVMSG, FS_PUBTHOUGHT, FS_TXPUBTHOUGHT, FS_TXPUBNTHOUGHT, FS_PUBACTION, 75 FS_GLOB,
46FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND, FS_LOCALCOMMAND, FS_BOGUSCOMMAND, 76 FS_DBG,
47FS_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 */
50struct configoption 123struct 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
63typedef struct configoption configoption; 135typedef struct configoption configoption;
64 136
65/* format strings */ 137/* format strings */
66struct formatstring 138struct formatstring {
67{
68 formtstr id; 139 formtstr id;
69 char *idstring; 140 char *idstring;
70 char *formatstr; 141 char *formatstr;
71}; 142};
72typedef struct formatstring formatstring; 143typedef struct formatstring formatstring;
73 144
@@ -82,16 +153,16 @@ extern unsigned int want_tcp_keepalive;
82#define ERRSTRSIZE 1024 153#define ERRSTRSIZE 1024
83extern char errstr[]; 154extern char errstr[];
84extern const char *vchat_cl_version; 155extern const char *vchat_cl_version;
85void loadcfg (char *file,int complain,void (*lineparser) (char *)); 156void loadcfg(char *file, int complain, void (*lineparser)(char *));
86void loadformats (char *file); 157void loadformats(char *file);
87void cleanup(int signal); 158void cleanup(int signal);
88 159
89/* configuration helper funktions from vchat-client.c */ 160/* configuration helper functions from vchat-client.c */
90char *getformatstr (formtstr id); 161char *getformatstr(formtstr id);
91char *getstroption (confopt option); 162char *getstroption(confopt option);
92void setstroption (confopt option, char *string); 163void setstroption(confopt option, char *string);
93int getintoption (confopt option); 164int getintoption(confopt option);
94void setintoption (confopt option, int value); 165void setintoption(confopt option, int value);
95 166
96/* vchat-ui.c */ 167/* vchat-ui.c */
97extern const char *vchat_ui_version; 168extern const char *vchat_ui_version;
@@ -104,76 +175,75 @@ extern char consolestr[];
104extern char *encoding; 175extern char *encoding;
105 176
106/* init / exit functions */ 177/* init / exit functions */
107void initui (void); 178void initui(void);
108void exitui (void); 179void exitui(void);
109 180
110/* called from eventloop in vchat-client.c */ 181/* called from eventloop in vchat-client.c */
111void userinput (void); 182void userinput(void);
112 183
113/* display various messages */ 184/* display various messages */
114int writechan (char *str); 185int writechan(char *str);
115int writepriv (char *str, int maybeep ); 186int writepriv(char *str, int maybeep);
116void writeout (const char *str); 187void writeout(const char *str);
117void showout (void); 188void showout(void);
118void flushout (void); 189void flushout(void);
119#define msgout(STR) {flushout();writeout(STR);showout();} 190#define msgout(STR) \
120void hideout (void); 191 { \
121int writecf (formtstr id, char *str); 192 flushout(); \
193 writeout(STR); \
194 showout(); \
195 }
196void hideout(void);
197int writecf(formtstr id, char *str);
198/* dumps aggregated connect output in case of a connection error */
199void dumpconnect();
200void flushconnect();
122 201
123extern int outputcountdown; 202extern int outputcountdown;
124 203
125/* update console / topic window */ 204/* update console / topic window */
126void consoleline (char *); 205void consoleline(char *);
127void topicline (char *); 206void topicline(char *);
128 207
129/* prompt for nick or password */ 208/* prompt for nick or password */
130void nickprompt (void); 209void nickprompt(void);
131int passprompt (char *buf, int size, int rwflag, void *userdata); 210int passprompt(char *buf, int size, int rwflag, void *userdata);
132 211
133/* filter functions */ 212/* filter functions */
134void refilterscrollback( void); 213void refilterscrollback(void);
135 214
136unsigned int addfilter ( char colour, char *regex ); 215unsigned int addfilter(char colour, char *regex);
137void removefilter ( char *line ); 216void removefilter(char *line);
138void listfilters ( void ); 217void listfilters(void);
139void clearfilters ( char colour ); 218void clearfilters(char colour);
140 219
141void handlequery ( char *line ); 220void handlequery(char *line);
142 221
143/* vchat-protocol.c */ 222/* vchat-protocol.c */
144extern const char *vchat_io_version; 223extern const char *vchat_io_version;
145 224void protocol_parsemsg(char *message);
146/* connect/disconnect */
147int vcconnect (char *server, char *port);
148void vcdisconnect ();
149
150/* network I/O */
151void networkinput (void);
152void networkoutput (char *);
153 225
154/* helpers for vchat-user.c */ 226/* helpers for vchat-user.c */
155void ownjoin (int channel); 227void ownjoin(int channel);
156void ownleave (int channel); 228void ownleave(int channel);
157void ownnickchange (char *newnick); 229void ownnickchange(const char *newnick);
158 230
159/* vchat-commands.c */ 231/* vchat-commands.c */
160extern const char *vchat_cm_version; 232extern const char *vchat_cm_version;
161void command_version ( char *tail); 233void command_version(char *tail);
162 234
163/* user input */ 235/* user input */
164void handleline (char *); 236void handleline(char *);
165 237
166/* struct for defining "/command" handlers */ 238/* struct for defining "/command" handlers */
167typedef struct { 239typedef 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 */
177extern const char *vchat_ssl_version; 249extern const char *vchat_tls_version;
178extern const char *vchat_ssl_version_external;
179void vchat_ssl_get_version_external();