ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/operserv/update.C
Revision: 1.7
Committed: Sat Sep 22 14:27:28 2007 UTC (19 years, 1 month ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +3 -3 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# User Rev Content
1 pippijn 1.6 /**
2     * update.C: This file contains functionality which implements the OperServ UPDATE command.
3     *
4     * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
5     * Rights to this code are as documented in COPYING.
6     *
7     *
8     * Portions of this file were derived from sources bearing the following license:
9 pippijn 1.5 * Copyright © 2005-2006 Atheme Development Group
10 pippijn 1.2 * Rights to this code are documented in doc/pod/license.pod.
11 pippijn 1.1 *
12 pippijn 1.7 * $Id: update.C,v 1.6 2007-09-16 18:54:44 pippijn Exp $
13 pippijn 1.1 */
14    
15     #include "atheme.h"
16 pippijn 1.5 #include <ermyth/module.h>
17     #include <ermyth/database.h>
18 pippijn 1.1
19 pippijn 1.7 static char const rcsid[] = "$Id: update.C,v 1.6 2007-09-16 18:54:44 pippijn Exp $";
20 pippijn 1.1
21 pippijn 1.7 REGISTER_MODULE ("operserv/update", false, "The Ermyth Team <http://ermyth.xinutec.org>");
22 pippijn 1.1
23     static void os_cmd_update (sourceinfo_t *si, int parc, char *parv[]);
24    
25 pippijn 1.5 command_t const os_update = { "UPDATE", N_("Flushes services database to disk."), PRIV_ADMIN, 0, os_cmd_update };
26 pippijn 1.1
27 pippijn 1.5 E cmdvec os_cmdtree;
28     E helpvec os_helptree;
29 pippijn 1.1
30 pippijn 1.5 bool
31     _modinit (module *m)
32 pippijn 1.1 {
33     os_cmdtree << os_update;
34 pippijn 1.4 help_addentry (os_helptree, "UPDATE", "help/operserv/update", NULL);
35 pippijn 1.5
36     return true;
37 pippijn 1.1 }
38    
39     void
40     _moddeinit ()
41     {
42     os_cmdtree >> os_update;
43     help_delentry (os_helptree, "UPDATE");
44     }
45    
46     void
47     os_cmd_update (sourceinfo_t *si, int parc, char *parv[])
48     {
49     snoop ("UPDATE: \2%s\2", get_oper_name (si));
50     logcommand (si, CMDLOG_ADMIN, "UPDATE");
51     wallops ("Updating database by request of \2%s\2.", get_oper_name (si));
52     expire_check (NULL);
53 pippijn 1.5 backend->save ();
54     /* backend->save () will wallops/snoop/log the error */
55 pippijn 1.1 command_success_nodata (si, _("UPDATE completed."));
56     }