summaryrefslogtreecommitdiff
path: root/vchat-user.c
diff options
context:
space:
mode:
Diffstat (limited to 'vchat-user.c')
-rwxr-xr-xvchat-user.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/vchat-user.c b/vchat-user.c
index 1e14112..65b32b7 100755
--- a/vchat-user.c
+++ b/vchat-user.c
@@ -26,20 +26,20 @@
26 26
27struct user 27struct user
28{ 28{
29 unsigned char *nick; /* nick of user */ 29 char *nick; /* nick of user */
30 int chan; /* channel user is on */ 30 int chan; /* channel user is on */
31 int chan_valid; /* are we sure he is? */ 31 int chan_valid; /* are we sure he is? */
32 int client_pv; /* client protocol version */ 32 int client_pv; /* client protocol version */
33 int messaged; /* did we message with this user? */ 33 int messaged; /* did we message with this user? */
34 struct user *next; /* next user in linked list */ 34 struct user *next;/* next user in linked list */
35}; 35};
36 36
37/* version of this module */ 37/* version of this module */
38unsigned char *vchat_us_version = "$Id$"; 38char *vchat_us_version = "$Id$";
39 39
40/* externally used variables */ 40/* externally used variables */
41/* current nick */ 41/* current nick */
42unsigned char *nick = NULL; 42char *nick = NULL;
43/* current channel */ 43/* current channel */
44int chan = 0; 44int chan = 0;
45/* userlist */ 45/* userlist */
@@ -47,7 +47,7 @@ user *nicks = NULL;
47 47
48/* add user to userlist */ 48/* add user to userlist */
49void 49void
50ul_add (unsigned char *name, int ignored) 50ul_add (char *name, int ignored)
51{ 51{
52 user *tmp = NULL; 52 user *tmp = NULL;
53 53
@@ -100,7 +100,7 @@ ul_add (unsigned char *name, int ignored)
100 100
101/* delete user from userlist */ 101/* delete user from userlist */
102void 102void
103ul_del (unsigned char *name, int ignored) 103ul_del (char *name, int ignored)
104{ 104{
105 user *tmp = NULL, *ltmp = NULL; 105 user *tmp = NULL, *ltmp = NULL;
106 106
@@ -143,7 +143,7 @@ ul_del (unsigned char *name, int ignored)
143 143
144/* let user join a channel */ 144/* let user join a channel */
145void 145void
146ul_join (unsigned char *name, int channel) 146ul_join (char *name, int channel)
147{ 147{
148 /* is it this client? handle and return */ 148 /* is it this client? handle and return */
149 if (nick && !strcmp (nick, name)) 149 if (nick && !strcmp (nick, name))
@@ -157,7 +157,7 @@ ul_join (unsigned char *name, int channel)
157} 157}
158 158
159user * 159user *
160ul_finduser (unsigned char *name) { 160ul_finduser (char *name) {
161 user *tmp = nicks; 161 user *tmp = nicks;
162 snprintf( tmpstr, TMPSTRSIZE, "%s:", name); 162 snprintf( tmpstr, TMPSTRSIZE, "%s:", name);
163 163
@@ -175,11 +175,11 @@ ul_finduser (unsigned char *name) {
175 return NULL; 175 return NULL;
176} 176}
177 177
178unsigned char * 178char *
179ul_matchuser( unsigned char *regex) { 179ul_matchuser( char *regex) {
180 user *tmp = nicks; 180 user *tmp = nicks;
181 unsigned char *dest = tmpstr; 181 char *dest = tmpstr;
182 regex_t preg; 182 regex_t preg;
183 183
184 *dest = 0; 184 *dest = 0;
185 if( !regcomp( &preg, regex, REG_ICASE | REG_EXTENDED | REG_NEWLINE)) { 185 if( !regcomp( &preg, regex, REG_ICASE | REG_EXTENDED | REG_NEWLINE)) {
@@ -212,7 +212,7 @@ ul_usertofront( user *who ) {
212} 212}
213 213
214void 214void
215ul_msgto (unsigned char *name) { 215ul_msgto (char *name) {
216 user *tmp = ul_finduser(name); 216 user *tmp = ul_finduser(name);
217 217
218 if (tmp) { 218 if (tmp) {
@@ -222,7 +222,7 @@ ul_msgto (unsigned char *name) {
222} 222}
223 223
224void 224void
225ul_msgfrom (unsigned char *name) { 225ul_msgfrom (char *name) {
226 user *tmp = ul_finduser(name); 226 user *tmp = ul_finduser(name);
227 227
228 if (tmp) { 228 if (tmp) {
@@ -233,7 +233,7 @@ ul_msgfrom (unsigned char *name) {
233 233
234/* set channel of user */ 234/* set channel of user */
235void 235void
236ul_moveuser (unsigned char *name, int channel) { 236ul_moveuser (char *name, int channel) {
237 user *tmp = ul_finduser(name); 237 user *tmp = ul_finduser(name);
238 238
239 if (tmp) { 239 if (tmp) {
@@ -248,7 +248,7 @@ ul_moveuser (unsigned char *name, int channel) {
248 248
249/* let user leave a channel */ 249/* let user leave a channel */
250void 250void
251ul_leave (unsigned char *name, int channel) 251ul_leave (char *name, int channel)
252{ 252{
253 user *tmp = ul_finduser(name); 253 user *tmp = ul_finduser(name);
254 /* is it this client? handle and return */ 254 /* is it this client? handle and return */
@@ -271,7 +271,7 @@ ul_leave (unsigned char *name, int channel)
271 271
272/* let user change nick */ 272/* let user change nick */
273void 273void
274ul_nickchange (unsigned char *oldnick, unsigned char *newnick) 274ul_nickchange (char *oldnick, char *newnick)
275{ 275{
276 user *tmp = ul_finduser(oldnick); 276 user *tmp = ul_finduser(oldnick);
277 /* is it this client? handle and return */ 277 /* is it this client? handle and return */
@@ -314,19 +314,19 @@ ul_clear (void)
314#endif 314#endif
315} 315}
316 316
317int ulnc_casenick(user *tmp, const unsigned char *text, int len, int value) { 317int ulnc_casenick(user *tmp, const char *text, int len, int value) {
318 return (!strncmp(tmp->nick, text, len)); 318 return (!strncmp(tmp->nick, text, len));
319} 319}
320 320
321int ulnc_ncasenick(user *tmp, const unsigned char *text, int len, int value) { 321int ulnc_ncasenick(user *tmp, const char *text, int len, int value) {
322 return (!strncasecmp(tmp->nick, text, len)); 322 return (!strncasecmp(tmp->nick, text, len));
323} 323}
324 324
325unsigned char * 325char *
326ulnc_complete (const unsigned char *text, int state, int value, int (*checkfn)(user *,const unsigned char *,int,int)) { 326ulnc_complete (const char *text, int state, int value, int (*checkfn)(user *,const char *,int,int)) {
327 static int len; 327 static int len;
328 static user *tmp; 328 static user *tmp;
329 unsigned char *name; 329 char *name;
330 330
331 /* first round? reset pointers! */ 331 /* first round? reset pointers! */
332 if (!state) 332 if (!state)
@@ -355,11 +355,11 @@ ulnc_complete (const unsigned char *text, int state, int value, int (*checkfn)(u
355} 355}
356 356
357/* nick completion functions for readline in vchat-ui.c */ 357/* nick completion functions for readline in vchat-ui.c */
358unsigned char * 358char *
359ul_nickcomp (const unsigned char *text, int state) 359ul_nickcomp (const char *text, int state)
360{ 360{
361 int ncasemode = 1; 361 int ncasemode = 1;
362 unsigned char *name = NULL; 362 char *name = NULL;
363 if (!state) ncasemode = 0; 363 if (!state) ncasemode = 0;
364 if (!ncasemode) { 364 if (!ncasemode) {
365 name = ulnc_complete(text,state,0,ulnc_casenick); 365 name = ulnc_complete(text,state,0,ulnc_casenick);
@@ -373,20 +373,20 @@ ul_nickcomp (const unsigned char *text, int state)
373 return NULL; 373 return NULL;
374} 374}
375 375
376int ulnc_casenickc(user *tmp, const unsigned char *text, int len, int value) { 376int ulnc_casenickc(user *tmp, const char *text, int len, int value) {
377 return (!strncmp(tmp->nick, text, len) && (tmp->chan_valid) && (tmp->chan == value)); 377 return (!strncmp(tmp->nick, text, len) && (tmp->chan_valid) && (tmp->chan == value));
378} 378}
379 379
380int ulnc_ncasenickc(user *tmp, const unsigned char *text, int len, int value) { 380int ulnc_ncasenickc(user *tmp, const char *text, int len, int value) {
381 return (!strncasecmp(tmp->nick, text, len) && (tmp->chan_valid) && (tmp->chan == value)); 381 return (!strncasecmp(tmp->nick, text, len) && (tmp->chan_valid) && (tmp->chan == value));
382} 382}
383 383
384/* nick completion for channel, used by vchat-ui.c */ 384/* nick completion for channel, used by vchat-ui.c */
385unsigned char * 385char *
386ul_cnickcomp (const unsigned char *text, int state) 386ul_cnickcomp (const char *text, int state)
387{ 387{
388 int ncasemode = 1; 388 int ncasemode = 1;
389 static unsigned char *name = NULL; 389 static char *name = NULL;
390 390
391 if (!state) ncasemode = 0; 391 if (!state) ncasemode = 0;
392 if (!ncasemode) { 392 if (!ncasemode) {
@@ -402,20 +402,20 @@ ul_cnickcomp (const unsigned char *text, int state)
402 return NULL; 402 return NULL;
403} 403}
404 404
405int ulnc_casenickm(user *tmp, const unsigned char *text, int len, int value) { 405int ulnc_casenickm(user *tmp, const char *text, int len, int value) {
406 return (!strncmp(tmp->nick, text, len) && (tmp->messaged)); 406 return (!strncmp(tmp->nick, text, len) && (tmp->messaged));
407} 407}
408 408
409int ulnc_ncasenickm(user *tmp, const unsigned char *text, int len, int value) { 409int ulnc_ncasenickm(user *tmp, const char *text, int len, int value) {
410 return (!strncasecmp(tmp->nick, text, len) && (tmp->messaged)); 410 return (!strncasecmp(tmp->nick, text, len) && (tmp->messaged));
411} 411}
412 412
413/* nick completion for channel, used by vchat-ui.c */ 413/* nick completion for channel, used by vchat-ui.c */
414unsigned char * 414char *
415ul_mnickcomp (const unsigned char *text, int state) 415ul_mnickcomp (const char *text, int state)
416{ 416{
417 int ncasemode = 1; 417 int ncasemode = 1;
418 static unsigned char *name = NULL; 418 static char *name = NULL;
419 419
420 if (!state) ncasemode = 0; 420 if (!state) ncasemode = 0;
421 if (!ncasemode) { 421 if (!ncasemode) {