]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_mrtg.c
* extract_token() now expects to be supplied with the size of the
[citadel.git] / citadel / serv_mrtg.c
index d74b95f9ac76b82f8b84ee07587ed6a8905c84d2..a28896cb1cc045c07f36751904624e3534616f1b 100644 (file)
@@ -40,7 +40,7 @@
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
@@ -84,10 +84,12 @@ void mrtg_users(void) {
 
         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;
+                       }
                }
 
        }
@@ -108,24 +110,24 @@ void mrtg_messages(void) {
  * 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)
+char *serv_mrtg_init(void)
 {
         CtdlRegisterProtoHook(cmd_mrtg, "MRTG", "Supply stats to MRTG");
         return "$Id$";