* use eUsrAxlvl all over the place
[citadel.git] / citadel / modules / rwho / serv_rwho.c
index 06f439081aa4c69fb9b631233bc5ca2f3b995d35..6c2c9dc736d895fb5caa44ae2dfa74eb613ac56a 100644 (file)
@@ -4,6 +4,21 @@
  * This module implements server commands related to the display and
  * manipulation of the "Who's online" list.
  *
+ * Copyright (c) 1987-2009 by the citadel.org team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "sysdep.h"
@@ -37,7 +52,6 @@
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "database.h"
@@ -51,7 +65,6 @@
  * display who's online
  */
 void cmd_rwho(char *argbuf) {
-       struct CitContext *cptr;
        struct CitContext *nptr;
        int nContexts, i;
        int spoofed = 0;
@@ -68,8 +81,7 @@ void cmd_rwho(char *argbuf) {
         */
        
 
-       nContexts = num_sessions;
-       nptr = malloc(sizeof(struct CitContext) * nContexts);
+       nptr = CtdlGetContextArray(&nContexts) ;
        if (!nptr)
        {
                /* Couldn't malloc so we have to bail but stick to the protocol */
@@ -77,14 +89,8 @@ void cmd_rwho(char *argbuf) {
                cprintf("000\n");
                return;
        }
-       begin_critical_section(S_SESSION_TABLE);
-       for (cptr = ContextList, i=0; cptr != NULL && i < nContexts; cptr = cptr->next, i++)
-       {
-               memcpy(&nptr[i], cptr, sizeof (struct CitContext));
-       }
-       end_critical_section (S_SESSION_TABLE);
        
-       aide = CC->user.axlevel >= 6;
+       aide = CC->user.axlevel >= AxAideU;
        cprintf("%d%c \n", LISTING_FOLLOWS, CtdlCheckExpress() );
        
        for (i=0; i<nContexts; i++)