* More license declarations
[citadel.git] / citadel / modules / rwho / serv_rwho.c
index 06f439081aa4c69fb9b631233bc5ca2f3b995d35..3d60b1a5a4be4e341961eb587cd5f05b1dc174a9 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"
@@ -51,7 +66,6 @@
  * display who's online
  */
 void cmd_rwho(char *argbuf) {
-       struct CitContext *cptr;
        struct CitContext *nptr;
        int nContexts, i;
        int spoofed = 0;
@@ -68,8 +82,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,12 +90,6 @@ 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;
        cprintf("%d%c \n", LISTING_FOLLOWS, CtdlCheckExpress() );