]> code.citadel.org Git - citadel.git/blobdiff - citadel/citserver.c
* citserver.c, msgbase.c, user_ops.c: hide the owner-prefix of mail
[citadel.git] / citadel / citserver.c
index ca34147a783011f0667dd4c200f311716041d418..d6f5be50ea7c10fe7d72045f548dcbc91215330d 100644 (file)
@@ -75,6 +75,7 @@ void master_cleanup(void) {
 
        /* Now go away. */
        lprintf(3, "citserver: exiting.\n");
+       fflush(stdout); fflush(stderr);
        exit(0);
        }
 
@@ -144,6 +145,23 @@ void set_wtmpsupp(char *newtext)
        }
 
 
+/*
+ * call set_wtmpsupp() with the name of the current room, modified a bit...
+ */
+void set_wtmpsupp_to_current_room() {
+       if (CC->quickroom.QRflags & QR_PRIVATE) {
+               set_wtmpsupp("<private room>");
+               }
+       else if (CC->quickroom.QRflags & QR_MAILBOX) {
+               set_wtmpsupp(&CC->quickroom.QRname[11]);
+               }
+       else {
+               set_wtmpsupp(CC->quickroom.QRname);
+               }
+       }
+
+
+
 /*
  * cmd_info()  -  tell the client about this server
  */
@@ -171,8 +189,8 @@ void cmd_rchg(char *newroomname)
       strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN-1);
    }
    else
-      CC->fake_roomname[0] = '\0';
-   cprintf("%d\n",OK);
+      strcpy(CC->fake_roomname, "");
+   cprintf("%d OK\n",OK);
 }
 
 void cmd_hchg(char *newhostname)
@@ -183,8 +201,8 @@ void cmd_hchg(char *newhostname)
       strncpy(CC->fake_hostname, newhostname, 24);
    }
    else
-      CC->fake_hostname[0] = '\0';
-   cprintf("%d\n",OK);
+      strcpy(CC->fake_hostname, "");
+   cprintf("%d OK\n",OK);
 }
 
 void cmd_uchg(char *newusername)
@@ -296,7 +314,7 @@ void cmd_iden(char *argbuf)
                strncpy(CC->cs_host,from_host,24);
                CC->cs_host[24] = 0;
                }
-       set_wtmpsupp(CC->quickroom.QRname);
+       set_wtmpsupp_to_current_room();
 
        syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
                dev_code,
@@ -338,7 +356,7 @@ void cmd_stel(char *cmdbuf)
                        CC->cs_flags = CC->cs_flags|CS_STEALTH;
                }
 
-       set_wtmpsupp(CC->quickroom.QRname);
+       set_wtmpsupp_to_current_room();
        cprintf("%d Ok\n",OK);
        }
 
@@ -422,7 +440,7 @@ void cmd_emsg(char *mname)
        free(dirs[1]);
 
        if (strlen(targ)==0) {
-               sprintf(targ, "./help/%s", buf);
+               snprintf(targ, sizeof targ, "./help/%s", buf);
                }
 
        mfp = fopen(targ,"w");
@@ -668,7 +686,7 @@ void *context_loop(struct CitContext *con)
        strcpy(CC->cs_clientname, "(unknown)");
        strcpy(CC->curr_user,"");
        strcpy(CC->net_node,"");
-       sprintf(CC->temp,"/tmp/CitServer.%d.%d", getpid(), CC->cs_pid);
+       snprintf(CC->temp, sizeof CC->temp, "/tmp/CitServer.%d.%d", getpid(), CC->cs_pid);
        strcpy(CC->cs_room, "");
        strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
        CC->cs_host[sizeof CC->cs_host - 1] = 0;