]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/rwho/serv_rwho.c
Added a RENU command (REName a User)
[citadel.git] / citadel / modules / rwho / serv_rwho.c
index 553049c9b3bf61da5140f91605f5851066f0f548..272a0de9e7e28d598f60ad7b5fd271996400ddb4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * This module implementsserver commands related to the display and
+ * This module implements server commands related to the display and
  * manipulation of the "Who's online" list.
  *
  */
@@ -30,6 +30,7 @@
 #include <sys/wait.h>
 #include <string.h>
 #include <limits.h>
+#include <libcitadel.h>
 #include "citadel.h"
 #include "server.h"
 #include "citserver.h"
@@ -41,7 +42,6 @@
 #include "policy.h"
 #include "database.h"
 #include "msgbase.h"
-#include "tools.h"
 
 
 #include "ctdl_module.h"
@@ -154,7 +154,7 @@ void cmd_rwho(char *argbuf) {
         */
        PerformSessionHooks(EVT_RWHO);
        cprintf("000\n");
-       }
+}
 
 
 /*
@@ -166,7 +166,7 @@ void cmd_rchg(char *argbuf)
 
        extract_token(newroomname, argbuf, 0, '|', sizeof newroomname);
        newroomname[ROOMNAMELEN-1] = 0;
-       if (strlen(newroomname) > 0) {
+       if (!IsEmptyStr(newroomname)) {
                safestrncpy(CC->fake_roomname, newroomname,
                        sizeof(CC->fake_roomname) );
        }
@@ -184,7 +184,7 @@ void cmd_hchg(char *argbuf)
        char newhostname[64];
 
        extract_token(newhostname, argbuf, 0, '|', sizeof newhostname);
-       if (strlen(newhostname) > 0) {
+       if (!IsEmptyStr(newhostname)) {
                safestrncpy(CC->fake_hostname, newhostname,
                        sizeof(CC->fake_hostname) );
        }
@@ -207,7 +207,7 @@ void cmd_uchg(char *argbuf)
 
        if (CtdlAccessCheck(ac_aide)) return;
 
-       if (strlen(newusername) > 0) {
+       if (!IsEmptyStr(newusername)) {
                CC->cs_flags &= ~CS_STEALTH;
                memset(CC->fake_username, 0, 32);
                if (strncasecmp(newusername, CC->curr_user,
@@ -238,9 +238,11 @@ void cmd_stel(char *cmdbuf)
 
        if (requested_mode == 1) {
                CC->cs_flags = CC->cs_flags | CS_STEALTH;
+               PerformSessionHooks(EVT_STEALTH);
        }
        if (requested_mode == 0) {
                CC->cs_flags = CC->cs_flags & ~CS_STEALTH;
+               PerformSessionHooks(EVT_UNSTEALTH);
        }
 
        cprintf("%d %d\n", CIT_OK,
@@ -248,19 +250,17 @@ void cmd_stel(char *cmdbuf)
 }
 
 
-
-
-
-
-
 CTDL_MODULE_INIT(rwho)
 {
-        CtdlRegisterProtoHook(cmd_rwho, "RWHO", "Display who is online");
-        CtdlRegisterProtoHook(cmd_hchg, "HCHG", "Masquerade hostname");
-        CtdlRegisterProtoHook(cmd_rchg, "RCHG", "Masquerade roomname");
-        CtdlRegisterProtoHook(cmd_uchg, "UCHG", "Masquerade username");
-        CtdlRegisterProtoHook(cmd_stel, "STEL", "Enter/exit stealth mode");
-
+       if(!threading)
+       {
+               CtdlRegisterProtoHook(cmd_rwho, "RWHO", "Display who is online");
+               CtdlRegisterProtoHook(cmd_hchg, "HCHG", "Masquerade hostname");
+               CtdlRegisterProtoHook(cmd_rchg, "RCHG", "Masquerade roomname");
+               CtdlRegisterProtoHook(cmd_uchg, "UCHG", "Masquerade username");
+               CtdlRegisterProtoHook(cmd_stel, "STEL", "Enter/exit stealth mode");
+       }
+       
        /* return our Subversion id for the Log */
         return "$Id$";
 }