]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/rwho/serv_rwho.c
de-apify GenerateRoomDisplay(), its only needed in serv_rwho.
[citadel.git] / citadel / modules / rwho / serv_rwho.c
index 0d1631c3356d8d01e4b42915ff031147b61f48cd..4c2e28cdc80495e92c7254bdb2d8d84eec588f0a 100644 (file)
@@ -2,21 +2,16 @@
  * 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
+ * Copyright (c) 1987-2012 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 open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3.
  *
- *  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.
+ * 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"
 
 #include "ctdl_module.h"
 
+/* Don't show the names of private rooms unless the viewing
+ * user also knows the rooms.
+ */
+void GenerateRoomDisplay(char *real_room,
+                       CitContext *viewed,
+                       CitContext *viewer) {
+
+       int ra;
+
+       strcpy(real_room, viewed->room.QRname);
+       if (viewed->room.QRflags & QR_MAILBOX) {
+               strcpy(real_room, &real_room[11]);
+       }
+       if (viewed->room.QRflags & QR_PRIVATE) {
+               CtdlRoomAccess(&viewed->room, &viewer->user, &ra, NULL);
+               if ( (ra & UA_KNOWN) == 0) {
+                       strcpy(real_room, " ");
+               }
+       }
+
+       if (viewed->cs_flags & CS_CHAT) {
+               while (strlen(real_room) < 14) {
+                       strcat(real_room, " ");
+               }
+               strcpy(&real_room[14], "<chat>");
+       }
+
+}
+
+
 
 /*
  * display who's online
@@ -76,8 +101,6 @@ void cmd_rwho(char *argbuf) {
        /* So that we don't keep the context list locked for a long time
         * we create a copy of it first
         */
-       
-
        nptr = CtdlGetContextArray(&nContexts) ;
        if (!nptr)
        {
@@ -87,7 +110,7 @@ void cmd_rwho(char *argbuf) {
                return;
        }
        
-       aide = CC->user.axlevel >= AxAideU;
+       aide = ( (CC->user.axlevel >= AxAideU) || (CC->internal_pgm) ) ;
        cprintf("%d%c \n", LISTING_FOLLOWS, CtdlCheckExpress() );
        
        for (i=0; i<nContexts; i++)