]> code.citadel.org Git - citadel.git/blobdiff - citadel/citserver.c
* Renamed "dynloader" to "serv_extensions" globally. We don't want people
[citadel.git] / citadel / citserver.c
index c96ab9f571085a42190261fb220a9d65935ae46d..783111760904df414778ea93da65c9febace1ff3 100644 (file)
@@ -40,7 +40,7 @@
 #include <arpa/inet.h>
 #include "citadel.h"
 #include "server.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "config.h"
@@ -65,14 +65,18 @@ struct CitContext *ContextList = NULL;
 char *unique_session_numbers;
 int ScheduledShutdown = 0;
 int do_defrag = 0;
+time_t server_startup_time;
 
 /*
  * Various things that need to be initialized at startup
  */
 void master_startup(void) {
        struct timeval tv;
+       struct quickroom qrbuf;
        
        lprintf(9, "master_startup() started\n");
+       time(&server_startup_time);
+
        lprintf(7, "Opening databases\n");
        open_databases();
 
@@ -83,10 +87,17 @@ void master_startup(void) {
        check_ref_counts();
 
        lprintf(7, "Creating base rooms (if necessary)\n");
-       create_room(BASEROOM,           0, "", 0, 1);
-       create_room(AIDEROOM,           3, "", 0, 1);
-       create_room(SYSCONFIGROOM,      3, "", 0, 1);
-       create_room(config.c_twitroom,  0, "", 0, 1);
+       create_room(BASEROOM,           0, "", 0, 1, 0);
+       create_room(AIDEROOM,           3, "", 0, 1, 0);
+       create_room(SYSCONFIGROOM,      3, "", 0, 1, 0);
+       create_room(config.c_twitroom,  0, "", 0, 1, 0);
+
+       /* The "Local System Configuration" room doesn't need to be visible */
+        if (lgetroom(&qrbuf, SYSCONFIGROOM) == 0) {
+                qrbuf.QRflags2 |= QR2_SYSTEM;
+                lputroom(&qrbuf);
+        }
+
 
        lprintf(7, "Seeding the pseudo-random number generator...\n");
        gettimeofday(&tv, NULL);
@@ -205,9 +216,8 @@ void RemoveContext (struct CitContext *con)
        unlink(con->temp);
        lprintf(3, "[%3d] Session ended.\n", con->cs_pid);
        
-
        syslog(LOG_NOTICE,"session %d: ended", con->cs_pid);
-       
+
        /* Deallocate any user-data attached to this session */
        deallocate_user_data(con);
 
@@ -330,6 +340,7 @@ void cmd_info(void) {
        cprintf("1\n"); /* 1 = yes, this system supports floors */
        cprintf("1\n"); /* 1 = we support the extended paging options */
        cprintf("%s\n", CC->cs_nonce);
+       cprintf("1\n"); /* 1 = yes, this system supports the QNOP command */
        cprintf("000\n");
 }
 
@@ -501,20 +512,27 @@ void cmd_mesg(char *mname)
        FILE *mfp;
        char targ[SIZ];
        char buf[SIZ];
+       char buf2[SIZ];
        char *dirs[2];
 
        extract(buf,mname,0);
 
-
        dirs[0]=mallok(64);
        dirs[1]=mallok(64);
        strcpy(dirs[0],"messages");
        strcpy(dirs[1],"help");
-       mesg_locate(targ,sizeof targ,buf,2,(const char **)dirs);
+       snprintf(buf2, sizeof buf2, "%s.%d.%d", buf, CC->cs_clientdev, CC->cs_clienttyp);
+       mesg_locate(targ,sizeof targ,buf2,2,(const char **)dirs);
+       if (strlen(targ) == 0) {
+               snprintf(buf2, sizeof buf2, "%s.%d", buf, CC->cs_clientdev);
+               mesg_locate(targ,sizeof targ,buf2,2,(const char **)dirs);
+               if (strlen(targ) == 0) {
+                       mesg_locate(targ,sizeof targ,buf,2,(const char **)dirs);
+               }       
+       }
        phree(dirs[0]);
        phree(dirs[1]);
 
-
        if (strlen(targ)==0) {
                cprintf("%d '%s' not found.\n",ERROR,mname);
                return;
@@ -891,9 +909,10 @@ void do_command_loop(void) {
 
        /*
         * Let other clients see the last command we executed, and
-        * update the idle time, but not NOOP, PEXP, or GEXP.
+        * update the idle time, but not NOOP, QNOP, PEXP, or GEXP.
         */
        if ( (strncasecmp(cmdbuf, "NOOP", 4))
+          && (strncasecmp(cmdbuf, "QNOP", 4))
           && (strncasecmp(cmdbuf, "PEXP", 4))
           && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
                strcpy(CC->lastcmdname, "    ");
@@ -912,6 +931,10 @@ void do_command_loop(void) {
        if (!strncasecmp(cmdbuf,"NOOP",4)) {
                cprintf("%d%cok\n",CIT_OK,CtdlCheckExpress());
        }
+       
+       else if (!strncasecmp(cmdbuf,"QNOP",4)) {
+               /* do nothing, this command returns no response */
+       }
 
        else if (!strncasecmp(cmdbuf,"QUIT",4)) {
                cprintf("%d Goodbye.\n",CIT_OK);
@@ -967,6 +990,10 @@ void do_command_loop(void) {
                cmd_lzrm(&cmdbuf[5]);
        }
 
+       else if (!strncasecmp(cmdbuf,"LPRM",4)) {
+               cmd_lprm(&cmdbuf[5]);
+       }
+
        else if (!strncasecmp(cmdbuf,"GETU",4)) {
                cmd_getu();
        }
@@ -1007,6 +1034,10 @@ void do_command_loop(void) {
                cmd_msg4(&cmdbuf[5]);
        }
 
+       else if (!strncasecmp(cmdbuf,"MSGP",4)) {
+               cmd_msgp(&cmdbuf[5]);
+       }
+
        else if (!strncasecmp(cmdbuf,"OPNA",4)) {
                cmd_opna(&cmdbuf[5]);
        }
@@ -1227,10 +1258,18 @@ void do_command_loop(void) {
                cmd_seen(&cmdbuf[5]);
        }
 
+       else if (!strncasecmp(cmdbuf, "GTSN", 4)) {
+               cmd_gtsn(&cmdbuf[5]);
+       }
+
        else if (!strncasecmp(cmdbuf, "VIEW", 4)) {
                cmd_view(&cmdbuf[5]);
        }
 
+       else if (!strncasecmp(cmdbuf, "ISME", 4)) {
+               cmd_isme(&cmdbuf[5]);
+       }
+
 #ifdef DEBUG_MEMORY_LEAKS
        else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
                dump_tracked();