]> code.citadel.org Git - citadel.git/blobdiff - citadel/citserver.c
* Modularized the RWHO (Read WHO is online) command, basically as a pilot
[citadel.git] / citadel / citserver.c
index 14ab423b3a829f71ed61fbf2892e6d3b91a82d3e..bcba39ebc37d86a5bb5687625c19f08015f56cdd 100644 (file)
@@ -70,7 +70,7 @@ void master_cleanup(void) {
        /* Cancel all running sessions */
        lprintf(7, "Cancelling running sessions...\n");
 
-/* FIX do something here
+/* FIXME do something here
        while (ContextList != NULL) {
                }
  */
@@ -158,6 +158,16 @@ void RemoveContext (struct CitContext *con)
                return;
        }
 
+       /* Run any cleanup routines registered by loadable modules.
+        * Note 1: This must occur *before* deallocate_user_data() because the
+        *         cleanup functions might touch dynamic session data.
+        * Note 2: We have to "become_session()" because the cleanup functions
+        *         might make references to "CC" assuming it's the right one.
+        */
+       become_session(con);
+       PerformSessionHooks(EVT_STOP);
+       become_session(NULL);
+
        /* Now handle all of the administrivia. */
        lprintf(7, "Calling logout(%d)\n", con->cs_pid);
        logout(con);
@@ -166,11 +176,6 @@ void RemoveContext (struct CitContext *con)
        unlink(con->temp);
        lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid);
        
-       /* Run any cleanup routines registered by loadable modules.
-        * (Must occur *before* deallocate_user_data() because the cleanup
-        * functions might touch dynamic session data)
-        */
-       PerformSessionHooks(EVT_STOP);
 
        syslog(LOG_NOTICE,"session %d ended", con->cs_pid);
        
@@ -366,7 +371,7 @@ void cmd_uchg(char *argbuf)
  * returns an asterisk if there are any express messages waiting,
  * space otherwise.
  */
-char check_express(void) {
+char CtdlCheckExpress(void) {
        if (CC->FirstExpressMessage == NULL) {
                return(' ');
                }
@@ -654,90 +659,6 @@ void GenerateRoomDisplay(char *real_room,
 }
 
 
-/*
- * who's online
- */
-void cmd_rwho(void) {
-       struct CitContext *cptr;
-       int spoofed = 0;
-       int aide;
-       char un[40];
-       char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
-       char host[40], flags[5];
-       
-       aide = CC->usersupp.axlevel >= 6;
-       cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
-       
-       for (cptr = ContextList; cptr != NULL; cptr = cptr->next) 
-       {
-               flags[0] = '\0';
-               spoofed = 0;
-               
-               if (cptr->cs_flags & CS_POSTING)
-                  strcat(flags, "*");
-               else
-                  strcat(flags, ".");
-                  
-               if (cptr->fake_username[0])
-               {
-                  strcpy(un, cptr->fake_username);
-                  spoofed = 1;
-               }
-               else
-                  strcpy(un, cptr->curr_user);
-                  
-               if (cptr->fake_hostname[0])
-               {
-                  strcpy(host, cptr->fake_hostname);
-                  spoofed = 1;
-               }
-               else
-                  strcpy(host, cptr->cs_host);
-
-               GenerateRoomDisplay(real_room, cptr, CC);
-
-               if (cptr->fake_roomname[0]) {
-                       strcpy(room, cptr->fake_roomname);
-                       spoofed = 1;
-               }
-               else {
-                       strcpy(room, real_room);
-               }
-               
-                if ((aide) && (spoofed))
-                   strcat(flags, "+");
-               
-               if ((cptr->cs_flags & CS_STEALTH) && (aide))
-                  strcat(flags, "-");
-               
-               if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
-               {
-                       cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
-                               cptr->cs_pid, un, room,
-                               host, cptr->cs_clientname,
-                               (long)(cptr->lastidle),
-                               cptr->lastcmdname, flags);
-               }
-               if ((spoofed) && (aide))
-               {
-                       cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
-                               cptr->cs_pid, cptr->curr_user,
-                               real_room,
-                               cptr->cs_host, cptr->cs_clientname,
-                               (long)(cptr->lastidle),
-                               cptr->lastcmdname, flags);
-               
-               }
-       }
-
-       /* Now it's magic time.  Before we finish, call any EVT_RWHO hooks
-        * so that external paging modules such as serv_icq can add more
-        * content to the Wholist.
-        */
-       PerformSessionHooks(EVT_RWHO);
-       cprintf("000\n");
-       }
-
 
 /*
  * Terminate another running session
@@ -968,7 +889,7 @@ void do_command_loop(void) {
        }
                   
        if (!strncasecmp(cmdbuf,"NOOP",4)) {
-               cprintf("%d%cok\n",OK,check_express());
+               cprintf("%d%cok\n",OK,CtdlCheckExpress());
                }
 
        else if (!strncasecmp(cmdbuf,"QUIT",4)) {
@@ -1165,10 +1086,6 @@ void do_command_loop(void) {
                cmd_netf(&cmdbuf[5]);
                }
 
-       else if (!strncasecmp(cmdbuf,"RWHO",4)) {
-               cmd_rwho();
-               }
-
        else if (!strncasecmp(cmdbuf,"OPEN",4)) {
                cmd_open(&cmdbuf[5]);
                }