ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/gameserv/main.C
Revision: 1.5
Committed: Sun Sep 9 20:05:51 2007 UTC (19 years, 1 month ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.4: +3 -2 lines
Log Message:
- changed configurations to the c++ stdlib
- more #defines to enum
- removed getopt.h and link.h from the system as they were unused
- reworked logstreams
- added an itoa with old syntax
- made klines objects
- moved some global variables into appropriate classes
- fixed boost.foreach's compiler workaround #if's
- allow other files to add exceptions with ADD_EXCEPTION
- changed mynick_t to c++ object
- moved servers.h out of atheme.h
- corrected PING from inspircd 1.2

File Contents

# User Rev Content
1 pippijn 1.1 /*
2 pippijn 1.4 * Copyright © 2005 Atheme Development Group
3 pippijn 1.2 * Rights to this code are documented in doc/pod/license.pod.
4 pippijn 1.1 *
5     * This file contains the main() routine.
6     *
7 pippijn 1.5 * $Id: main.C,v 1.4 2007-08-28 17:08:09 pippijn Exp $
8 pippijn 1.1 */
9    
10     #include "atheme.h"
11 pippijn 1.5 #include "confparse.h"
12 pippijn 1.4 #include <ermyth/module.h>
13 pippijn 1.1
14 pippijn 1.5 static char const rcsid[] = "$Id: main.C,v 1.4 2007-08-28 17:08:09 pippijn Exp $";
15 pippijn 1.1
16 pippijn 1.4 REGISTER_MODULE ("gameserv/main", false, "The Ermyth Team <http://ermyth.schmorp.de>");
17 pippijn 1.1
18 pippijn 1.4 static void on_config_ready (void);
19 pippijn 1.1
20     cmdvec gs_cmdtree;
21     helpvec gs_helptree;
22    
23     /* main services client routine */
24     static void
25     gameserv (sourceinfo_t *si, int parc, char *parv[])
26     {
27     char *cmd;
28     char *text;
29     char orig[BUFSIZE];
30    
31     /* this should never happen */
32     if (parv[0][0] == '&')
33     {
34     slog (LG_ERROR, "services(): got parv with local channel: %s", parv[0]);
35     return;
36     }
37    
38     /* make a copy of the original for debugging */
39     strlcpy (orig, parv[parc - 1], BUFSIZE);
40    
41     /* lets go through this to get the command */
42     cmd = strtok (parv[parc - 1], " ");
43     text = strtok (NULL, "");
44    
45     if (!cmd)
46     return;
47     if (*cmd == '\001')
48     {
49     handle_ctcp_common (si, cmd, text);
50     return;
51     }
52    
53     /* take the command through the hash table */
54 pippijn 1.4 command_exec_split (si->service, si, cmd, text, gs_cmdtree);
55 pippijn 1.1 }
56    
57     static void
58 pippijn 1.4 on_config_ready (void)
59 pippijn 1.1 {
60     if (gamesvs.me)
61     del_service (gamesvs.me);
62    
63     gamesvs.me = add_service (gamesvs.nick, gamesvs.user, gamesvs.host, gamesvs.real, gameserv, gs_cmdtree);
64     gamesvs.disp = gamesvs.me->disp;
65     }
66    
67 pippijn 1.4 bool
68     _modinit (module *m)
69 pippijn 1.1 {
70 pippijn 1.4 ConfTable::callback.ready.attach (on_config_ready);
71 pippijn 1.1
72     if (!cold_start)
73     {
74     gamesvs.me = add_service (gamesvs.nick, gamesvs.user, gamesvs.host, gamesvs.real, gameserv, gs_cmdtree);
75     gamesvs.disp = gamesvs.me->disp;
76     }
77 pippijn 1.4
78     return true;
79 pippijn 1.1 }
80    
81     void
82 pippijn 1.4 _moddeinit ()
83 pippijn 1.1 {
84     if (gamesvs.me)
85     {
86     del_service (gamesvs.me);
87     gamesvs.me = NULL;
88     }
89 pippijn 1.4
90     ConfTable::callback.ready.detach (on_config_ready);
91 pippijn 1.1 }