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

Contents of /eggdrop1.9/src/main.c

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


Revision 1.138 - (show annotations) (download) (as text)
Tue Feb 18 10:37:18 2003 UTC (16 years, 8 months ago) by stdarg
Branch: MAIN
Changes since 1.137: +3 -125 lines
File MIME type: text/x-chdr
*** empty log message ***

1 /*
2 * main.c --
3 *
4 * core event handling
5 * signal handling
6 * command line arguments
7 */
8 /*
9 * Copyright (C) 1997 Robey Pointer
10 * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 */
26 /*
27 * The author (Robey Pointer) can be reached at: robey@netcom.com
28 * NOTE: Robey is no longer working on this code, there is a discussion
29 * list available at eggheads@eggheads.org.
30 */
31
32 #ifndef lint
33 static const char rcsid[] = "$Id: main.c,v 1.137 2003/02/18 10:13:17 stdarg Exp $";
34 #endif
35
36 #include <eggdrop/eggdrop.h>
37 #include "main.h"
38 #include "core_config.h"
39 #include <fcntl.h>
40 #ifdef TIME_WITH_SYS_TIME
41 # include <sys/time.h>
42 # include <time.h>
43 #else
44 # ifdef HAVE_SYS_TIME_H
45 # include <sys/time.h>
46 # else
47 # include <time.h>
48 # endif
49 #endif
50 #include <errno.h>
51 #include <signal.h>
52 #include <netdb.h>
53 #include <setjmp.h>
54 #include "users.h" /* check_expired_ignores,
55 get_user_by_handle */
56 #include "chanprog.h" /* tell_verbose_status,
57 chanprog, rehash */
58 #include "userrec.h" /* write_userfile, count_users */
59 #include <locale.h>
60
61 #ifdef STOP_UAC /* osf/1 complains a lot */
62 #include <sys/sysinfo.h>
63 #define UAC_NOPRINT 0x00000001 /* Don't report unaligned fixups */
64 #endif
65 /* Some systems have a working sys/wait.h even though configure will
66 * decide it's not bsd compatable. Oh well.
67 */
68
69 #include "chan.h"
70 #include "modules.h"
71 #include "bg.h"
72 #include "core_binds.h"
73 #include "logfile.h"
74 #include "misc.h"
75 #include "traffic.h"
76 #include "dccutil.h" /* dprintf_eggdrop, new_dcc,
77 dcc_chatter, dcc_remove_lost,
78 lostdcc */
79
80 #include "lib/adns/adns.h"
81
82 #ifdef CYGWIN_HACKS
83 #include <windows.h>
84 #endif
85
86 #ifndef _POSIX_SOURCE
87 /* Solaris needs this */
88 #define _POSIX_SOURCE 1
89 #endif
90
91 extern char userfile[], myname[];
92 extern int dcc_total, conmask, cache_hit, cache_miss;
93 extern struct dcc_t *dcc;
94 extern struct userrec *userlist;
95 extern struct chanset_t *chanset;
96 extern jmp_buf alarmret;
97
98 #ifndef MAKING_MODS
99 extern struct dcc_table DCC_CHAT;
100 #endif /* MAKING_MODS */
101
102 /*
103 * Please use the PATCH macro instead of directly altering the version
104 * string from now on (it makes it much easier to maintain patches).
105 * Also please read the README file regarding your rights to distribute
106 * modified versions of this bot.
107 */
108
109 char egg_version[1024] = VERSION;
110 int egg_numver = VERSION_NUM;
111
112 eggdrop_t *egg = NULL; /* Eggdrop's context */
113
114 char notify_new[121] = ""; /* Person to send a note to for new users */
115 int default_flags = 0; /* Default user flags and */
116 int default_uflags = 0; /* Default userdefinied flags for people
117 who say 'hello' or for .adduser */
118
119 int backgrd = 1; /* Run in the background? */
120 int con_chan = 0; /* Foreground: constantly display channel
121 stats? */
122 int term_z = 0; /* Foreground: use the terminal as a party
123 line? */
124 char configfile[121] = "config.xml"; /* Name of the config file */
125 char helpdir[121] = "help/"; /* Directory of help files (if used) */
126 char textdir[121] = "text/"; /* Directory for text files that get dumped */
127 time_t online_since; /* Unix-time that the bot loaded up */
128 int make_userfile = 0; /* Using bot in make-userfile mode? (first
129 user to 'hello' becomes master) */
130 char owner[121] = ""; /* Permanent owner(s) of the bot */
131 char pid_file[120]; /* Name of the file for the pid to be
132 stored in */
133 int save_users_at = 0; /* How many minutes past the hour to
134 save the userfile? */
135 int notify_users_at = 0; /* How many minutes past the hour to
136 notify users of notes? */
137 char version[81]; /* Version info (long form) */
138 char ver[41]; /* Version info (short form) */
139 char egg_xtra[2048]; /* Patch info */
140 int use_stderr = 1; /* Send stuff to stderr instead of logfiles? */
141 int do_restart = 0; /* .restart has been called, restart asap */
142 int die_on_sighup = 0; /* die if bot receives SIGHUP */
143 int die_on_sigterm = 1; /* die if bot receives SIGTERM */
144 int resolve_timeout = 15; /* hostname/address lookup timeout */
145 char quit_msg[1024]; /* quit message */
146 time_t now; /* duh, now :) */
147 egg_timeval_t egg_timeval_now; /* Same thing, but seconds and microseconds. */
148
149 void fatal(const char *s, int recoverable)
150 {
151 putlog(LOG_MISC, "*", "* %s", s);
152 flushlogs();
153 unlink(pid_file);
154 if (!recoverable) {
155 bg_send_quit(BG_ABORT);
156 exit(1);
157 }
158 }
159
160 static void got_bus(int z)
161 {
162 fatal("BUS ERROR -- CRASHING!", 1);
163 #ifdef SA_RESETHAND
164 kill(getpid(), SIGBUS);
165 #else
166 bg_send_quit(BG_ABORT);
167 exit(1);
168 #endif
169 }
170
171 static void got_segv(int z)
172 {
173 fatal("SEGMENT VIOLATION -- CRASHING!", 1);
174 #ifdef SA_RESETHAND
175 kill(getpid(), SIGSEGV);
176 #else
177 bg_send_quit(BG_ABORT);
178 exit(1);
179 #endif
180 }
181
182 static void got_fpe(int z)
183 {
184 fatal("FLOATING POINT ERROR -- CRASHING!", 0);
185 }
186
187 static void got_term(int z)
188 {
189 write_userfile(-1);
190 check_bind_event("sigterm");
191 if (die_on_sigterm) {
192 fatal("TERMINATE SIGNAL -- SIGNING OFF", 0);
193 } else {
194 putlog(LOG_MISC, "*", "RECEIVED TERMINATE SIGNAL (IGNORING)");
195 }
196 }
197
198 static void got_quit(int z)
199 {
200 check_bind_event("sigquit");
201 putlog(LOG_MISC, "*", "RECEIVED QUIT SIGNAL (IGNORING)");
202 return;
203 }
204
205 static void got_hup(int z)
206 {
207 write_userfile(-1);
208 check_bind_event("sighup");
209 if (die_on_sighup) {
210 fatal("HANGUP SIGNAL -- SIGNING OFF", 0);
211 } else
212 putlog(LOG_MISC, "*", "Received HUP signal: rehashing...");
213 do_restart = -2;
214 return;
215 }
216
217 /* A call to resolver (gethostbyname, etc) timed out
218 */
219 static void got_alarm(int z)
220 {
221 longjmp(alarmret, 1);
222
223 /* -Never reached- */
224 }
225
226 /* Got ILL signal
227 */
228 static void got_ill(int z)
229 {
230 check_bind_event("sigill");
231 }
232
233
234 static void print_version(void)
235 {
236 char x[1024], *z = x;
237
238 strlcpy(x, egg_version, sizeof x);
239 newsplit(&z);
240 newsplit(&z);
241 printf("%s\n", version);
242 if (z[0])
243 printf(" (patches: %s)\n", z);
244 }
245
246 static void print_help(void)
247 {
248 print_version ();
249 printf("\n\
250 Usage: %s [OPTIONS]... [FILE]\n", PACKAGE);
251 printf(_("\n\
252 -h, --help Print help and exit\n\
253 -v, --version Print version and exit\n\
254 -n, --foreground Don't go into the background (default=off)\n\
255 -c --channel-stats (with -n) Display channel stats every 10 seconds\n\
256 -t --terminal (with -n) Use terminal to simulate dcc-chat\n\
257 -m --make-userfile Userfile creation mode\n\
258 FILE optional config filename (default 'config.xml')\n"));
259 printf("\n");
260 }
261
262 static void do_args(int argc, char * const *argv)
263 {
264 int c;
265
266 optarg = 0;
267 optind = 1;
268 opterr = 1;
269 optopt = '?';
270
271 while (1) {
272 int option_index = 0;
273 static struct option long_options[] = {
274 { "help", 0, NULL, 'h' },
275 { "version", 0, NULL, 'v' },
276 { "load-module", 1, NULL, 'p' },
277 { "foreground", 0, NULL, 'n' },
278 { "channel-stats", 0, NULL, 'c' },
279 { "terminal", 0, NULL, 't' },
280 { "make-userfile", 0, NULL, 'm' },
281 { NULL, 0, NULL, 0 }
282 };
283
284 c = getopt_long (argc, argv, "hvp:nctm", long_options, &option_index);
285
286 if (c == -1) break;
287
288 switch (c) {
289 case 'n':
290 backgrd = 0;
291 break;
292
293 case 'c':
294 con_chan = 1;
295 term_z = 0;
296 break;
297
298 case 't':
299 con_chan = 0;
300 term_z = 1;
301 break;
302
303 case 'm':
304 make_userfile = 1;
305 break;
306
307 case 'v':
308 print_version();
309 bg_send_quit(BG_ABORT);
310 exit(0);
311 break; /* this should never be reached */
312
313 case 'h':
314 print_help();
315 bg_send_quit(BG_ABORT);
316 exit(0);
317 break; /* this should never be reached */
318
319 case 0: /* Long option with no short option */
320 case '?': /* Invalid option. */
321 /* getopt_long() already printed an error message. */
322 bg_send_quit(BG_ABORT);
323 exit(1);
324
325 default: /* bug: option not considered. */
326 fprintf (stderr, "%s: option unknown: %c\n", PACKAGE, c);
327 bg_send_quit(BG_ABORT);
328 exit(1);
329 break; /* this should never be reached */
330 }
331 }
332 if (optind < argc)
333 strlcpy(configfile, argv[optind], sizeof configfile);
334 }
335
336 /* Timer info */
337 static int lastmin = 99;
338 static struct tm nowtm;
339
340 /* Called once a second.
341 */
342 static void core_secondly()
343 {
344 static int cnt = 0;
345 int miltime;
346
347 call_hook(HOOK_SECONDLY); /* Will be removed later */
348 cnt++;
349 if (cnt >= 10) { /* Every 10 seconds */
350 cnt = 0;
351 if (con_chan && !backgrd) {
352 dprintf(DP_STDOUT, "\033[2J\033[1;1H");
353 //tell_verbose_status(DP_STDOUT);
354 do_module_report(DP_STDOUT, 0, "server");
355 do_module_report(DP_STDOUT, 0, "channels");
356 }
357 }
358 memcpy(&nowtm, localtime(&now), sizeof(struct tm));
359 if (nowtm.tm_min != lastmin) {
360 int i = 0;
361
362 /* Once a minute */
363 lastmin = (lastmin + 1) % 60;
364 call_hook(HOOK_MINUTELY);
365 check_expired_ignores();
366 /* In case for some reason more than 1 min has passed: */
367 while (nowtm.tm_min != lastmin) {
368 /* Timer drift, dammit */
369 debug2("timer: drift (lastmin=%d, now=%d)", lastmin, nowtm.tm_min);
370 i++;
371 lastmin = (lastmin + 1) % 60;
372 call_hook(HOOK_MINUTELY);
373 }
374 if (i > 1)
375 putlog(LOG_MISC, "*", "(!) timer drift -- spun %d minutes", i);
376 miltime = (nowtm.tm_hour * 100) + (nowtm.tm_min);
377 if (((int) (nowtm.tm_min / 5) * 5) == (nowtm.tm_min)) { /* 5 min */
378 call_hook(HOOK_5MINUTELY);
379 if (!miltime) { /* At midnight */
380 char s[25];
381
382 strlcpy(s, ctime(&now), sizeof s);
383 putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20);
384 call_hook(HOOK_BACKUP);
385 call_hook(HOOK_DAILY);
386 }
387 }
388 if (nowtm.tm_min == notify_users_at)
389 call_hook(HOOK_HOURLY);
390 }
391 }
392
393 static void core_minutely()
394 {
395 check_bind_time(&nowtm);
396 }
397
398 static void core_hourly()
399 {
400 write_userfile(-1);
401 }
402
403 static void event_rehash()
404 {
405 check_bind_event("rehash");
406 }
407
408 static void event_prerehash()
409 {
410 check_bind_event("prerehash");
411 }
412
413 static void event_save()
414 {
415 check_bind_event("save");
416 }
417
418 static void event_logfile()
419 {
420 check_bind_event("logfile");
421 }
422
423 static void event_loaded()
424 {
425 check_bind_event("loaded");
426 }
427
428 void kill_tcl();
429 extern module_entry *module_list;
430
431 int init_userent(), init_net(), init_tcl(int, char **);
432 void core_party_init();
433 void core_config_init();
434 void telnet_init();
435 void dns_init();
436 void binds_init();
437 void dcc_init();
438
439 void patch(const char *str)
440 {
441 char *p = strchr(egg_version, '+');
442
443 if (!p)
444 p = &egg_version[strlen(egg_version)];
445 sprintf(p, "+%s", str);
446 egg_numver++;
447 sprintf(&egg_xtra[strlen(egg_xtra)], " %s", str);
448 }
449
450 /*
451 static inline void garbage_collect(void)
452 {
453 static u_8bit_t run_cnt = 0;
454
455 if (run_cnt == 3)
456 garbage_collect_tclhash();
457 else
458 run_cnt++;
459 }
460 */
461
462 int main(int argc, char **argv)
463 {
464 int xx, i;
465 char s[25];
466 FILE *f;
467 struct sigaction sv;
468 struct chanset_t *chan;
469 egg_timeval_t howlong;
470 int timeout;
471 void *config_root, *entry;
472 char *modname, *scriptname;
473
474 #ifdef DEBUG
475 /* Make sure it can write core, if you make debug. Else it's pretty
476 * useless (dw)
477 */
478 {
479 #include <sys/resource.h>
480 struct rlimit cdlim;
481
482 cdlim.rlim_cur = RLIM_INFINITY;
483 cdlim.rlim_max = RLIM_INFINITY;
484 setrlimit(RLIMIT_CORE, &cdlim);
485 }
486 #endif
487
488 #ifdef ENABLE_NLS
489 setlocale(LC_MESSAGES, "");
490 bindtextdomain(PACKAGE, LOCALEDIR);
491 textdomain(PACKAGE);
492 #endif
493
494 #include "patch.h"
495 /* Version info! */
496 snprintf(ver, sizeof ver, "%s v%s", PACKAGE, egg_version);
497 snprintf(version, sizeof version, "Eggdrop v%s (C) 1997 Robey Pointer (C) 2003 Eggheads",
498 egg_version);
499 /* Now add on the patchlevel (for Tcl) */
500 sprintf(&egg_version[strlen(egg_version)], " %u", egg_numver);
501 strcat(egg_version, egg_xtra);
502 #ifdef STOP_UAC
503 {
504 int nvpair[2];
505
506 nvpair[0] = SSIN_UACPROC;
507 nvpair[1] = UAC_NOPRINT;
508 setsysinfo(SSI_NVPAIRS, (char *) nvpair, 1, NULL, 0);
509 }
510 #endif
511
512 /* Set up error traps: */
513 sv.sa_handler = got_bus;
514 sigemptyset(&sv.sa_mask);
515 #ifdef SA_RESETHAND
516 sv.sa_flags = SA_RESETHAND;
517 #else
518 sv.sa_flags = 0;
519 #endif
520 sigaction(SIGBUS, &sv, NULL);
521 sv.sa_handler = got_segv;
522 sigaction(SIGSEGV, &sv, NULL);
523 #ifdef SA_RESETHAND
524 sv.sa_flags = 0;
525 #endif
526 sv.sa_handler = got_fpe;
527 sigaction(SIGFPE, &sv, NULL);
528 sv.sa_handler = got_term;
529 sigaction(SIGTERM, &sv, NULL);
530 sv.sa_handler = got_hup;
531 sigaction(SIGHUP, &sv, NULL);
532 sv.sa_handler = got_quit;
533 sigaction(SIGQUIT, &sv, NULL);
534 sv.sa_handler = SIG_IGN;
535 sigaction(SIGPIPE, &sv, NULL);
536 sv.sa_handler = got_ill;
537 sigaction(SIGILL, &sv, NULL);
538 sv.sa_handler = got_alarm;
539 sigaction(SIGALRM, &sv, NULL);
540
541 /* Initialize variables and stuff */
542 timer_update_now(&egg_timeval_now);
543 now = egg_timeval_now.sec;
544 chanset = NULL;
545 memcpy(&nowtm, localtime(&now), sizeof(struct tm));
546 lastmin = nowtm.tm_min;
547 srandom(now % (getpid() + getppid()));
548
549 do_args(argc, argv);
550
551 printf("\n%s\n", version);
552 printf(" *** WARNING: Do NOT run this DEVELOPMENT version for any purpose other than testing.\n\n");
553
554 /* Don't allow eggdrop to run as root */
555 if (((int) getuid() == 0) || ((int) geteuid() == 0))
556 fatal(_("ERROR: Eggdrop will not run as root!"), 0);
557
558 egg = eggdrop_new();
559 config_init();
560 core_config_init(configfile);
561 egglog_init();
562 logfile_init();
563 script_init();
564 user_init();
565 if (core_config.userfile) user_load(core_config.userfile);
566 partyline_init();
567 core_party_init();
568 telnet_init();
569 modules_init();
570 dns_init();
571 egg_dns_init();
572 core_binds_init();
573 init_userent();
574 traffic_init();
575
576 if (backgrd)
577 bg_prepare_split();
578
579 init_tcl(argc, argv);
580
581 strlcpy(s, ctime(&now), sizeof s);
582 strcpy(&s[11], &s[20]);
583 putlog(LOG_ALL, "*", "--- Loading %s (%s)", ver, s);
584
585 /* Scan the autoload section of config. */
586 config_root = config_get_root("eggdrop");
587 for (i = 0; (entry = config_exists(config_root, "eggdrop", 0, "autoload", 0, "module", i, NULL)); i++) {
588 modname = NULL;
589 config_get_str(&modname, entry, NULL);
590 module_load(modname);
591 }
592 for (i = 0; (entry = config_exists(config_root, "eggdrop", 0, "autoload", 0, "script", i, NULL)); i++) {
593 scriptname = NULL;
594 config_get_str(&scriptname, entry, NULL);
595 script_load(scriptname);
596 }
597
598
599 i = 0;
600 for (chan = chanset; chan; chan = chan->next)
601 i++;
602 putlog(LOG_MISC, "*", "=== %s: %d channels, %d users.", core_config.botname, i,
603 count_users(userlist));
604 cache_miss = 0;
605 cache_hit = 0;
606
607 if (!pid_file[0])
608 snprintf(pid_file, sizeof pid_file, "pid.%s", myname);
609
610 /* Check for pre-existing eggdrop! */
611 f = fopen(pid_file, "r");
612 if (f != NULL) {
613 fgets(s, 10, f);
614 xx = atoi(s);
615 kill(xx, SIGCHLD); /* Meaningless kill to determine if pid
616 is used */
617 if (errno != ESRCH) {
618 printf(_("I detect %s already running from this directory.\n"), myname);
619 printf(_("If this is incorrect, erase the %s\n"), pid_file);
620 bg_send_quit(BG_ABORT);
621 exit(1);
622 }
623 }
624
625 /* Move into background? */
626 if (backgrd) {
627 #ifndef CYGWIN_HACKS
628 bg_do_split();
629 } else { /* !backgrd */
630 #endif
631 xx = getpid();
632 if (xx != 0) {
633 FILE *fp;
634
635 /* Write pid to file */
636 unlink(pid_file);
637 fp = fopen(pid_file, "w");
638 if (fp != NULL) {
639 fprintf(fp, "%u\n", xx);
640 if (fflush(fp)) {
641 /* Let the bot live since this doesn't appear to be a botchk */
642 printf(_("* Warning! Could not write %s file!\n"), pid_file);
643 fclose(fp);
644 unlink(pid_file);
645 } else
646 fclose(fp);
647 } else
648 printf(_("* Warning! Could not write %s file!\n"), pid_file);
649 #ifdef CYGWIN_HACKS
650 printf("Launched into the background (pid: %d)\n\n", xx);
651 #endif
652 }
653 }
654
655 use_stderr = 0; /* Stop writing to stderr now */
656 if (backgrd) {
657 /* Ok, try to disassociate from controlling terminal (finger cross) */
658 #if HAVE_SETPGID && !defined(CYGWIN_HACKS)
659 setpgid(0, 0);
660 #endif
661 /* Tcl wants the stdin, stdout and stderr file handles kept open. */
662 freopen("/dev/null", "r", stdin);
663 freopen("/dev/null", "w", stdout);
664 freopen("/dev/null", "w", stderr);
665 #ifdef CYGWIN_HACKS
666 FreeConsole();
667 #endif
668 }
669
670 online_since = now;
671 add_help_reference("cmds1.help");
672 add_help_reference("cmds2.help");
673 add_help_reference("core.help");
674 howlong.sec = 1;
675 howlong.usec = 0;
676 timer_create_repeater(&howlong, (Function) core_secondly);
677
678 /* init time'd hooks */
679 add_hook(HOOK_MINUTELY, (Function) core_minutely);
680 add_hook(HOOK_HOURLY, (Function) core_hourly);
681 add_hook(HOOK_REHASH, (Function) event_rehash);
682 add_hook(HOOK_PRE_REHASH, (Function) event_prerehash);
683 add_hook(HOOK_USERFILE, (Function) event_save);
684 add_hook(HOOK_BACKUP, (Function) backup_userfile);
685 add_hook(HOOK_DAILY, (Function) event_logfile);
686 add_hook(HOOK_LOADED, (Function) event_loaded);
687
688 call_hook(HOOK_LOADED);
689
690 debug0("main: entering loop");
691 while (1) {
692 #if !defined(HAVE_PRE7_5_TCL)
693 /* Process a single tcl event */
694 Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT);
695 #endif
696
697 /* Lets move some of this here, reducing the numer of actual
698 * calls to periodic_timers
699 */
700 timer_get_time(&egg_timeval_now);
701 now = egg_timeval_now.sec;
702 random(); /* Woop, lets really jumble things */
703 timer_run();
704
705 /* Free unused structures. */
706 /* garbage_collect(); */
707
708 if (timer_get_shortest(&howlong)) {
709 timeout = 1000;
710 }
711 else {
712 timeout = howlong.sec * 1000 + howlong.usec / 1000;
713 }
714 sockbuf_update_all(timeout);
715
716 timer_update_now(&egg_timeval_now);
717
718 if (do_restart) {
719 if (do_restart == -2)
720 rehash();
721 else {
722 /* Unload as many modules as possible */
723 int f = 1;
724 module_entry *p;
725 Function x;
726 char xx[256];
727
728 /* oops, I guess we should call this event before tcl is restarted */
729 check_bind_event("prerestart");
730
731 while (f) {
732 f = 0;
733 for (p = module_list; p != NULL; p = p->next) {
734 dependancy *d = dependancy_list;
735 int ok = 1;
736
737 while (ok && d) {
738 if (d->needed == p)
739 ok = 0;
740 d = d->next;
741 }
742 if (ok) {
743 strcpy(xx, p->name);
744 if (module_unload(xx, myname) == NULL) {
745 f = 1;
746 break;
747 }
748 }
749 }
750 }
751 p = module_list;
752 if (p && p->next && p->next->next)
753 /* Should be only 2 modules now - blowfish (or some other
754 encryption module) and eggdrop. */
755 putlog(LOG_MISC, "*", _("Stagnant module; there WILL be memory leaks!"));
756 flushlogs();
757 kill_tcl();
758 timer_destroy_all(); /* Destroy all timers. */
759 init_tcl(argc, argv);
760 /* We expect the encryption module as the current module pointed
761 * to by `module_list'.
762 */
763 x = p->funcs[MODCALL_START];
764 /* `NULL' indicates that we just recently restarted. The module
765 * is expected to re-initialise as needed.
766 */
767 x(NULL);
768 rehash();
769 call_hook(HOOK_LOADED);
770 }
771 do_restart = 0;
772 }
773 }
774 }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23