summaryrefslogtreecommitdiff
path: root/vchat.h
diff options
context:
space:
mode:
Diffstat (limited to 'vchat.h')
-rwxr-xr-xvchat.h210
1 files changed, 210 insertions, 0 deletions
diff --git a/vchat.h b/vchat.h
new file mode 100755
index 0000000..5cfc33f
--- /dev/null
+++ b/vchat.h
@@ -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 */
18struct 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};
27typedef struct user user;
28/* userlist from vchat-user.c */
29extern user *nicks;
30
31/* servermessage types */
32typedef enum { SM_IGNORE, SM_INFO, SM_USERINFO, SM_CHANNEL, SM_ERROR } smtype;
33
34/* servermessage structure */
35struct 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};
42typedef struct servermessage servermessage;
43
44/* configuration types and variable numbers */
45typedef enum { CO_NIL, CO_STR, CO_INT } conftype;
46typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT,
47CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE,
48CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME,
49CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT } confopt;
50/* format strings */
51typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR,
52FS_IDLE, FS_TIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, FS_TOPIC,
53FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, FS_JOIN,
54FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, FS_MYPUBURL,
55FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG,
56FS_BGPRIVMSG, FS_PUBACTION, FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND,
57FS_LOCALCOMMAND, FS_BOGUSCOMMAND, FS_SBINF, FS_MISSTYPED, FS_UNKNCMD, FS_BADREGEX,
58FS_ERR_STRING } formtstr;
59
60/* configoption structure */
61struct 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
71typedef struct configoption configoption;
72
73/* format strings */
74struct formatstring
75{
76 formtstr id;
77 unsigned char *idstring;
78 unsigned char *formatstr;
79};
80typedef struct formatstring formatstring;
81
82/* static tmpstr in all modules */
83#define TMPSTRSIZE 1024
84static unsigned char tmpstr[TMPSTRSIZE];
85
86extern unsigned char *nick;
87extern int chan;
88
89extern unsigned int loggedin;
90
91/* vchat-client.c */
92#define ERRSTRSIZE 1024
93extern unsigned char errstr[];
94extern unsigned char *vchat_cl_version;
95void cleanup(int signal);
96
97/* configuration helper funktions from vchat-client.c */
98unsigned char *getformatstr (formtstr id);
99unsigned char *getstroption (confopt option);
100void setstroption (confopt option, unsigned char *string);
101int getintoption (confopt option);
102void setintoption (confopt option, int value);
103
104/* vchat-user.c */
105extern unsigned char *vchat_us_version;
106
107/* add / delete user */
108void ul_add (unsigned char *nick, int ignored);
109void ul_del (unsigned char *nick, int ignored);
110
111/* clear userlist */
112void ul_clear ();
113
114/* channel join / leave */
115void ul_join (unsigned char *nick, int channel);
116void ul_leave (unsigned char *nick, int channel);
117
118/* nickchange */
119void ul_nickchange (unsigned char *oldnick, unsigned char *newnick);
120
121/* place user in channel */
122void ul_moveuser (unsigned char *nick, int channel);
123
124/* message nick completion */
125void ul_msgto (unsigned char *nick);
126void ul_msgfrom (unsigned char *nick);
127
128/* nick-completion for vchat-ui.c */
129unsigned char *ul_nickcomp (const unsigned char *text, int state);
130unsigned char *ul_cnickcomp (const unsigned char *text, int state);
131unsigned char *ul_mnickcomp (const unsigned char *text, int state);
132
133/* try to find user by substring */
134unsigned char *ul_matchuser ( unsigned char *substr);
135
136/* vchat-ui.c */
137extern unsigned char *vchat_ui_version;
138
139/* topic and console strings */
140#define TOPICSTRSIZE 1024
141#define CONSOLESTRSIZE 1024
142extern unsigned char topicstr[];
143extern unsigned char consolestr[];
144
145/* init / exit functions */
146void initui (void);
147void exitui (void);
148
149/* called from eventloop in vchat-client.c */
150void userinput (void);
151
152/* display various messages */
153int writechan (unsigned char *str);
154int writepriv (unsigned char *str);
155void writeout (unsigned char *str);
156void showout (void);
157void flushout (void);
158void hideout (void);
159int writecf (formtstr id, unsigned char *str);
160
161extern int outputcountdown;
162
163/* update console / topic window */
164void consoleline (unsigned char *);
165void topicline (unsigned char *);
166
167/* prompt for nick or password */
168void nickprompt (void);
169int passprompt (char *buf, int size, int rwflag, void *userdata);
170
171/* filter functions */
172void refilterscrollback( void);
173
174unsigned int addfilter ( char colour, unsigned char *regex );
175void removefilter ( unsigned char *line );
176void listfilters ( void );
177void clearfilters ( char colour );
178
179/* vchat-protocol.c */
180extern unsigned char *vchat_io_version;
181
182/* connect/disconnect */
183int vcconnect (unsigned char *server, unsigned int port);
184void vcdisconnect ();
185
186/* network I/O */
187void networkinput (void);
188void networkoutput (unsigned char *);
189
190/* helpers for vchat-user.c */
191void ownjoin (int channel);
192void ownleave (int channel);
193void ownnickchange (unsigned char *newnick);
194
195/* vchat-commands.c */
196extern unsigned char *vchat_cm_version;
197void command_version ( unsigned char *tail);
198
199/* user input */
200void handleline (unsigned char *);
201
202/* struct for defining "/command" handlers */
203typedef 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;