diff options
author | erdgeist <> | 2003-02-12 17:48:37 +0000 |
---|---|---|
committer | erdgeist <> | 2003-02-12 17:48:37 +0000 |
commit | dea6bf757aa9a875eab35b2b650412e7605f1308 (patch) | |
tree | 14ed8374c3a3862529313088375693a7de70d3a7 /vchat.h |
CVS moved to erdgeist.org
Diffstat (limited to 'vchat.h')
-rwxr-xr-x | vchat.h | 210 |
1 files changed, 210 insertions, 0 deletions
@@ -0,0 +1,210 @@ | |||
1 | /* | ||
2 | * vchat-client - alpha version | ||
3 | * vchat.h - includefile with glue structures an functions | ||
4 | * | ||
5 | * Copyright (C) 2001 Andreas Kotes <count@flatline.de> | ||
6 | * | ||
7 | * This program is free software. It can be redistributed and/or modified, | ||
8 | * provided that this copyright notice is kept intact. This program is | ||
9 | * distributed in the hope that it will be useful, but without any warranty; | ||
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 | ||
12 | * any direct, indirect, incidental or special damages arising in any way out | ||
13 | * of the use of this software. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | /* user structure */ | ||
18 | struct user | ||
19 | { | ||
20 | unsigned char *nick; /* nick of user */ | ||
21 | int chan; /* channel user is on */ | ||
22 | int chan_valid; /* are we sure he is? */ | ||
23 | int client_pv; /* client protocol version */ | ||
24 | int messaged; /* did we message with this user? */ | ||
25 | struct user *next; /* next user in linked list */ | ||
26 | }; | ||
27 | typedef struct user user; | ||
28 | /* userlist from vchat-user.c */ | ||
29 | extern user *nicks; | ||
30 | |||
31 | /* servermessage types */ | ||
32 | typedef enum { SM_IGNORE, SM_INFO, SM_USERINFO, SM_CHANNEL, SM_ERROR } smtype; | ||
33 | |||
34 | /* servermessage structure */ | ||
35 | struct servermessage | ||
36 | { | ||
37 | unsigned char id[4]; /* three-character message id */ | ||
38 | smtype type; /* message type */ | ||
39 | void (*funct) (unsigned char *); /* function used by client */ | ||
40 | void (*hook) (unsigned char *); /* function hook for scripting */ | ||
41 | }; | ||
42 | typedef struct servermessage servermessage; | ||
43 | |||
44 | /* configuration types and variable numbers */ | ||
45 | typedef enum { CO_NIL, CO_STR, CO_INT } conftype; | ||
46 | typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, | ||
47 | CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, | ||
48 | CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME, | ||
49 | CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT } confopt; | ||
50 | /* format strings */ | ||
51 | typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, | ||
52 | FS_IDLE, FS_TIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, FS_TOPIC, | ||
53 | FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, FS_JOIN, | ||
54 | FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, FS_MYPUBURL, | ||
55 | FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG, | ||
56 | FS_BGPRIVMSG, FS_PUBACTION, FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND, | ||
57 | FS_LOCALCOMMAND, FS_BOGUSCOMMAND, FS_SBINF, FS_MISSTYPED, FS_UNKNCMD, FS_BADREGEX, | ||
58 | FS_ERR_STRING } formtstr; | ||
59 | |||
60 | /* configoption structure */ | ||
61 | struct configoption | ||
62 | { | ||
63 | confopt id; | ||
64 | conftype type; | ||
65 | unsigned char *varname; | ||
66 | unsigned char *defaultvalue; | ||
67 | unsigned char *value; | ||
68 | unsigned char **localvar; | ||
69 | }; | ||
70 | |||
71 | typedef struct configoption configoption; | ||
72 | |||
73 | /* format strings */ | ||
74 | struct formatstring | ||
75 | { | ||
76 | formtstr id; | ||
77 | unsigned char *idstring; | ||
78 | unsigned char *formatstr; | ||
79 | }; | ||
80 | typedef struct formatstring formatstring; | ||
81 | |||
82 | /* static tmpstr in all modules */ | ||
83 | #define TMPSTRSIZE 1024 | ||
84 | static unsigned char tmpstr[TMPSTRSIZE]; | ||
85 | |||
86 | extern unsigned char *nick; | ||
87 | extern int chan; | ||
88 | |||
89 | extern unsigned int loggedin; | ||
90 | |||
91 | /* vchat-client.c */ | ||
92 | #define ERRSTRSIZE 1024 | ||
93 | extern unsigned char errstr[]; | ||
94 | extern unsigned char *vchat_cl_version; | ||
95 | void cleanup(int signal); | ||
96 | |||
97 | /* configuration helper funktions from vchat-client.c */ | ||
98 | unsigned char *getformatstr (formtstr id); | ||
99 | unsigned char *getstroption (confopt option); | ||
100 | void setstroption (confopt option, unsigned char *string); | ||
101 | int getintoption (confopt option); | ||
102 | void setintoption (confopt option, int value); | ||
103 | |||
104 | /* vchat-user.c */ | ||
105 | extern unsigned char *vchat_us_version; | ||
106 | |||
107 | /* add / delete user */ | ||
108 | void ul_add (unsigned char *nick, int ignored); | ||
109 | void ul_del (unsigned char *nick, int ignored); | ||
110 | |||
111 | /* clear userlist */ | ||
112 | void ul_clear (); | ||
113 | |||
114 | /* channel join / leave */ | ||
115 | void ul_join (unsigned char *nick, int channel); | ||
116 | void ul_leave (unsigned char *nick, int channel); | ||
117 | |||
118 | /* nickchange */ | ||
119 | void ul_nickchange (unsigned char *oldnick, unsigned char *newnick); | ||
120 | |||
121 | /* place user in channel */ | ||
122 | void ul_moveuser (unsigned char *nick, int channel); | ||
123 | |||
124 | /* message nick completion */ | ||
125 | void ul_msgto (unsigned char *nick); | ||
126 | void ul_msgfrom (unsigned char *nick); | ||
127 | |||
128 | /* nick-completion for vchat-ui.c */ | ||
129 | unsigned char *ul_nickcomp (const unsigned char *text, int state); | ||
130 | unsigned char *ul_cnickcomp (const unsigned char *text, int state); | ||
131 | unsigned char *ul_mnickcomp (const unsigned char *text, int state); | ||
132 | |||
133 | /* try to find user by substring */ | ||
134 | unsigned char *ul_matchuser ( unsigned char *substr); | ||
135 | |||
136 | /* vchat-ui.c */ | ||
137 | extern unsigned char *vchat_ui_version; | ||
138 | |||
139 | /* topic and console strings */ | ||
140 | #define TOPICSTRSIZE 1024 | ||
141 | #define CONSOLESTRSIZE 1024 | ||
142 | extern unsigned char topicstr[]; | ||
143 | extern unsigned char consolestr[]; | ||
144 | |||
145 | /* init / exit functions */ | ||
146 | void initui (void); | ||
147 | void exitui (void); | ||
148 | |||
149 | /* called from eventloop in vchat-client.c */ | ||
150 | void userinput (void); | ||
151 | |||
152 | /* display various messages */ | ||
153 | int writechan (unsigned char *str); | ||
154 | int writepriv (unsigned char *str); | ||
155 | void writeout (unsigned char *str); | ||
156 | void showout (void); | ||
157 | void flushout (void); | ||
158 | void hideout (void); | ||
159 | int writecf (formtstr id, unsigned char *str); | ||
160 | |||
161 | extern int outputcountdown; | ||
162 | |||
163 | /* update console / topic window */ | ||
164 | void consoleline (unsigned char *); | ||
165 | void topicline (unsigned char *); | ||
166 | |||
167 | /* prompt for nick or password */ | ||
168 | void nickprompt (void); | ||
169 | int passprompt (char *buf, int size, int rwflag, void *userdata); | ||
170 | |||
171 | /* filter functions */ | ||
172 | void refilterscrollback( void); | ||
173 | |||
174 | unsigned int addfilter ( char colour, unsigned char *regex ); | ||
175 | void removefilter ( unsigned char *line ); | ||
176 | void listfilters ( void ); | ||
177 | void clearfilters ( char colour ); | ||
178 | |||
179 | /* vchat-protocol.c */ | ||
180 | extern unsigned char *vchat_io_version; | ||
181 | |||
182 | /* connect/disconnect */ | ||
183 | int vcconnect (unsigned char *server, unsigned int port); | ||
184 | void vcdisconnect (); | ||
185 | |||
186 | /* network I/O */ | ||
187 | void networkinput (void); | ||
188 | void networkoutput (unsigned char *); | ||
189 | |||
190 | /* helpers for vchat-user.c */ | ||
191 | void ownjoin (int channel); | ||
192 | void ownleave (int channel); | ||
193 | void ownnickchange (unsigned char *newnick); | ||
194 | |||
195 | /* vchat-commands.c */ | ||
196 | extern unsigned char *vchat_cm_version; | ||
197 | void command_version ( unsigned char *tail); | ||
198 | |||
199 | /* user input */ | ||
200 | void handleline (unsigned char *); | ||
201 | |||
202 | /* struct for defining "/command" handlers */ | ||
203 | typedef struct { | ||
204 | int number; | ||
205 | unsigned char name[8]; | ||
206 | int len; | ||
207 | void (*handler)(unsigned char *); | ||
208 | unsigned char *short_help; | ||
209 | unsigned char *help; | ||
210 | } commandentry; | ||