ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/operserv/main.C
Revision: 1.6
Committed: Sun Sep 9 20:05:52 2007 UTC (19 years ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.5: +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.5 * Copyright © 2005-2006 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.6 * $Id: main.C,v 1.5 2007-08-28 17:08:11 pippijn Exp $
8 pippijn 1.1 */
9    
10     #include "atheme.h"
11 pippijn 1.6 #include "confparse.h"
12 pippijn 1.5 #include <ermyth/module.h>
13 pippijn 1.1
14 pippijn 1.6 static char const rcsid[] = "$Id: main.C,v 1.5 2007-08-28 17:08:11 pippijn Exp $";
15 pippijn 1.1
16 pippijn 1.5 REGISTER_MODULE ("operserv/main", false, "The Ermyth Team <http://ermyth.schmorp.de>");
17 pippijn 1.1
18 pippijn 1.5 static void on_config_ready (void);
19 pippijn 1.1
20     cmdvec os_cmdtree;
21     helpvec os_helptree;
22    
23     /* main services client routine */
24     static void
25 pippijn 1.4 operserv (sourceinfo_t *si, int parc, char *parv[])
26 pippijn 1.1 {
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.5 command_exec_split (si->service, si, cmd, text, os_cmdtree);
55 pippijn 1.1 }
56    
57     static void
58 pippijn 1.5 on_config_ready (void)
59 pippijn 1.1 {
60     if (opersvs.me)
61     del_service (opersvs.me);
62    
63 pippijn 1.4 opersvs.me = add_service (opersvs.nick, opersvs.user, opersvs.host, opersvs.real, operserv, os_cmdtree);
64 pippijn 1.1 opersvs.disp = opersvs.me->disp;
65     }
66    
67 pippijn 1.5 bool
68     _modinit (module *m)
69 pippijn 1.1 {
70 pippijn 1.5 ConfTable::callback.ready.attach (on_config_ready);
71 pippijn 1.1
72     if (!cold_start)
73     {
74 pippijn 1.4 opersvs.me = add_service (opersvs.nick, opersvs.user, opersvs.host, opersvs.real, operserv, os_cmdtree);
75 pippijn 1.1 opersvs.disp = opersvs.me->disp;
76     }
77 pippijn 1.5
78     return true;
79 pippijn 1.1 }
80    
81     void
82 pippijn 1.5 _moddeinit ()
83 pippijn 1.1 {
84     if (opersvs.me)
85     {
86     del_service (opersvs.me);
87     opersvs.me = NULL;
88     }
89 pippijn 1.5
90     ConfTable::callback.ready.detach (on_config_ready);
91 pippijn 1.1 }