]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_chat.c
* Variable names, comments, documentation, etc... removed the acronym 'BBS'
[citadel.git] / citadel / serv_chat.c
index bf6702ae831a1769ce2cd12299eddc849887e071..b323dab7a5590a46f2a9efb93afc0fe6bcc11373 100644 (file)
@@ -241,8 +241,6 @@ void cmd_chat(char *argbuf)
        struct CitContext *t_context;
        int retval;
 
-       unbuffer_output();
-
        if (!(CC->logged_in)) {
                cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
                return;
@@ -251,6 +249,7 @@ void cmd_chat(char *argbuf)
        CC->cs_flags = CC->cs_flags | CS_CHAT;
        cprintf("%d Entering chat mode (type '/help' for available commands)\n",
                START_CHAT_MODE);
+       unbuffer_output();
 
        MyLastMsg = ChatLastMsg;
 
@@ -320,7 +319,7 @@ void cmd_chat(char *argbuf)
                                        if (is_room_aide()) {
                                                cprintf(":|/kick   (kick another user out of this room) \n");
                                        }
-                                       cprintf(":|/quit   (return to the BBS) \n");
+                                       cprintf(":|/quit   (exit from this chat) \n");
                                        cprintf(":|\n");
                                        ok_cmd = 1;
                                }
@@ -634,12 +633,12 @@ int send_instant_message(char *lun, char *x_user, char *x_msg)
                /* Save a copy of the message in the sender's log room,
                 * creating the room if necessary.
                 */
-               create_room(PAGELOGROOM, 4, "", 0, 1, 0);
+               create_room(PAGELOGROOM, 4, "", 0, 1, 0, VIEW_BBS);
                msgnum = CtdlSubmitMsg(logmsg, NULL, PAGELOGROOM);
 
                /* Now save a copy in the global log room, if configured */
                if (strlen(config.c_logpages) > 0) {
-                       create_room(config.c_logpages, 3, "", 0, 1, 1);
+                       create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
                        CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0);
                }
 
@@ -649,7 +648,7 @@ int send_instant_message(char *lun, char *x_user, char *x_msg)
                 * but we've already supplied the namespace prefix.
                 */
                while (sl != NULL) {
-                       create_room(sl->roomname, 5, "", 0, 1, 1);
+                       create_room(sl->roomname, 5, "", 0, 1, 1, VIEW_BBS);
                        CtdlSaveMsgPointerInRoom(sl->roomname, msgnum, 0);
                        sptr = sl->next;
                        free(sl);
@@ -668,8 +667,8 @@ int send_instant_message(char *lun, char *x_user, char *x_msg)
 void cmd_sexp(char *argbuf)
 {
        int message_sent = 0;
-       char x_user[SIZ];
-       char x_msg[SIZ];
+       char x_user[USERNAME_SIZE];
+       char x_msg[1024];
        char *lun;              /* <bc> */
        char *x_big_msgbuf = NULL;
 
@@ -682,9 +681,8 @@ void cmd_sexp(char *argbuf)
        else
                lun = CC->user.fullname;
 
-       extract(x_user, argbuf, 0);
-
-       extract(x_msg, argbuf, 1);
+       extract_token(x_user, argbuf, 0, '|', sizeof x_user);
+       extract_token(x_msg, argbuf, 1, '|', sizeof x_msg);
 
        if (!x_user[0]) {
                cprintf("%d You were not previously paged.\n", ERROR + NO_SUCH_USER);
@@ -708,12 +706,13 @@ void cmd_sexp(char *argbuf)
                                                ERROR + RESOURCE_NOT_OPEN, x_user);
                        return;
                }
+               unbuffer_output();
                cprintf("%d Transmit message (will deliver to %d users)\n",
                        SEND_LISTING, message_sent);
-               flush_output();
                x_big_msgbuf = malloc(SIZ);
                memset(x_big_msgbuf, 0, SIZ);
-               while (client_gets(x_msg), strcmp(x_msg, "000")) {
+               while (client_getln(x_msg, sizeof x_msg),
+                     strcmp(x_msg, "000")) {
                        x_big_msgbuf = realloc(x_big_msgbuf,
                               strlen(x_big_msgbuf) + strlen(x_msg) + 4);
                        if (strlen(x_big_msgbuf) > 0)