summaryrefslogtreecommitdiff
path: root/vchat.h
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2022-05-21 14:13:28 +0200
committerDirk Engling <erdgeist@erdgeist.org>2022-05-21 14:13:28 +0200
commit24effe857346411aa6b92c7d238441ce0e6cd861 (patch)
tree20abb0897453f67c53176398601a5434d6ad7efe /vchat.h
parentdc6e13b39ba2190d7f11378be48f8ccfe10d47f6 (diff)
Reformatted using clang-format -format llvm
Diffstat (limited to 'vchat.h')
-rwxr-xr-xvchat.h217
1 files changed, 146 insertions, 71 deletions
diff --git a/vchat.h b/vchat.h
index 54fd006..dbd5a9f 100755
--- 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,126 @@
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_CAFILE, 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_INVWINBAR, 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_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 */
40typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, 69typedef enum {
41FS_IDLE, FS_TIME, FS_CONSOLETIME, FS_TOPICW, FS_NOTOPICW, FS_CONSOLE, FS_CONNECTED, FS_CANTCONNECT, 70 FS_PLAIN,
42FS_TOPIC, FS_NOTOPIC, FS_CHGTOPIC, FS_USONLINE, FS_USMATCH, FS_SIGNON, FS_SIGNOFF, 71 FS_CHAN,
43FS_JOIN, FS_LEAVE, FS_NICKCHANGE, FS_UNKNOWNMSG, FS_BOGUSMSG, FS_RXPUBURL, 72 FS_PRIV,
44FS_MYPUBURL, FS_RXPUBMSG, FS_MYPUBMSG, FS_TXPUBMSG, FS_RXPRIVMSG, FS_TXPRIVMSG, 73 FS_SERV,
45FS_BGPRIVMSG, FS_PUBTHOUGHT, FS_TXPUBTHOUGHT, FS_TXPUBNTHOUGHT, FS_PUBACTION, 74 FS_GLOB,
46FS_TXPUBACTION, FS_BGTXPUBACTION, FS_COMMAND, FS_LOCALCOMMAND, FS_BOGUSCOMMAND, 75 FS_DBG,
47FS_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 */
50struct configoption 122struct 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
63typedef struct configoption configoption; 134typedef struct configoption configoption;
64 135
65/* format strings */ 136/* format strings */
66struct formatstring 137struct formatstring {
67{
68 formtstr id; 138 formtstr id;
69 char *idstring; 139 char *idstring;
70 char *formatstr; 140 char *formatstr;
71}; 141};
72typedef struct formatstring formatstring; 142typedef struct formatstring formatstring;
73 143
@@ -82,16 +152,16 @@ extern unsigned int want_tcp_keepalive;
82#define ERRSTRSIZE 1024 152#define ERRSTRSIZE 1024
83extern char errstr[]; 153extern char errstr[];
84extern const char *vchat_cl_version; 154extern const char *vchat_cl_version;
85void loadcfg (char *file,int complain,void (*lineparser) (char *)); 155void loadcfg(char *file, int complain, void (*lineparser)(char *));
86void loadformats (char *file); 156void loadformats(char *file);
87void cleanup(int signal); 157void cleanup(int signal);
88 158
89/* configuration helper functions from vchat-client.c */ 159/* configuration helper functions from vchat-client.c */
90char *getformatstr (formtstr id); 160char *getformatstr(formtstr id);
91char *getstroption (confopt option); 161char *getstroption(confopt option);
92void setstroption (confopt option, char *string); 162void setstroption(confopt option, char *string);
93int getintoption (confopt option); 163int getintoption(confopt option);
94void setintoption (confopt option, int value); 164void setintoption(confopt option, int value);
95 165
96/* vchat-ui.c */ 166/* vchat-ui.c */
97extern const char *vchat_ui_version; 167extern const char *vchat_ui_version;
@@ -104,66 +174,71 @@ extern char consolestr[];
104extern char *encoding; 174extern char *encoding;
105 175
106/* init / exit functions */ 176/* init / exit functions */
107void initui (void); 177void initui(void);
108void exitui (void); 178void exitui(void);
109 179
110/* called from eventloop in vchat-client.c */ 180/* called from eventloop in vchat-client.c */
111void userinput (void); 181void userinput(void);
112 182
113/* display various messages */ 183/* display various messages */
114int writechan (char *str); 184int writechan(char *str);
115int writepriv (char *str, int maybeep ); 185int writepriv(char *str, int maybeep);
116void writeout (const char *str); 186void writeout(const char *str);
117void showout (void); 187void showout(void);
118void flushout (void); 188void flushout(void);
119#define msgout(STR) {flushout();writeout(STR);showout();} 189#define msgout(STR) \
120void hideout (void); 190 { \
121int writecf (formtstr id, char *str); 191 flushout(); \
192 writeout(STR); \
193 showout(); \
194 }
195void hideout(void);
196int writecf(formtstr id, char *str);
122 197
123extern int outputcountdown; 198extern int outputcountdown;
124 199
125/* update console / topic window */ 200/* update console / topic window */
126void consoleline (char *); 201void consoleline(char *);
127void topicline (char *); 202void topicline(char *);
128 203
129/* prompt for nick or password */ 204/* prompt for nick or password */
130void nickprompt (void); 205void nickprompt(void);
131int passprompt (char *buf, int size, int rwflag, void *userdata); 206int passprompt(char *buf, int size, int rwflag, void *userdata);
132 207
133/* filter functions */ 208/* filter functions */
134void refilterscrollback( void); 209void refilterscrollback(void);
135 210
136unsigned int addfilter ( char colour, char *regex ); 211unsigned int addfilter(char colour, char *regex);
137void removefilter ( char *line ); 212void removefilter(char *line);
138void listfilters ( void ); 213void listfilters(void);
139void clearfilters ( char colour ); 214void clearfilters(char colour);
140 215
141void handlequery ( char *line ); 216void handlequery(char *line);
142 217
143/* vchat-protocol.c */ 218/* vchat-protocol.c */
144extern const char *vchat_io_version; 219extern const char *vchat_io_version;
145void protocol_parsemsg (char *message); 220void protocol_parsemsg(char *message);
146 221
147/* helpers for vchat-user.c */ 222/* helpers for vchat-user.c */
148void ownjoin (int channel); 223void ownjoin(int channel);
149void ownleave (int channel); 224void ownleave(int channel);
150void ownnickchange (const char *newnick); 225void ownnickchange(const char *newnick);
151 226
152/* vchat-commands.c */ 227/* vchat-commands.c */
153extern const char *vchat_cm_version; 228extern const char *vchat_cm_version;
154void command_version ( char *tail); 229void command_version(char *tail);
155 230
156/* user input */ 231/* user input */
157void handleline (char *); 232void handleline(char *);
158 233
159/* struct for defining "/command" handlers */ 234/* struct for defining "/command" handlers */
160typedef struct { 235typedef 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 */