/[cvs]/eggdrop1.9/src/dccutil.c
ViewVC logotype

Annotation of /eggdrop1.9/src/dccutil.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.58 - (hide annotations) (download) (as text)
Sat Jan 18 22:36:52 2003 UTC (16 years, 9 months ago) by wcc
Branch: MAIN
Changes since 1.57: +10 -1 lines
File MIME type: text/x-chdr
* Synch 1.6: nickbind, unixtime_incr, transfer-close, logblocking.

1 guppy 1.31 /*
2 tothwolf 1.51 * dccutil.c --
3 guppy 1.31 *
4 tothwolf 1.51 * lots of little functions to send formatted text to
5     * varying types of connections
6     * '.who', '.whom', and '.dccstat' code
7     * memory management for dcc structures
8     * timeout checking for dcc connections
9 segfault 1.1 */
10 guppy 1.31 /*
11     * Copyright (C) 1997 Robey Pointer
12 wcc 1.57 * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
13 guppy 1.31 *
14 fabian 1.10 * This program is free software; you can redistribute it and/or
15     * modify it under the terms of the GNU General Public License
16     * as published by the Free Software Foundation; either version 2
17     * of the License, or (at your option) any later version.
18 guppy 1.31 *
19 fabian 1.10 * This program is distributed in the hope that it will be useful,
20     * but WITHOUT ANY WARRANTY; without even the implied warranty of
21     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22     * GNU General Public License for more details.
23 guppy 1.31 *
24 fabian 1.10 * You should have received a copy of the GNU General Public License
25     * along with this program; if not, write to the Free Software
26     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 segfault 1.1 */
28 tothwolf 1.51
29     #ifndef lint
30 wcc 1.58 static const char rcsid[] = "$Id: dccutil.c,v 1.57 2003/01/02 21:33:16 wcc Exp $";
31 tothwolf 1.51 #endif
32 segfault 1.1
33 fabian 1.17 #include <sys/stat.h>
34 segfault 1.1 #include "main.h"
35     #include <errno.h>
36     #include "chan.h"
37     #include "modules.h"
38 ite 1.43 #include "logfile.h"
39     #include "misc.h"
40 wingman 1.50 #include "cmdt.h" /* cmd_t */
41     #include "net.h" /* tputs, killsock */
42     #include "dccutil.h" /* prototypes */
43 stdarg 1.55 #include "users.h" /* get_user_by_handle */
44 segfault 1.1
45 fabian 1.17 extern struct dcc_t *dcc;
46 stdarg 1.55 extern struct userrec *userlist;
47 fabian 1.17 extern int dcc_total, max_dcc, dcc_flood_thr, backgrd, MAXSOCKS;
48 stdarg 1.55 extern char spaces[], version[];
49 fabian 1.17 extern time_t now;
50     extern sock_list *socklist;
51 wingman 1.50
52     #ifndef MAKING_MODS
53     extern struct dcc_table DCC_CHAT, DCC_LOST;
54     #endif /* MAKING_MODS */
55 fabian 1.17
56 stdarg 1.55 char botnetnick[HANDLEN + 1] = "";
57 fabian 1.17 char motdfile[121] = "text/motd"; /* File where the motd is stored */
58     int connect_timeout = 15; /* How long to wait before a telnet
59     connection times out */
60 segfault 1.1
61 guppy 1.25 int reserved_port_min = 0;
62     int reserved_port_max = 0;
63 segfault 1.1
64 stdarg 1.48 void init_dcc_max(int newmax)
65 segfault 1.1 {
66     int osock = MAXSOCKS;
67    
68 stdarg 1.48 if (newmax < 1) newmax = 1;
69     dcc = realloc(dcc, sizeof(struct dcc_t) * newmax);
70     if (newmax > max_dcc) memset(dcc+max_dcc, 0, (newmax-max_dcc) * sizeof(*dcc));
71    
72     MAXSOCKS = newmax + 10;
73     socklist = (sock_list *)realloc(socklist, sizeof(sock_list) * MAXSOCKS);
74     if (newmax > max_dcc) memset(socklist+max_dcc+10, 0, (newmax-max_dcc) * sizeof(*socklist));
75    
76 segfault 1.1 for (; osock < MAXSOCKS; osock++)
77     socklist[osock].flags = SOCK_UNUSED;
78 stdarg 1.48
79     max_dcc = newmax;
80 segfault 1.1 }
81    
82    
83 fabian 1.17 /* Replace \n with \r\n */
84 segfault 1.1 char *add_cr(char *buf)
85     {
86     static char WBUF[1024];
87     char *p, *q;
88    
89     for (p = buf, q = WBUF; *p; p++, q++) {
90     if (*p == '\n')
91     *q++ = '\r';
92     *q = *p;
93     }
94     *q = *p;
95     return WBUF;
96     }
97    
98     extern void (*qserver) (int, char *, int);
99 fabian 1.7
100 fabian 1.5 void dprintf EGG_VARARGS_DEF(int, arg1)
101 segfault 1.1 {
102 guppy 1.28 static char buf[1024];
103 segfault 1.1 char *format;
104     int idx, len;
105 fabian 1.17 va_list va;
106 segfault 1.1
107 fabian 1.5 idx = EGG_VARARGS_START(int, arg1, va);
108 segfault 1.1 format = va_arg(va, char *);
109 stdarg 1.52 len = vsnprintf(buf, 1023, format, va);
110 segfault 1.1 va_end(va);
111 stdarg 1.52 if (len < 0 || len >= sizeof(buf)) len = sizeof(buf)-1;
112     buf[len] = 0;
113 guppy 1.28
114 segfault 1.1 if (idx < 0) {
115 guppy 1.28 tputs(-idx, buf, len);
116 segfault 1.1 } else if (idx > 0x7FF0) {
117     switch (idx) {
118     case DP_LOG:
119 guppy 1.28 putlog(LOG_MISC, "*", "%s", buf);
120 segfault 1.1 break;
121     case DP_STDOUT:
122 guppy 1.28 tputs(STDOUT, buf, len);
123 segfault 1.1 break;
124     case DP_STDERR:
125 guppy 1.28 tputs(STDERR, buf, len);
126 segfault 1.1 break;
127     case DP_SERVER:
128     case DP_HELP:
129     case DP_MODE:
130 fabian 1.8 case DP_MODE_NEXT:
131     case DP_SERVER_NEXT:
132     case DP_HELP_NEXT:
133 guppy 1.28 qserver(idx, buf, len);
134 segfault 1.1 break;
135     }
136     return;
137     } else {
138 fabian 1.17 if (len > 500) { /* Truncate to fit */
139 guppy 1.28 buf[500] = 0;
140     strcat(buf, "\n");
141 segfault 1.1 len = 501;
142     }
143     if (dcc[idx].type && ((long) (dcc[idx].type->output) == 1)) {
144 guppy 1.28 char *p = add_cr(buf);
145 segfault 1.1
146     tputs(dcc[idx].sock, p, strlen(p));
147     } else if (dcc[idx].type && dcc[idx].type->output) {
148 guppy 1.28 dcc[idx].type->output(idx, buf, dcc[idx].u.other);
149 segfault 1.1 } else
150 guppy 1.28 tputs(dcc[idx].sock, buf, len);
151 segfault 1.1 }
152     }
153    
154 fabian 1.5 void chatout EGG_VARARGS_DEF(char *, arg1)
155 segfault 1.1 {
156 guppy 1.28 int i, len;
157 segfault 1.1 char *format;
158     char s[601];
159 fabian 1.17 va_list va;
160 segfault 1.1
161 fabian 1.5 format = EGG_VARARGS_START(char *, arg1, va);
162 tothwolf 1.39 vsnprintf(s, 511, format, va);
163 guppy 1.28 va_end(va);
164     len = strlen(s);
165     if (len > 511)
166     len = 511;
167 guppy 1.31 s[len + 1] = 0;
168 guppy 1.28
169 segfault 1.1 for (i = 0; i < dcc_total; i++)
170     if (dcc[i].type == &DCC_CHAT)
171     if (dcc[i].u.chat->channel >= 0)
172 guppy 1.28 dprintf(i, "%s", s);
173 guppy 1.31
174 segfault 1.1 }
175    
176 fabian 1.17 /* Print to all on this channel but one.
177     */
178 fabian 1.5 void chanout_but EGG_VARARGS_DEF(int, arg1)
179 segfault 1.1 {
180 guppy 1.28 int i, x, chan, len;
181 segfault 1.1 char *format;
182     char s[601];
183 fabian 1.17 va_list va;
184 segfault 1.1
185 fabian 1.5 x = EGG_VARARGS_START(int, arg1, va);
186 segfault 1.1 chan = va_arg(va, int);
187     format = va_arg(va, char *);
188 tothwolf 1.39 vsnprintf(s, 511, format, va);
189 guppy 1.28 va_end(va);
190     len = strlen(s);
191     if (len > 511)
192     len = 511;
193 guppy 1.31 s[len + 1] = 0;
194    
195 segfault 1.1 for (i = 0; i < dcc_total; i++)
196     if ((dcc[i].type == &DCC_CHAT) && (i != x))
197     if (dcc[i].u.chat->channel == chan)
198 guppy 1.28 dprintf(i, "%s", s);
199 guppy 1.31
200 segfault 1.1 }
201    
202     void dcc_chatter(int idx)
203     {
204     int i, j;
205 fabian 1.17 struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
206 segfault 1.1
207     get_user_flagrec(dcc[idx].user, &fr, NULL);
208     show_motd(idx);
209     i = dcc[idx].u.chat->channel;
210     dcc[idx].u.chat->channel = 234567;
211     j = dcc[idx].sock;
212     strcpy(dcc[idx].u.chat->con_chan, "***");
213 fabian 1.17 /* Still there? */
214 segfault 1.1 if ((idx >= dcc_total) || (dcc[idx].sock != j))
215 fabian 1.17 return; /* Nope */
216     /* Tcl script may have taken control */
217 segfault 1.1 if (dcc[idx].type == &DCC_CHAT) {
218     if (!strcmp(dcc[idx].u.chat->con_chan, "***"))
219     strcpy(dcc[idx].u.chat->con_chan, "*");
220     if (dcc[idx].u.chat->channel == 234567) {
221 fabian 1.17 /* If the chat channel has already been altered it's *highly*
222 segfault 1.1 * probably join/part messages have been broadcast everywhere,
223 fabian 1.17 * so dont bother sending them
224     */
225 segfault 1.1 if (i == -2)
226     i = 0;
227     dcc[idx].u.chat->channel = i;
228     }
229 fabian 1.17 /* But *do* bother with sending it locally */
230 guppy 1.24 if (!dcc[idx].u.chat->channel) {
231 segfault 1.1 chanout_but(-1, 0, "*** %s joined the party line.\n", dcc[idx].nick);
232     } else if (dcc[idx].u.chat->channel > 0) {
233     chanout_but(-1, dcc[idx].u.chat->channel,
234     "*** %s joined the channel.\n", dcc[idx].nick);
235     }
236     }
237     }
238 wcc 1.58
239     /* Closes an open FD for transfer sockets. */
240     void killtransfer(int n)
241     {
242     if (dcc[n].u.xfer->f) {
243     fclose(dcc[n].u.xfer->f);
244     dcc[n].u.xfer->f = NULL;
245     }
246     }
247 segfault 1.1
248 fabian 1.14 /* Mark an entry as lost and deconstruct it's contents. It will be securely
249     * removed from the dcc list in the main loop.
250     */
251 segfault 1.1 void lostdcc(int n)
252     {
253 guppy 1.46 /* Make sure it's a valid dcc index. */
254     if (n < 0 || n >= max_dcc) return;
255    
256 fabian 1.14 if (dcc[n].type && dcc[n].type->kill)
257     dcc[n].type->kill(n, dcc[n].u.other);
258     else if (dcc[n].u.other)
259 tothwolf 1.37 free(dcc[n].u.other);
260     memset(&dcc[n], 0, sizeof(struct dcc_t));
261 fabian 1.14
262     dcc[n].sock = (-1);
263 fabian 1.11 dcc[n].type = &DCC_LOST;
264     }
265    
266     /* Remove entry from dcc list. Think twice before using this function,
267     * because it invalidates any variables that point to a specific dcc
268     * entry!
269 fabian 1.17 *
270     * Note: The entry will be deconstructed if it was not deconstructed
271     * already. This case should normally not occur.
272 fabian 1.11 */
273 ite 1.49 static void removedcc(int n)
274 fabian 1.11 {
275 segfault 1.1 if (dcc[n].type && dcc[n].type->kill)
276     dcc[n].type->kill(n, dcc[n].u.other);
277     else if (dcc[n].u.other)
278 tothwolf 1.37 free(dcc[n].u.other);
279 stdarg 1.40
280 ite 1.49 /* if we are removing the last entry let's decrease dcc_total */
281     if(n + 1 == dcc_total) dcc_total--;
282    
283 stdarg 1.40 memset(&dcc[n], 0, sizeof(struct dcc_t)); /* drummer */
284 fabian 1.12 }
285    
286     /* Clean up sockets that were just left for dead.
287     */
288     void dcc_remove_lost(void)
289     {
290     int i;
291    
292 ite 1.49
293     for (i = dcc_total; i > 0; --i) {
294 fabian 1.12 if (dcc[i].type == &DCC_LOST) {
295 fabian 1.14 dcc[i].type = NULL;
296 fabian 1.12 removedcc(i);
297     }
298     }
299 segfault 1.1 }
300    
301 fabian 1.17 /* Show list of current dcc's to a dcc-chatter
302     * positive value: idx given -- negative value: sock given
303     */
304 segfault 1.1 void tell_dcc(int zidx)
305     {
306     int i, j, k;
307     char other[160];
308    
309     spaces[HANDLEN - 9] = 0;
310 drummer 1.33 dprintf(zidx, "SOCK PORT NICK %s HOST TYPE\n"
311 segfault 1.1 ,spaces);
312 drummer 1.33 dprintf(zidx, "---- ----- ---------%s -------------------------- ----\n"
313 segfault 1.1 ,spaces);
314     spaces[HANDLEN - 9] = ' ';
315 fabian 1.17 /* Show server */
316 segfault 1.1 for (i = 0; i < dcc_total; i++) {
317 stdarg 1.40 if (!dcc[i].type) continue;
318 segfault 1.1 j = strlen(dcc[i].host);
319 drummer 1.33 if (j > 26)
320     j -= 26;
321 segfault 1.1 else
322     j = 0;
323     if (dcc[i].type && dcc[i].type->display)
324     dcc[i].type->display(i, other);
325     else {
326     sprintf(other, "?:%lX !! ERROR !!", (long) dcc[i].type);
327     break;
328     }
329     k = HANDLEN - strlen(dcc[i].nick);
330     spaces[k] = 0;
331 stdarg 1.40 dprintf(zidx, "%-4d %5d %s%s %-26s %s\n", i,
332 segfault 1.1 dcc[i].port, dcc[i].nick, spaces, dcc[i].host + j, other);
333     spaces[k] = ' ';
334     }
335     }
336    
337 fabian 1.17 /* Mark someone on dcc chat as no longer away
338     */
339 segfault 1.1 void not_away(int idx)
340     {
341     if (dcc[idx].u.chat->away == NULL) {
342     dprintf(idx, "You weren't away!\n");
343     return;
344     }
345     if (dcc[idx].u.chat->channel >= 0) {
346     chanout_but(-1, dcc[idx].u.chat->channel,
347     "*** %s is no longer away.\n", dcc[idx].nick);
348     }
349     dprintf(idx, "You're not away any more.\n");
350 tothwolf 1.37 free_null(dcc[idx].u.chat->away);
351 segfault 1.1 }
352    
353     void set_away(int idx, char *s)
354     {
355     if (s == NULL) {
356     not_away(idx);
357     return;
358     }
359     if (!s[0]) {
360     not_away(idx);
361     return;
362     }
363     if (dcc[idx].u.chat->away != NULL)
364 tothwolf 1.37 free(dcc[idx].u.chat->away);
365 ite 1.42 dcc[idx].u.chat->away = strdup(s);
366 segfault 1.1 if (dcc[idx].u.chat->channel >= 0) {
367     chanout_but(-1, dcc[idx].u.chat->channel,
368     "*** %s is now away: %s\n", dcc[idx].nick, s);
369     }
370     dprintf(idx, "You are now away.\n");
371     }
372    
373 fabian 1.17 /* Make a password, 10-15 random letters and digits
374     */
375 segfault 1.1 void makepass(char *s)
376     {
377 fabian 1.2 int i;
378 segfault 1.1
379     i = 10 + (random() % 6);
380 fabian 1.2 make_rand_str(s, i);
381 segfault 1.1 }
382    
383     void flush_lines(int idx, struct chat_info *ci)
384     {
385     int c = ci->line_count;
386     struct msgq *p = ci->buffer, *o;
387    
388     while (p && c < (ci->max_line)) {
389     ci->current_lines--;
390     tputs(dcc[idx].sock, p->msg, p->len);
391 tothwolf 1.37 free(p->msg);
392 segfault 1.1 o = p->next;
393 tothwolf 1.37 free(p);
394 segfault 1.1 p = o;
395     c++;
396     }
397     if (p != NULL) {
398     if (dcc[idx].status & STAT_TELNET)
399     tputs(dcc[idx].sock, "[More]: ", 8);
400     else
401     tputs(dcc[idx].sock, "[More]\n", 7);
402     }
403     ci->buffer = p;
404     ci->line_count = 0;
405     }
406    
407     int new_dcc(struct dcc_table *type, int xtra_size)
408     {
409     int i = dcc_total;
410    
411 stdarg 1.47 for (i = 0; i < dcc_total; i++)
412 stdarg 1.40 if (!dcc[i].type) break;
413 stdarg 1.47
414     if (i == max_dcc)
415     return -1;
416    
417     if (i == dcc_total)
418 stdarg 1.40 dcc_total++;
419     memset(&dcc[i], 0, sizeof(*dcc));
420 segfault 1.1
421     dcc[i].type = type;
422 tothwolf 1.37 if (xtra_size)
423 tothwolf 1.38 dcc[i].u.other = calloc(1, xtra_size);
424 segfault 1.1 return i;
425     }
426    
427 fabian 1.22 /* Changes the given dcc entry to another type.
428     */
429 fabian 1.3 void changeover_dcc(int i, struct dcc_table *type, int xtra_size)
430     {
431 fabian 1.22 /* Free old structure. */
432 fabian 1.3 if (dcc[i].type && dcc[i].type->kill)
433     dcc[i].type->kill(i, dcc[i].u.other);
434 tothwolf 1.37 else if (dcc[i].u.other)
435     free_null(dcc[i].u.other);
436 fabian 1.3
437     dcc[i].type = type;
438 tothwolf 1.37 if (xtra_size)
439 tothwolf 1.38 dcc[i].u.other = calloc(1, xtra_size);
440 fabian 1.3 }
441    
442 segfault 1.1 int detect_dcc_flood(time_t * timer, struct chat_info *chat, int idx)
443     {
444     time_t t;
445    
446 guppy 1.24 if (!dcc_flood_thr)
447 segfault 1.1 return 0;
448     t = now;
449     if (*timer != t) {
450     *timer = t;
451     chat->msgs_per_sec = 0;
452     } else {
453     chat->msgs_per_sec++;
454     if (chat->msgs_per_sec > dcc_flood_thr) {
455     /* FLOOD */
456 ite 1.34 dprintf(idx, "*** FLOOD: %s.\n", _("Goodbye"));
457 fabian 1.17 /* Evil assumption here that flags&DCT_CHAT implies chat type */
458 segfault 1.1 if ((dcc[idx].type->flags & DCT_CHAT) && chat &&
459     (chat->channel >= 0)) {
460     char x[1024];
461    
462 tothwolf 1.39 snprintf(x, sizeof x, _("%s has been forcibly removed for flooding.\n"), dcc[idx].nick);
463 segfault 1.1 chanout_but(idx, chat->channel, "*** %s", x);
464     }
465     if ((dcc[idx].sock != STDOUT) || backgrd) {
466     killsock(dcc[idx].sock);
467     lostdcc(idx);
468     } else {
469     dprintf(DP_STDOUT, "\n### SIMULATION RESET ###\n\n");
470     dcc_chatter(idx);
471     }
472     return 1; /* <- flood */
473     }
474     }
475     return 0;
476     }
477    
478 fabian 1.17 /* Handle someone being booted from dcc chat.
479     */
480 segfault 1.1 void do_boot(int idx, char *by, char *reason)
481     {
482     int files = (dcc[idx].type != &DCC_CHAT);
483    
484 ite 1.34 dprintf(idx, _("-=- poof -=-\n"));
485     dprintf(idx, _("Youve been booted from the %s by %s%s%s\n"), files ? "file section" : "bot",
486 fabian 1.23 by, reason[0] ? ": " : ".", reason);
487 fabian 1.17 /* If it's a partyliner (chatterer :) */
488     /* Horrible assumption that DCT_CHAT using structure uses same format
489 segfault 1.1 * as DCC_CHAT */
490     if ((dcc[idx].type->flags & DCT_CHAT) &&
491     (dcc[idx].u.chat->channel >= 0)) {
492     char x[1024];
493    
494 tothwolf 1.39 snprintf(x, sizeof x, _("%s booted %s from the party line%s%s\n"), by, dcc[idx].nick,
495 guppy 1.24 reason[0] ? ": " : "", reason);
496 segfault 1.1 chanout_but(idx, dcc[idx].u.chat->channel, "*** %s.\n", x);
497     }
498     if ((dcc[idx].sock != STDOUT) || backgrd) {
499     killsock(dcc[idx].sock);
500 fabian 1.11 lostdcc(idx);
501 fabian 1.17 /* Entry must remain in the table so it can be logged by the caller */
502 segfault 1.1 } else {
503     dprintf(DP_STDOUT, "\n### SIMULATION RESET\n\n");
504     dcc_chatter(idx);
505     }
506     return;
507 stdarg 1.55 }
508    
509     int add_note(char *to, char *from, char *msg, int idx, int echo)
510     {
511     int status, i, iaway, sock;
512     char ss[81], ssf[81];
513     struct userrec *u;
514    
515     if (strlen(msg) > 450)
516     msg[450] = 0; /* Notes have a limit */
517     /* note length + PRIVMSG header + nickname + date must be <512 */
518     /* Might be form "sock:nick" */
519     splitc(ssf, from, ':');
520     rmspace(ssf);
521     splitc(ss, to, ':');
522     rmspace(ss);
523     if (!ss[0])
524     sock = (-1);
525     else
526     sock = atoi(ss);
527     /* Don't process if there's a note binding for it */
528     if (idx != (-2)) { /* Notes from bots don't trigger it */
529     }
530     if (!(u = get_user_by_handle(userlist, to))) {
531     if (idx >= 0)
532     dprintf(idx, _("I dont know anyone by that name.\n"));
533     return NOTE_ERROR;
534     }
535     if (is_bot(u)) {
536     if (idx >= 0)
537     dprintf(idx, _("Thats a bot. You cant leave notes for a bot.\n"));
538     return NOTE_ERROR;
539     }
540     if (match_noterej(u, from)) {
541     if (idx >= 0)
542     dprintf(idx, "%s %s\n", u->handle, "rejected your note.");
543     return NOTE_REJECT;
544     }
545     status = NOTE_STORED;
546     iaway = 0;
547     /* Online right now? */
548     for (i = 0; i < dcc_total; i++) {
549     if (dcc[i].type && (dcc[i].type->flags & DCT_GETNOTES) &&
550     ((sock == (-1)) || (sock == dcc[i].sock)) &&
551     (!strcasecmp(dcc[i].nick, to))) {
552     int aok = 1;
553    
554     if (dcc[i].type == &DCC_CHAT)
555     if ((dcc[i].u.chat->away != NULL) &&
556     (idx != (-2))) {
557     /* Only check away if it's not from a bot */
558     aok = 0;
559     if (idx >= 0)
560     dprintf(idx, "%s %s: %s\n", dcc[i].nick, _("is away"),
561     dcc[i].u.chat->away);
562     if (!iaway)
563     iaway = i;
564     status = NOTE_AWAY;
565     }
566     if (aok) {
567     char *p, *fr = from;
568     int l = 0;
569     char work[1024];
570    
571     while ((*msg == '<') || (*msg == '>')) {
572     p = newsplit(&msg);
573     if (*p == '<')
574     l += simple_sprintf(work + l, "via %s, ", p + 1);
575     else if (*from == '@')
576     fr = p + 1;
577     }
578     if (idx == -2 || (!strcasecmp(from, botnetnick)))
579     dprintf(i, "*** [%s] %s%s\n", fr, l ? work : "", msg);
580     else
581     dprintf(i, "%cNote [%s]: %s%s\n", 7, fr, l ? work : "", msg);
582     if ((idx >= 0) && (echo))
583     dprintf(idx, "-> %s: %s\n", to, msg);
584     return NOTE_OK;
585     }
586     }
587     }
588     if (idx == (-2))
589     return NOTE_OK; /* Error msg from a tandembot: don't store */
590     status = storenote(from, to, msg, idx, NULL, 0);
591     if (status < 0) status = NOTE_ERROR;
592     else if (status == NOTE_AWAY) {
593     /* User is away in all sessions -- just notify the user that a
594     * message arrived and was stored. (only oldest session is notified.)
595     */
596     dprintf(iaway, "*** %s.\n", _("Note arrived for you"));
597     }
598     return(status);
599 segfault 1.1 }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23