#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "dynloader.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "tools.h"
+#include "ctdl_module.h"
+
+
/*
* Other functions call this one to output data in MRTG format
*/
for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
- ++connected_users;
+ if (cptr->internal_pgm == 0) {
+ ++connected_users;
- if ( (time(NULL) - (cptr->lastidle)) < 900L) {
- ++active_users;
+ if ( (time(NULL) - (cptr->lastidle)) < 900L) {
+ ++active_users;
+ }
}
}
* Fetch data for MRTG
*/
void cmd_mrtg(char *argbuf) {
- char which[SIZ];
+ char which[32];
- extract(which, argbuf, 0);
+ extract_token(which, argbuf, 0, '|', sizeof which);
if (!strcasecmp(which, "users")) {
mrtg_users();
}
- if (!strcasecmp(which, "messages")) {
+ else if (!strcasecmp(which, "messages")) {
mrtg_messages();
}
else {
cprintf("%d Unrecognized keyword '%s'\n",
- ERROR+ILLEGAL_VALUE, which);
+ ERROR + ILLEGAL_VALUE, which);
}
}
-char *Dynamic_Module_Init(void)
+CTDL_MODULE_INIT(mrtg)
{
CtdlRegisterProtoHook(cmd_mrtg, "MRTG", "Supply stats to MRTG");
+
+ /* return our Subversion id for the Log */
return "$Id$";
}