1 |
/** |
2 |
* uptime.C: This file contains code for OS UPTIME |
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 |
* Copyright © 2005-2006 Patrick Fish, et al. |
10 |
* Rights to this code are as documented in doc/pod/license.pod. |
11 |
* |
12 |
* $Id: uptime.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $ |
13 |
*/ |
14 |
|
15 |
#include "atheme.h" |
16 |
#include <util/time.h> |
17 |
#include <libermyth.h> |
18 |
#include "servers.h" |
19 |
#include <ermyth/module.h> |
20 |
|
21 |
static char const rcsid[] = "$Id: uptime.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $"; |
22 |
|
23 |
REGISTER_MODULE ("operserv/uptime", false, "The Ermyth Team <http://ermyth.xinutec.org>"); |
24 |
|
25 |
static void os_cmd_uptime (sourceinfo_t *si, int parc, char *parv[]); |
26 |
|
27 |
command_t const os_uptime = { "UPTIME", N_("Shows services uptime and the number of registered nicks and channels."), PRIV_SERVER_AUSPEX, 1, os_cmd_uptime }; |
28 |
|
29 |
E cmdvec os_cmdtree; |
30 |
E helpvec os_helptree; |
31 |
|
32 |
bool |
33 |
_modinit (module *m) |
34 |
{ |
35 |
os_cmdtree << os_uptime; |
36 |
help_addentry (os_helptree, "UPTIME", "help/operserv/uptime", NULL); |
37 |
|
38 |
return true; |
39 |
} |
40 |
|
41 |
void |
42 |
_moddeinit () |
43 |
{ |
44 |
os_cmdtree >> os_uptime; |
45 |
help_delentry (os_helptree, "UPTIME"); |
46 |
} |
47 |
|
48 |
static void |
49 |
os_cmd_uptime (sourceinfo_t *si, int parc, char *parv[]) |
50 |
{ |
51 |
logcommand (si, CMDLOG_GET, "UPTIME"); |
52 |
|
53 |
command_success_nodata (si, PACKAGE_NAME "-%s #%s", version, generation); |
54 |
command_success_nodata (si, _("Services have been up for %s"), timediff (NOW - me.start)); |
55 |
command_success_nodata (si, _("Registered accounts: %d"), cnt.myuser); |
56 |
if (!nicksvs.no_nick_ownership) |
57 |
command_success_nodata (si, _("Registered nicknames: %d"), cnt.mynick); |
58 |
command_success_nodata (si, _("Registered channels: %d"), cnt.mychan); |
59 |
command_success_nodata (si, _("Users currently online: %d"), cnt.user - me.me->users); |
60 |
} |
61 |
|
62 |
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs |
63 |
* vim:ts=8 |
64 |
* vim:sw=8 |
65 |
* vim:noexpandtab |
66 |
*/ |