]> code.citadel.org Git - citadel.git/commitdiff
* Message reading and other functions which use the fmout() screen
authorMichael Hampton <io_error@uncensored.citadel.org>
Mon, 24 Jun 2002 16:07:42 +0000 (16:07 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Mon, 24 Jun 2002 16:07:42 +0000 (16:07 +0000)
  formatter now use the new IPC code.

citadel/ChangeLog
citadel/citadel.c
citadel/citadel_ipc.c
citadel/commands.c
citadel/commands.h
citadel/messages.c
citadel/rooms.c

index 781088d4cbac75d005dd50a62082a44c836317ad..deb4e93aee9d75934c1912d5b21aa9379e43e09e 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 591.52  2002/06/24 16:07:42  error
+ * Message reading and other functions which use the fmout() screen
+   formatter now use the new IPC code.
+
  Revision 591.51  2002/06/22 20:09:16  error
  * Use a new IPC API (in citadel_ipc.c).  Partially converted citadel.c to
    use the new API.
@@ -3760,4 +3764,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 7d5a9f5529a1f5ee3f2bbe6210d6d798a7bb2448..24f48f03f9b2962eeac6bbcabb7ac4a49c9b9517 100644 (file)
@@ -175,20 +175,24 @@ void catch_sigcont(int signum)
 
 
 /* general purpose routines */
-
+/* display a file */
 void formout(char *name)
-{                              /* display a file */
-       char cmd[SIZ];
-       snprintf(cmd, sizeof cmd, "MESG %s", name);
-       serv_puts(cmd);
-       serv_gets(cmd);
-       if (cmd[0] != '1') {
-               scr_printf("%s\n", &cmd[4]);
+{
+       int r;                  /* IPC return code */
+       char buf[SIZ];
+       char *text = NULL;
+
+       r = CtdlIPCSystemMessage(name, &text, buf);
+       if (r / 100 != 1) {
+               scr_printf("%s\n", buf);
                return;
        }
-       fmout(screenwidth, NULL, NULL,
-             ((userflags & US_PAGINATOR) ? 1 : 0),
-             screenheight, 1, 1);
+       if (text) {
+               fmout(screenwidth, NULL, text, NULL,
+                     ((userflags & US_PAGINATOR) ? 1 : 0),
+                     screenheight, 1, 1);
+               free(text);
+       }
 }
 
 
index 8c311a50abf7b7646dafd2190d4210b225d59029..bbde34ecdc87da21d08f30bfb223f855f8d6081b 100644 (file)
@@ -16,6 +16,7 @@
 #include <string.h>
 #include <malloc.h>
 #include <stdlib.h>
+#include <ctype.h>
 #ifdef THREADED_CLIENT
 #include <pthread.h>
 #endif
@@ -384,7 +385,7 @@ int CtdlIPCGetSingleMessage(long msgnum, int headers, int as_mime,
 {
        register int ret;
        char aaa[27];
-       char *bbb;
+       char *bbb = NULL;
        size_t bbbsize;
 
        if (!cret) return -1;
@@ -402,7 +403,7 @@ int CtdlIPCGetSingleMessage(long msgnum, int headers, int as_mime,
 
                                extract_token(aaa, bbb, 0, '\n');
                                a = strlen(aaa);
-                               memmove(aaa, bbb + a + 1, strlen(bbb) - a - 1);
+                               safestrncpy(bbb, &bbb[a + 1], strlen(bbb) - a);
 
                                if (!strncasecmp(aaa, "nhdr=yes", 8))
                                        mret[0]->nhdr = 1;
@@ -448,8 +449,11 @@ int CtdlIPCGetSingleMessage(long msgnum, int headers, int as_mime,
                                        }
                                }
                        }
+                       /* Eliminate "text\n" */
+                       safestrncpy(bbb, &bbb[5], strlen(bbb) - 4);
                }
                if (strlen(bbb)) {
+                       /* Strip trailing whitespace */
                        bbb = (char *)realloc(bbb, strlen(bbb) + 1);
                        mret[0]->text = bbb;
                } else {
@@ -1677,9 +1681,12 @@ char *CtdlIPCReadListing(char *dest)
        ret = dest;
        if (ret) length = strlen(ret);
        while (serv_gets(aaa), strcmp(aaa, "000")) {
-               ret = (char *)realloc(ret, length + strlen(aaa) + 1);
-               if (ret)
+               ret = (char *)realloc(ret, length + strlen(aaa) + 2);
+               if (ret) {
                        strcpy(&ret[length], aaa);
+                       length += strlen(aaa);
+                       strcpy(&ret[length++], "\n");
+               }
        }
        return ret;
 }
index 1e5e274440cf8b58d56b9c665f153dd9278b2406..1c64c81a3af79998767a3e4f27b8534cb6e151f3 100644 (file)
@@ -52,6 +52,7 @@
 #include "tools.h"
 #include "rooms.h"
 #include "client_chat.h"
+#include "citadel_ipc.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
 #endif
@@ -208,6 +209,8 @@ void print_express(void)
        int flags = 0;
        char sender[64];
        char node[64];
+       char *listing = NULL;
+       int r;                  /* IPC result code */
 
        if (express_msgs == 0)
                return;
@@ -221,16 +224,15 @@ void print_express(void)
        }
        
        while (express_msgs != 0) {
-               serv_puts("GEXP");
-               serv_gets(buf);
-               if (buf[0] != '1')
+               r = CtdlIPCGetInstantMessage(&listing, buf);
+               if (r / 100 != 1)
                        return;
        
-               express_msgs = extract_int(&buf[4], 0);
-               timestamp = extract_long(&buf[4], 1);
-               flags = extract_int(&buf[4], 2);
-               extract(sender, &buf[4], 3);
-               extract(node, &buf[4], 4);
+               express_msgs = extract_int(buf, 0);
+               timestamp = extract_long(buf, 1);
+               flags = extract_int(buf, 2);
+               extract(sender, buf, 3);
+               extract(node, buf, 4);
                strcpy(last_paged, sender);
        
                stamp = localtime(&timestamp);
@@ -269,10 +271,7 @@ void print_express(void)
                                fprintf(outpipe, " from %s", sender);
                                if (strncmp(serv_info.serv_nodename, node, 32))
                                        fprintf(outpipe, " @%s", node);
-                               fprintf(outpipe, ":\n");
-                               while (serv_gets(buf), strcmp(buf, "000")) {
-                                       fprintf(outpipe, "%s\n", buf);
-                               }
+                               fprintf(outpipe, ":\n%s\n", listing);
                                pclose(outpipe);
                                if (express_msgs == 0)
                                        return;
@@ -312,7 +311,8 @@ void print_express(void)
        
                scr_printf(":\n");
                lines_printed++;
-               fmout(screenwidth, NULL, NULL, 1, screenheight, -1, 0);
+               fmout(screenwidth, NULL, listing, NULL, 1, screenheight, -1, 0);
+               free(listing);
 
                /* when running in curses mode, the scroll bar in most
                   xterm-style programs becomes useless, so it makes sense to
@@ -1259,17 +1259,19 @@ void display_help(char *name)
  */
 int fmout(
        int width,      /* screen width to use */
-       FILE *fpin,     /* file to read from, or NULL to read from server */
+       FILE *fpin,     /* file to read from, or NULL to format given text */
+       char *text,     /* Text to be formatted (when fpin is NULL) */
        FILE *fpout,    /* File to write to, or NULL to write to screen */
        char pagin,     /* nonzero if we should use the paginator */
        int height,     /* screen height to use */
        int starting_lp,/* starting value for lines_printed, -1 for global */
        char subst)     /* nonzero if we should use hypertext mode */
 {
-       int a, b, c, d, old;
+       int a, b, c, old;
        int real = (-1);
        char aaa[140];
        char buffer[512];
+       char *e;
        int eof_flag = 0;
 
        num_urls = 0;   /* Start with a clean slate of embedded URL's */
@@ -1281,6 +1283,7 @@ int fmout(
        old = 255;
        strcpy(buffer, "");
        c = 1;                  /* c is the current pos */
+       e = text;               /* e is pointer to current pos */
 
 FMTA:  while ((eof_flag == 0) && (strlen(buffer) < 126)) {
                if (fpin != NULL) {     /* read from file */
@@ -1291,20 +1294,19 @@ FMTA:   while ((eof_flag == 0) && (strlen(buffer) < 126)) {
                                buffer[strlen(buffer) + 1] = 0;
                                buffer[strlen(buffer)] = a;
                        }
-               } else {        /* read from server */
-                       d = strlen(buffer);
-                       serv_gets(&buffer[d]);
-                       while ((!isspace(buffer[d])) && (isspace(buffer[strlen(buffer) - 1])))
-                               buffer[strlen(buffer) - 1] = 0;
-                       if (!strcmp(&buffer[d], "000")) {
-                               buffer[d] = 0;
+               } else {        /* read from text */
+                       if (!*e) {
                                eof_flag = 1;
                                while (isspace(buffer[strlen(buffer) - 1]))
                                        buffer[strlen(buffer) - 1] = 0;
+                               buffer[strlen(buffer) + 1] = 0;
+                               buffer[strlen(buffer)] = 10;
+                       }
+                       if (eof_flag == 0) {
+                               a = *e++;
+                               buffer[strlen(buffer) + 1] = 0;
+                               buffer[strlen(buffer)] = a;
                        }
-                       d = strlen(buffer);
-                       buffer[d] = 10;
-                       buffer[d + 1] = 0;
                }
        }
 
@@ -1397,9 +1399,9 @@ FMTA:     while ((eof_flag == 0) && (strlen(buffer) < 126)) {
        goto FMTA;
 
        /* keypress caught; drain the server */
-OOPS:  do {
+OOPS:  /* do {
                serv_gets(aaa);
-       } while (strcmp(aaa, "000"));
+       } while (strcmp(aaa, "000")); */
 
 FMTEND:
        if (fpout) {
index aff4a81794fc867187f7c39d5d55a3f0d8fd19fd..233a2d1e7347bfd2d43077013b215bd796c3a496 100644 (file)
@@ -36,8 +36,8 @@ void newprompt(char *prompt, char *str, int len);
 void strprompt(char *prompt, char *str, int len);
 int boolprompt(char *prompt, int prev_val);
 int intprompt(char *prompt, int ival, int imin, int imax);
-int fmout(int width, FILE *fpin, FILE *fpout, char pagin, int height,
-               int starting_lp, char subst);
+int fmout(int width, FILE *fpin, char *text, FILE *fpout, char pagin,
+               int height, int starting_lp, char subst);
 int getcmd(char *argbuf);
 void display_help(char *name);
 void color(int colornum);
index e740634fca9c3069e0161c4cb71331d3b5c81861..6855d6afb4e83d864f00fd9505601c9f5ca27b41 100644 (file)
@@ -36,6 +36,7 @@
 #include "commands.h"
 #include "rooms.h"
 #include "tools.h"
+#include "citadel_ipc.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
 #endif
@@ -362,15 +363,16 @@ int read_message(
        int format_type = 0;
        int fr = 0;
        int nhdr = 0;
+       struct ctdlipcmessage *message = NULL;
+       int r;                          /* IPC response code */
 
        sigcaught = 0;
        sttybbs(1);
 
-       snprintf(buf, sizeof buf, "MSG0 %ld|%d", num, (pagin == READ_HEADER ? 1 : 0));
-       serv_puts(buf);
-       serv_gets(buf);
-       if (buf[0] != '1') {
-               err_printf("*** msg #%ld: %s\n", num, buf);
+       r = CtdlIPCGetSingleMessage(num, (pagin == READ_HEADER ? 1 : 0), 0,
+                                   &message, buf);
+       if (r / 100 != 1) {
+               err_printf("*** msg #%ld: %d %s\n", num, r, buf);
                ++lines_printed;
                lines_printed =
                    checkpagin(lines_printed, pagin, screenheight);
@@ -396,156 +398,135 @@ int read_message(
                color(BRIGHT_CYAN);
        }
 
+       /* View headers only */
        if (pagin == 2) {
-               while (serv_gets(buf), strcmp(buf, "000")) {
-                       if (buf[4] == '=') {
-                               if (dest) {
-                                       fprintf(dest, "%s\n", buf);
-                               } else {
-                                       scr_printf("%s\n", buf);
-                                       ++lines_printed;
-                                       lines_printed =
-                                               checkpagin(lines_printed,
-                                               pagin, screenheight);
-                               }
+               sprintf(buf, "nhdr=%s\nfrom=%s\ntype=%d\nmsgn=%s\n",
+                               message->nhdr ? "yes" : "no",
+                               message->author, message->type,
+                               message->msgid);
+               /* FIXME output buf */
+               if (strlen(message->subject)) {
+                       sprintf(buf, "subj=%s\n", message->subject);
+                       /* FIXME: output buf */
+               }
+               if (strlen(message->email)) {
+                       sprintf(buf, "rfca=%s\n", message->email);
+                       /* FIXME: output buf */
+               }
+               sprintf(buf, "hnod=%s\nroom=%s\nnode=%s\ntime=%ld\n",
+                               message->hnod, message->room,
+                               message->node, message->time);
+               if (strlen(message->recipient)) {
+                       sprintf(buf, "rcpt=%s\n", message->recipient);
+                       /* FIXME: output buf */
+               }
+               if (message->attachments) {
+                       struct parts *ptr;
+
+                       for (ptr = message->attachments; ptr; ptr = ptr->next) {
+                               sprintf(buf, "part=%s|%s|%s|%s|%s|%ld\n",
+                                       ptr->name, ptr->filename, ptr->number,
+                                       ptr->disposition, ptr->mimetype,
+                                       ptr->length);
+                               /* FIXME: output buf */
                        }
                }
                sttybbs(0);
                return (0);
        }
 
-       while (serv_gets(buf), strncasecmp(buf, "text", 4)) {
-               if (!strncasecmp(buf, "nhdr=yes", 8))
-                       nhdr = 1;
-               if (!strncasecmp(buf, "from=", 5)) {
-                       strcpy(from, &buf[5]);
+       if (rc_display_message_numbers) {
+               if (dest) {
+                       fprintf(dest, "[#%s] ", message->msgid);
+               } else {
+                       color(DIM_WHITE);
+                       scr_printf("[");
+                       color(BRIGHT_WHITE);
+                       scr_printf("#%s", message->msgid);
+                       color(DIM_WHITE);
+                       scr_printf("] ");
                }
-               if (nhdr == 1)
-                       buf[0] = '_';
-
-               if (!strncasecmp(buf, "type=", 5))
-                       format_type = atoi(&buf[5]);
-               else if ((!strncasecmp(buf, "msgn=", 5))
-                   && (rc_display_message_numbers)) {
-                       if (dest) {
-                               fprintf(dest, "[#%s] ", &buf[5]);
-                       } else {
-                               color(DIM_WHITE);
-                               scr_printf("[");
-                               color(BRIGHT_WHITE);
-                               scr_printf("#%s", &buf[5]);
-                               color(DIM_WHITE);
-                               scr_printf("] ");
-                       }
+       }
+       if (nhdr == 1 && !is_room_aide) {
+               if (dest) {
+                       fprintf(dest, " ****");
+               } else {
+                       scr_printf(" ****");
                }
-               else if (!strncasecmp(buf, "from=", 5)) {
-                       if (dest) {
-                               fprintf(dest, "from %s ", &buf[5]);
-                       } else {
-                               color(DIM_WHITE);
-                               scr_printf("from ");
-                               color(BRIGHT_CYAN);
-                               scr_printf("%s ", &buf[5]);
+       } else {
+               fmt_date(now, sizeof now, message->time, 0);
+               if (dest) {
+                       fprintf(dest, "%s from %s ", now, message->author);
+                       if (strlen(message->email)) {
+                               fprintf(dest, "<%s> ", message->email);
                        }
-               }
-               else if (!strncasecmp(buf, "subj=", 5)) {
-                       strcpy(m_subject, &buf[5]);
-               }
-               else if (!strncasecmp(buf, "rfca=", 5)) {
-                       safestrncpy(rfca, &buf[5], sizeof(rfca) - 5);
-                       if (dest) {
-                               fprintf(dest, "<%s> ", &buf[5]);
-                       } else {
+               } else {
+                       color(BRIGHT_CYAN);
+                       scr_printf("%s ", now);
+                       color(DIM_WHITE);
+                       scr_printf("from ");
+                       color(BRIGHT_CYAN);
+                       scr_printf("%s ", message->author);
+                       if (strlen(message->email)) {
                                color(DIM_WHITE);
                                scr_printf("<");
                                color(BRIGHT_BLUE);
-                               scr_printf("%s", &buf[5]);
-                               color(DIM_WHITE);
+                               scr_printf("%s", message->email);
+                                       color(DIM_WHITE);
                                scr_printf("> ");
                        }
                }
-               else if ((!strncasecmp(buf, "hnod=", 5))
-                   && (strcasecmp(&buf[5], serv_info.serv_humannode))
-                   && (strlen(rfca) == 0)) {
-                       if (dest) {
-                               fprintf(dest, "(%s) ", &buf[5]);
-                       } else {
-                               color(DIM_WHITE);
-                               scr_printf("(");
-                               color(BRIGHT_WHITE);
-                               scr_printf("%s", &buf[5]);
-                               color(DIM_WHITE);
-                               scr_printf(") ");
-                       }
-               }
-               else if ((!strncasecmp(buf, "room=", 5))
-                   && (strcasecmp(&buf[5], room_name))
-                   && (strlen(rfca) == 0)) {
-                       if (dest) {
-                               fprintf(dest, "in %s> ", &buf[5]);
-                       } else {
-                               color(DIM_WHITE);
-                               scr_printf("in ");
-                               color(BRIGHT_MAGENTA);
-                               scr_printf("%s> ", &buf[5]);
-                       }
-               }
-               else if (!strncasecmp(buf, "node=", 5)) {
-                       safestrncpy(node, &buf[5], sizeof(buf) - 5);
+               if (strlen(message->node)) {
                        if ((room_flags & QR_NETWORK)
-                           ||
-                           ((strcasecmp
-                             (&buf[5], serv_info.serv_nodename)
-                             &&
-                             (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
-                       {
+                           || ((strcasecmp(message->node, serv_info.serv_nodename)
+                            && (strcasecmp(message->node, serv_info.serv_fqdn))))) {
                                if (strlen(rfca) == 0) {
                                        if (dest) {
-                                               fprintf(dest, "@%s ", &buf[5]);
+                                               fprintf(dest, "@%s ", message->node);
                                        } else {
                                                color(DIM_WHITE);
                                                scr_printf("@");
                                                color(BRIGHT_YELLOW);
-                                               scr_printf("%s ", &buf[5]);
+                                               scr_printf("%s ", message->node);
                                        }
                                }
                        }
                }
-               else if (!strncasecmp(buf, "rcpt=", 5)) {
+               if (strcasecmp(message->hnod, serv_info.serv_humannode)
+                   && (strlen(message->hnod)) && (!strlen(rfca))) {
                        if (dest) {
-                               fprintf(dest, "to %s ", &buf[5]);
+                               fprintf(dest, "(%s) ", message->hnod);
                        } else {
                                color(DIM_WHITE);
-                               scr_printf("to ");
-                               color(BRIGHT_CYAN);
-                               scr_printf("%s ", &buf[5]);
+                               scr_printf("(");
+                               color(BRIGHT_WHITE);
+                               scr_printf("%s", message->hnod);
+                               color(DIM_WHITE);
+                               scr_printf(") ");
                        }
                }
-               else if (!strncasecmp(buf, "time=", 5)) {
-                       fmt_date(now, sizeof now, atol(&buf[5]), 0);
+               if (strcasecmp(message->room, room_name) && (strlen(rfca) == 0)) {
                        if (dest) {
-                               fprintf(dest, "%s ", now);
+                               fprintf(dest, "in %s> ", message->room);
                        } else {
-                               scr_printf("%s ", now);
+                               color(DIM_WHITE);
+                               scr_printf("in ");
+                               color(BRIGHT_MAGENTA);
+                               scr_printf("%s> ", message->room);
                        }
                }
-       }
-
-       if (nhdr == 1) {
-               if (!is_room_aide) {
+               if (strlen(message->recipient)) {
                        if (dest) {
-                               fprintf(dest, " ****");
+                               fprintf(dest, "to %s ", message->recipient);
                        } else {
-                               scr_printf(" ****");
-                       }
-               } else {
-                       if (dest) {
-                               fprintf(dest, " %s", from);
-                       } else {
-                               scr_printf(" %s", from);
+                               color(DIM_WHITE);
+                               scr_printf("to ");
+                               color(BRIGHT_CYAN);
+                               scr_printf("%s ", message->recipient);
                        }
                }
        }
+       
        if (dest) {
                fprintf(dest, "\n");
        } else {
@@ -555,8 +536,7 @@ int read_message(
        if (strlen(rfca) > 0) {
                strcpy(reply_to, rfca);
        } else {
-               snprintf(reply_to, sizeof(reply_to), "%s @ %s", from,
-                        node);
+               snprintf(reply_to, sizeof(reply_to), "%s @ %s", from, node);
        }
 
        if (pagin == 1 && !dest)
@@ -566,12 +546,12 @@ int read_message(
                lines_printed = checkpagin(lines_printed, pagin, screenheight);
        }
 
-       strcpy(reply_subject, m_subject);
-       if (strlen(m_subject) > 0) {
+       strcpy(reply_subject, message->subject);
+       if (strlen(message->subject) > 0) {
                if (dest) {
-                       fprintf(dest, "Subject: %s\n", m_subject);
+                       fprintf(dest, "Subject: %s\n", message->subject);
                } else {
-                       scr_printf("Subject: %s\n", m_subject);
+                       scr_printf("Subject: %s\n", message->subject);
                        ++lines_printed;
                        lines_printed = checkpagin(lines_printed,
                                        pagin, screenheight);
@@ -579,15 +559,18 @@ int read_message(
        }
 
        if (format_type == 0) {
-               fr = fmout(screenwidth, NULL, dest,
+               fr = fmout(screenwidth, NULL, message->text, dest,
                           ((pagin == 1) ? 1 : 0), screenheight, (-1), 1);
        } else {
-               while (serv_gets(buf), strcmp(buf, "000")) {
+               int i;
+
+               for (i = 0; i < num_tokens(message->text, '\n'); i++) {
                        if (sigcaught == 0) {
+                               extract_token(buf, message->text, i, '\n');
                                if (dest) {
                                        fprintf(dest, "%s\n", buf);
                                } else {
-                               scr_printf("%s\n", buf);
+                                       scr_printf("%s\n", buf);
                                        lines_printed = lines_printed + 1 +
                                            (strlen(buf) / screenwidth);
                                        lines_printed =
@@ -606,6 +589,8 @@ int read_message(
                ++lines_printed;
                lines_printed = checkpagin(lines_printed, pagin, screenheight);
        }
+       free(message->text);
+       free(message);
 
        if (pagin == 1 && !dest)
                color(DIM_WHITE);
@@ -725,7 +710,7 @@ int client_make_message(char *filename,     /* temporary file name */
        if (mode == 0) {
                fp = fopen(filename, "r");
                if (fp != NULL) {
-                       fmout(screenwidth, fp, NULL, 0, screenheight, 0, 0);
+                       fmout(screenwidth, fp, NULL, NULL, 0, screenheight, 0, 0);
                        beg = ftell(fp);
                        fclose(fp);
                } else {
@@ -835,7 +820,7 @@ MECR:       if (mode == 2) {
                }
                fp = fopen(filename, "r");
                if (fp != NULL) {
-                       fmout(screenwidth, fp, NULL,
+                       fmout(screenwidth, fp, NULL, NULL,
                              ((userflags & US_PAGINATOR) ? 1 : 0),
                              screenheight, 0, 0);
                        beg = ftell(fp);
index 17993fe4ca65ff6870571e2d367b3596720ee44d..d0ed5d5a7a82aa9cf565c467888316b5c227cc3f 100644 (file)
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stdarg.h>
 #include "citadel.h"
+#include "citadel_ipc.h"
 #include "rooms.h"
 #include "commands.h"
 #include "tools.h"
@@ -985,30 +986,31 @@ void entroom(void)
 
 void readinfo(void)
 {                              /* read info file for current room */
-       char cmd[SIZ];
+       char buf[SIZ];
        char raide[64];
+       int r;                  /* IPC response code */
+       char *text = NULL;
 
        /* Name of currernt room aide */
-       serv_puts("GETA");
-       serv_gets(cmd);
-       if (cmd[0] == '2') {
-               safestrncpy(raide, &cmd[4], sizeof raide);
-       } else {
+       r = CtdlIPCGetRoomAide(buf);
+       if (r / 100 == 2)
+               safestrncpy(raide, buf, sizeof raide);
+       else
                strcpy(raide, "");
-       }
+
        if (strlen(raide) > 0)
                scr_printf("Room aide is %s.\n\n", raide);
 
-       serv_puts("RINF");
-       serv_gets(cmd);
-
-       if (cmd[0] != '1') {
+       r = CtdlIPCRoomInfo(&text, buf);
+       if (r / 100 != 1)
                return;
-       }
 
-       fmout(screenwidth, NULL, NULL,
-             ((userflags & US_PAGINATOR) ? 1 : 0), screenheight, 
-             (*raide) ? 2 : 0, 1);
+       if (text) {
+               fmout(screenwidth, NULL, text, NULL,
+                     ((userflags & US_PAGINATOR) ? 1 : 0), screenheight, 
+                     (*raide) ? 2 : 0, 1);
+               free(text);
+       }
 }