ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/operserv/main.C
Revision: 1.4
Committed: Sun Jul 22 18:38:43 2007 UTC (19 years, 2 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.3: +5 -5 lines
Log Message:
-fixed help
- temporarily work around corruption in jsonrpc

File Contents

# User Rev Content
1 pippijn 1.1 /*
2     * 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.4 * $Id: main.C,v 1.3 2007-07-21 13:23:21 pippijn Exp $
8 pippijn 1.1 */
9    
10     #include "atheme.h"
11    
12 pippijn 1.4 static char const rcsid[] = "$Id: main.C,v 1.3 2007-07-21 13:23:21 pippijn Exp $";
13 pippijn 1.1
14     struct os_main_listeners : callback::has_listeners
15     {
16     };
17    
18     os_main_listeners listeners;
19    
20     DECLARE_MODULE_V1 ("operserv/main", false, _modinit, _moddeinit, rcsid, "The Ermyth Team <http://ermyth.schmorp.de>");
21    
22     cmdvec os_cmdtree;
23     helpvec os_helptree;
24    
25     /* main services client routine */
26     static void
27 pippijn 1.4 operserv (sourceinfo_t *si, int parc, char *parv[])
28 pippijn 1.1 {
29     char *cmd;
30     char *text;
31     char orig[BUFSIZE];
32    
33     /* this should never happen */
34     if (parv[0][0] == '&')
35     {
36     slog (LG_ERROR, "services(): got parv with local channel: %s", parv[0]);
37     return;
38     }
39    
40     /* make a copy of the original for debugging */
41     strlcpy (orig, parv[parc - 1], BUFSIZE);
42    
43     /* lets go through this to get the command */
44     cmd = strtok (parv[parc - 1], " ");
45     text = strtok (NULL, "");
46    
47     if (!cmd)
48     return;
49     if (*cmd == '\001')
50     {
51     handle_ctcp_common (si, cmd, text);
52     return;
53     }
54    
55     /* take the command through the hash table */
56     command_exec_split (si->service, si, cmd, text, &os_cmdtree);
57     }
58    
59     static void
60     operserv_config_ready (void *unused)
61     {
62     if (opersvs.me)
63     del_service (opersvs.me);
64    
65 pippijn 1.4 opersvs.me = add_service (opersvs.nick, opersvs.user, opersvs.host, opersvs.real, operserv, os_cmdtree);
66 pippijn 1.1 opersvs.disp = opersvs.me->disp;
67    
68     hook_del_hook ("config_ready", operserv_config_ready);
69     }
70    
71     void
72     _modinit (module_t *m)
73     {
74     hook_add_event ("config_ready");
75     hook_add_hook ("config_ready", operserv_config_ready);
76    
77     if (!cold_start)
78     {
79 pippijn 1.4 opersvs.me = add_service (opersvs.nick, opersvs.user, opersvs.host, opersvs.real, operserv, os_cmdtree);
80 pippijn 1.1 opersvs.disp = opersvs.me->disp;
81     }
82     }
83    
84     void
85     _moddeinit (void)
86     {
87     if (opersvs.me)
88     {
89     del_service (opersvs.me);
90     opersvs.me = NULL;
91     }
92     }
93    
94     /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
95     * vim:ts=8
96     * vim:sw=8
97     * vim:noexpandtab
98     */