/** * main.C: This file contains the main() routine. * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2005 Atheme Development Group * Rights to this code are documented in doc/pod/license.pod. * * $Id: main.C,v 1.7 2007/09/22 14:27:27 pippijn Exp $ */ #include "atheme.h" #include "confparse.h" #include static char const rcsid[] = "$Id: main.C,v 1.7 2007/09/22 14:27:27 pippijn Exp $"; REGISTER_MODULE ("gameserv/main", false, "The Ermyth Team "); static void on_config_ready (void); cmdvec gs_cmdtree; helpvec gs_helptree; /* main services client routine */ static void gameserv (sourceinfo_t *si, int parc, char *parv[]) { char *cmd; char *text; char orig[BUFSIZE]; /* this should never happen */ if (parv[0][0] == '&') { slog (LG_ERROR, "services(): got parv with local channel: %s", parv[0]); return; } /* make a copy of the original for debugging */ strlcpy (orig, parv[parc - 1], BUFSIZE); /* lets go through this to get the command */ cmd = strtok (parv[parc - 1], " "); text = strtok (NULL, ""); if (!cmd) return; if (*cmd == '\001') { handle_ctcp_common (si, cmd, text); return; } /* take the command through the hash table */ command_exec_split (si->service, si, cmd, text, gs_cmdtree); } static void on_config_ready (void) { if (gamesvs.me) del_service (gamesvs.me); gamesvs.me = add_service (gamesvs.nick, gamesvs.user, gamesvs.host, gamesvs.real, gameserv, gs_cmdtree); gamesvs.disp = gamesvs.me->disp; } bool _modinit (module *m) { ConfTable::callback.ready.attach (on_config_ready); if (!cold_start) { gamesvs.me = add_service (gamesvs.nick, gamesvs.user, gamesvs.host, gamesvs.real, gameserv, gs_cmdtree); gamesvs.disp = gamesvs.me->disp; } return true; } void _moddeinit () { if (gamesvs.me) { del_service (gamesvs.me); gamesvs.me = NULL; } ConfTable::callback.ready.detach (on_config_ready); }