4 * Citadel/UX message support routines
5 * see copyright.txt for copyright information
11 #include <sys/types.h>
22 #if TIME_WITH_SYS_TIME
23 # include <sys/time.h>
27 # include <sys/time.h>
43 #define MAXWORDBUF SIZ
48 char text[MAXWORDBUF];
51 void sttybbs(int cmd);
52 int fmout(int width, FILE * fp, char pagin, int height, int starting_lp,
54 int haschar(char *st, int ch);
55 int checkpagin(int lp, int pagin, int height);
56 void getline(char *string, int lim);
57 void formout(char *name);
59 void newprompt(char *prompt, char *str, int len);
60 int file_checksum(char *filename);
61 void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd);
64 long msg_arr[MAXMSGS];
66 char rc_alt_semantics;
67 extern char room_name[];
68 extern unsigned room_flags;
69 extern long highest_msg_read;
70 extern struct CtdlServInfo serv_info;
73 extern int screenwidth;
74 extern int screenheight;
75 extern long maxmsgnum;
78 extern char is_room_aide;
79 extern char fullname[];
81 extern unsigned userflags;
82 extern char sigcaught;
83 extern char editor_path[];
84 extern char printcmd[];
85 extern int rc_allow_attachments;
86 extern int rc_display_message_numbers;
87 extern int rc_force_mail_prompts;
89 extern int editor_pid;
91 void ka_sigcatch(int signum)
95 signal(SIGALRM, ka_sigcatch);
102 * server keep-alive version of wait() (needed for external editor)
104 pid_t ka_wait(int *kstatus)
109 signal(SIGALRM, ka_sigcatch);
113 } while (errno == EINTR);
114 signal(SIGALRM, SIG_IGN);
121 * version of system() that uses ka_wait()
123 int ka_system(char *shc)
132 perror("Cannot fork");
134 return ((pid_t) childpid);
138 execlp("/bin/sh", "sh", "-c", shc, NULL);
144 waitpid = ka_wait(&retcode);
145 } while (waitpid != childpid);
155 * add a newline to the buffer...
157 void add_newline(struct cittext *textlist)
162 while (ptr->next != NULL)
165 while (ptr->text[strlen(ptr->text) - 1] == 32)
166 ptr->text[strlen(ptr->text) - 1] = 0;
167 /* strcat(ptr->text,"\n"); */
169 ptr->next = (struct cittext *)
170 malloc(sizeof(struct cittext));
173 strcpy(ptr->text, "");
178 * add a word to the buffer...
180 void add_word(struct cittext *textlist, char *wordbuf)
185 while (ptr->next != NULL)
188 if (3 + strlen(ptr->text) + strlen(wordbuf) > screenwidth) {
189 ptr->next = (struct cittext *)
190 malloc(sizeof(struct cittext));
193 strcpy(ptr->text, "");
196 strcat(ptr->text, wordbuf);
197 strcat(ptr->text, " ");
202 * begin editing of an opened file pointed to by fp
204 void citedit(FILE * fp)
206 int a, prev, finished, b, last_space;
208 struct cittext *textlist = NULL;
210 char wordbuf[MAXWORDBUF];
212 /* first, load the text into the buffer */
214 textlist = (struct cittext *) malloc(sizeof(struct cittext));
215 textlist->next = NULL;
216 strcpy(textlist->text, "");
220 while (a = getc(fp), a >= 0) {
222 if ((a == 32) || (a == 9) || (a == 13) || (a == 10)) {
223 add_word(textlist, wordbuf);
225 if ((prev == 13) || (prev == 10)) {
226 add_word(textlist, "\n");
227 add_newline(textlist);
228 add_word(textlist, "");
231 wordbuf[strlen(wordbuf) + 1] = 0;
232 wordbuf[strlen(wordbuf)] = a;
234 if (strlen(wordbuf) + 3 > screenwidth) {
235 add_word(textlist, wordbuf);
243 prev = (appending ? 13 : (-1));
255 /******* new ***********/
256 if ((a > 32) && (a < 127) && (prev == 13)) {
257 add_word(textlist, "\n");
260 /***********************/
262 if ((a == 32) && (prev == 13)) {
263 add_word(textlist, "\n");
264 add_newline(textlist);
268 if (strlen(wordbuf) > 0) {
269 wordbuf[strlen(wordbuf) - 1] = 0;
274 } else if (a == 13) {
276 if (strlen(wordbuf) == 0)
279 for (b = 0; b < strlen(wordbuf); ++b)
280 if (wordbuf[b] == 32) {
288 add_word(textlist, wordbuf);
293 wordbuf[strlen(wordbuf) + 1] = 0;
294 wordbuf[strlen(wordbuf)] = a;
296 if ((strlen(wordbuf) + 3) > screenwidth) {
298 for (b = 0; b < strlen(wordbuf); ++b)
299 if (wordbuf[b] == 32)
301 if (last_space >= 0) {
302 for (b = 0; b < strlen(wordbuf); ++b)
303 if (wordbuf[b] == 32) {
311 for (b = 0; b < strlen(wordbuf); ++b) {
316 printf("\n%s", wordbuf);
318 add_word(textlist, wordbuf);
324 } while (finished == 0);
327 /* write the buffer back to disk */
329 for (ptr = textlist; ptr != NULL; ptr = ptr->next) {
330 fprintf(fp, "%s", ptr->text);
334 ftruncate(fileno(fp), ftell(fp));
336 /* and deallocate the memory we used */
337 while (textlist != NULL) {
338 ptr = textlist->next;
344 /* Read a message from the server
347 long num, /* message number */
348 char pagin) /* 0 = normal read, 1 = read with pagination, 2 = header */
352 char from[SIZ], node[SIZ], rfca[SIZ];
361 sprintf(buf, "MSG0 %ld|%d", num, (pagin == READ_HEADER ? 1 : 0));
365 printf("*** msg #%ld: %s\n", num, buf);
368 checkpagin(lines_printed, pagin, screenheight);
373 strcpy(m_subject, "");
374 strcpy(reply_to, "nobody ... xxxxx");
381 lines_printed = checkpagin(lines_printed, pagin, screenheight);
388 while (serv_gets(buf), strcmp(buf, "000")) {
393 checkpagin(lines_printed,
394 pagin, screenheight);
401 while (serv_gets(buf), strncasecmp(buf, "text", 4)) {
402 if (!strncasecmp(buf, "nhdr=yes", 8))
404 if (!strncasecmp(buf, "from=", 5)) {
405 strcpy(from, &buf[5]);
409 if (!strncasecmp(buf, "type=", 5))
410 format_type = atoi(&buf[5]);
411 if ((!strncasecmp(buf, "msgn=", 5))
412 && (rc_display_message_numbers)) {
416 printf("#%s", &buf[5]);
420 if (!strncasecmp(buf, "from=", 5)) {
424 printf("%s ", &buf[5]);
426 if (!strncasecmp(buf, "subj=", 5))
427 strcpy(m_subject, &buf[5]);
429 if (!strncasecmp(buf, "rfca=", 5)) {
430 safestrncpy(rfca, &buf[5], sizeof(rfca) - 5);
434 printf("%s", &buf[5]);
438 if ((!strncasecmp(buf, "hnod=", 5))
439 && (strcasecmp(&buf[5], serv_info.serv_humannode))
440 && (strlen(rfca) == 0)) {
444 printf("%s", &buf[5]);
448 if ((!strncasecmp(buf, "room=", 5))
449 && (strcasecmp(&buf[5], room_name))
450 && (strlen(rfca) == 0)) {
453 color(BRIGHT_MAGENTA);
454 printf("%s> ", &buf[5]);
457 if (!strncasecmp(buf, "node=", 5)) {
458 safestrncpy(node, &buf[5], sizeof(buf) - 5);
459 if ((room_flags & QR_NETWORK)
462 (&buf[5], serv_info.serv_nodename)
464 (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
466 if (strlen(rfca) == 0) {
469 color(BRIGHT_YELLOW);
470 printf("%s ", &buf[5]);
475 if (!strncasecmp(buf, "rcpt=", 5)) {
479 printf("%s ", &buf[5]);
481 if (!strncasecmp(buf, "time=", 5)) {
482 fmt_date(now, atol(&buf[5]), 0);
496 if (strlen(rfca) > 0) {
497 strcpy(reply_to, rfca);
499 snprintf(reply_to, sizeof(reply_to), "%s @ %s", from,
506 lines_printed = checkpagin(lines_printed, pagin, screenheight);
508 if (strlen(m_subject) > 0) {
509 printf("Subject: %s\n", m_subject);
512 checkpagin(lines_printed, pagin, screenheight);
515 if (format_type == 0) {
516 fr = fmout(screenwidth, NULL,
517 ((pagin == 1) ? 1 : 0), screenheight, (-1), 1);
519 while (serv_gets(buf), strcmp(buf, "000")) {
520 if (sigcaught == 0) {
522 lines_printed = lines_printed + 1 +
523 (strlen(buf) / screenwidth);
525 checkpagin(lines_printed, pagin,
533 lines_printed = checkpagin(lines_printed, pagin, screenheight);
542 * replace string function for the built-in editor
544 void replace_string(char *filename, long int startpos)
553 int substitutions = 0;
556 printf("Enter text to be replaced:\n: ");
557 getline(srch_str, 128);
558 if (strlen(srch_str) == 0)
561 printf("Enter text to replace it with:\n: ");
562 getline(rplc_str, 128);
564 fp = fopen(filename, "r+");
569 fseek(fp, startpos, 0);
571 while (a = getc(fp), a > 0) {
573 buf[strlen(buf) + 1] = 0;
574 buf[strlen(buf)] = a;
575 if (strlen(buf) >= strlen(srch_str)) {
576 ptr = (&buf[strlen(buf) - strlen(srch_str)]);
577 if (!strncasecmp(ptr, srch_str, strlen(srch_str))) {
578 strcpy(ptr, rplc_str);
582 if (strlen(buf) > 384) {
585 fwrite((char *) buf, 128, 1, fp);
586 strcpy(buf, &buf[128]);
593 fwrite((char *) buf, strlen(buf), 1, fp);
596 truncate(filename, wpos);
597 printf("<R>eplace made %d substitution(s).\n\n", substitutions);
601 * Function to begin composing a new message
603 int client_make_message(char *filename, /* temporary file name */
604 char *recipient, /* NULL if it's not mail */
605 int anon_type, /* see MES_ types in header file */
617 if (strlen(editor_path) == 0) {
619 ("*** No editor available, using built-in editor\n");
623 fmt_date(datestr, time(NULL), 0);
626 if (room_flags & QR_ANONONLY && !recipient) {
627 sprintf(&header[strlen(header)], " ****");
630 sprintf(&header[strlen(header)],
631 " %s from %s", datestr, fullname);
632 if (strlen(recipient) > 0) {
633 sprintf(&header[strlen(header)],
634 " to %s", recipient);
637 printf("%s\n", header);
642 printf("(Press ctrl-d when finished)\n");
646 fp = fopen(filename, "r");
648 fmout(screenwidth, fp, 0, screenheight, 0, 0);
652 fp = fopen(filename, "w");
654 printf("*** Error opening temp file!\n"
656 filename, strerror(errno));
666 fp = fopen(filename, "r+");
668 printf("*** Error opening temp file!\n"
670 filename, strerror(errno));
678 fp = fopen(filename, "a");
680 printf("*** Error opening temp file!\n"
682 filename, strerror(errno));
702 e_ex_code = 1; /* start with a failed exit code */
704 cksum = file_checksum(filename);
705 if (editor_pid == 0) {
706 chmod(filename, 0600);
708 setenv("WINDOW_TITLE", header, 1);
709 execlp(editor_path, editor_path, filename, NULL);
715 b = ka_wait(&e_ex_code);
716 } while ((b != editor_pid) && (b >= 0));
722 MECR: if (mode == 2) {
723 if (file_checksum(filename) == cksum) {
724 printf("*** Aborted message.\n");
732 b = keymenu("Entry command (? for options)",
733 "<A>bort|<C>ontinue|<S>ave message|<P>rint formatted|"
734 "<R>eplace string|<H>old message");
743 printf(" %s from %s", datestr, fullname);
744 if (strlen(recipient) > 0)
745 printf(" to %s", recipient);
747 fp = fopen(filename, "r");
749 fmout(screenwidth, fp,
750 ((userflags & US_PAGINATOR) ? 1 : 0),
758 replace_string(filename, 0L);
767 MEABT: printf("Are you sure? ");
771 MEABT2: unlink(filename);
776 * Transmit message text to the server.
778 * This loop also implements a "tick" counter that displays the progress, if
779 * we're sending something that will take a long time to transmit.
781 void transmit_message(FILE *fp)
788 fseek(fp, 0L, SEEK_END);
791 lasttick = time(NULL);
793 while (ch = getc(fp), (ch >= 0)) {
795 if (!strcmp(buf, "000"))
803 if ((ch == 32) && (strlen(buf) > 200)) {
805 if (!strcmp(buf, "000"))
810 if (strlen(buf) > 250) {
811 if (!strcmp(buf, "000"))
818 if ((time(NULL) - lasttick) > 2L) {
819 printf(" %3ld%% completed\r",
820 ((ftell(fp) * 100L) / msglen));
822 lasttick = time(NULL);
834 * entmsg() - edit and create a message
835 * returns 0 if message was saved
837 int entmsg(int is_reply, /* nonzero if this was a <R>eply command */
854 * First, check to see if we have permission to enter a message in
855 * this room. The server will return an error code if we can't.
857 sprintf(cmd, "ENT0 0||0|%d", mode);
861 if ((strncmp(cmd, "570", 3)) && (strncmp(cmd, "200", 3))) {
862 printf("%s\n", &cmd[4]);
866 /* Error code 570 is special. It means that we CAN enter a message
867 * in this room, but a recipient needs to be specified.
870 if (!strncmp(cmd, "570", 3))
873 /* If the user is a dumbass, tell them how to type. */
874 if ((userflags & US_EXPERT) == 0) {
878 /* Handle the selection of a recipient, if necessary. */
880 if (need_recp == 1) {
883 strcpy(buf, reply_to);
885 printf("Enter recipient: ");
886 getline(buf, (SIZ-100) );
887 if (strlen(buf) == 0)
891 strcpy(buf, "sysop");
895 if (room_flags & QR_ANONOPT) {
896 printf("Anonymous (Y/N)? ");
901 /* If it's mail, we've got to check the validity of the recipient... */
902 if (strlen(buf) > 0) {
903 sprintf(cmd, "ENT0 0|%s|%d|%d", buf, b, mode);
907 printf("%s\n", &cmd[4]);
912 /* Learn the number of the newest message in in the room, so we can
913 * tell upon saving whether someone else has posted too.
916 serv_puts("MSGS LAST|1");
919 printf("%s\n", &cmd[5]);
921 while (serv_gets(cmd), strcmp(cmd, "000")) {
922 msg_arr[num_msgs++] = atol(cmd);
926 /* Now compose the message... */
927 if (client_make_message(temp, buf, b, 0, c) != 0) {
931 /* Reopen the temp file that was created, so we can send it */
932 fp = fopen(temp, "r");
934 /* Yes, unlink it now, so it doesn't stick around if we crash */
938 printf("*** Internal error while trying to save message!\n"
940 temp, strerror(errno));
944 /* Transmit message to the server */
945 sprintf(cmd, "ENT0 1|%s|%d|%d||", buf, b, mode);
949 printf("%s\n", &cmd[4]);
953 transmit_message(fp);
958 highmsg = msg_arr[num_msgs - 1];
960 serv_puts("MSGS NEW");
963 printf("%s\n", &cmd[5]);
965 while (serv_gets(cmd), strcmp(cmd, "000")) {
966 msg_arr[num_msgs++] = atol(cmd);
970 /* get new highest message number in room to set lrp for goto... */
971 maxmsgnum = msg_arr[num_msgs - 1];
973 /* now see if anyone else has posted in here */
975 for (a = 0; a < num_msgs; ++a) {
976 if (msg_arr[a] > highmsg) {
981 /* In the Mail> room, this algorithm always counts one message
982 * higher than in public rooms, so we decrement it by one.
989 printf("*** 1 additional message has been entered "
990 "in this room by another user.\n");
993 printf("*** %d additional messages have been entered "
994 "in this room by other users.\n", b);
1001 * Do editing on a quoted file
1003 void process_quote(void)
1005 FILE *qfile, *tfile;
1007 int line, qstart, qend;
1009 /* Unlink the second temp file as soon as it's opened, so it'll get
1010 * deleted even if the program dies
1012 qfile = fopen(temp2, "r");
1015 /* Display the quotable text with line numbers added */
1017 fgets(buf, 128, qfile);
1018 while (fgets(buf, 128, qfile) != NULL) {
1019 printf("%2d %s", ++line, buf);
1021 printf("Begin quoting at [ 1] : ");
1023 qstart = (buf[0] == 0) ? (1) : atoi(buf);
1024 printf(" End quoting at [%d] : ", line);
1026 qend = (buf[0] == 0) ? (line) : atoi(buf);
1029 fgets(buf, 128, qfile);
1030 tfile = fopen(temp, "w");
1031 while (fgets(buf, 128, qfile) != NULL) {
1032 if ((++line >= qstart) && (line <= qend))
1033 fprintf(tfile, " >%s", buf);
1035 fprintf(tfile, " \n");
1044 * List the URL's which were embedded in the previous message
1051 if (num_urls == 0) {
1052 printf("There were no URL's in the previous message.\n\n");
1056 for (i = 0; i < num_urls; ++i) {
1057 printf("%3d %s\n", i + 1, urls[i]);
1060 if ((i = num_urls) != 1)
1061 i = intprompt("Display which one", 1, 1, num_urls);
1063 sprintf(cmd, rc_url_cmd, urls[i - 1]);
1069 * Read the messages in the current room
1072 int c, /* 0=Read all 1=Read new 2=Read old 3=Read last q */
1073 int rdir, /* 1=Forward (-1)=Reverse */
1074 int q /* Number of msgs to read (if c==3) */
1076 int a, b, e, f, g, start;
1082 char prtfile[PATH_MAX];
1085 char targ[ROOMNAMELEN];
1093 strcpy(prtfile, tmpnam(NULL));
1096 strcpy(cmd, "MSGS ");
1108 sprintf(&cmd[strlen(cmd)], "LAST|%d", q);
1113 if (cmd[0] != '1') {
1114 printf("%s\n", &cmd[5]);
1116 while (serv_gets(cmd), strcmp(cmd, "000")) {
1117 if (num_msgs == MAXMSGS) {
1118 memcpy(&msg_arr[0], &msg_arr[1],
1119 (sizeof(long) * (MAXMSGS - 1)));
1122 msg_arr[num_msgs++] = atol(cmd);
1126 if (num_msgs == 0) {
1128 printf("*** There are no ");
1129 if (c == 1) printf("new ");
1130 if (c == 2) printf("old ");
1131 printf("messages in this room.\n");
1137 /* this loop cycles through each message... */
1138 start = ((rdir == 1) ? 0 : (num_msgs - 1));
1139 for (a = start; ((a < num_msgs) && (a >= 0)); a = a + rdir) {
1140 while (msg_arr[a] == 0L) {
1142 if ((a == MAXMSGS) || (a == (-1)))
1146 RAGAIN: pagin = ((arcflag == 0)
1148 && (userflags & US_PAGINATOR)) ? 1 : 0;
1150 /* If we're doing a quote, set the screenwidth to 72 */
1152 hold_sw = screenwidth;
1156 /* If printing or archiving, set the screenwidth to 80 */
1158 hold_sw = screenwidth;
1162 /* now read the message... */
1163 e = read_message(msg_arr[a], pagin);
1165 /* ...and set the screenwidth back if we have to */
1166 if ((quotflag) || (arcflag)) {
1167 screenwidth = hold_sw;
1169 RMSGREAD: fflush(stdout);
1170 highest_msg_read = msg_arr[a];
1172 freopen("/dev/tty", "r+", stdout);
1174 enable_color = hold_color;
1178 freopen("/dev/tty", "r+", stdout);
1180 enable_color = hold_color;
1183 freopen(prtfile, "r", stdin);
1184 sttybbs(SB_RESTORE);
1185 ka_system(printcmd);
1186 sttybbs(SB_NO_INTR);
1193 } while ((g != f) && (g >= 0));
1194 printf("Message printed.\n");
1196 if (rc_alt_semantics && c == 1) {
1199 snprintf(buf, sizeof(buf), "SEEN %ld", msg_arr[a]);
1201 serv_gets(buf); /* Don't need to check this? */
1205 if (((userflags & US_NOPROMPT) || (e == 2))
1206 && (((room_flags & QR_MAILBOX) == 0)
1207 || (rc_force_mail_prompts == 0))) {
1212 color(BRIGHT_WHITE);
1213 printf("%d", num_msgs - a - 1);
1217 keyopt("<B>ack <A>gain <Q>uote <R>eply <N>ext <S>top m<Y> next ");
1218 if (rc_url_cmd[0] && num_urls)
1219 keyopt("<U>RLview ");
1220 keyopt("<?>help -> ");
1224 e = (inkey() & 127);
1226 /* return key same as <N> */ if (e == 13)
1228 /* space key same as <N> */ if (e == 32)
1230 /* del/move for aides only */
1232 && ((room_flags & QR_MAILBOX) ==
1234 if ((e == 'd') || (e == 'm'))
1237 /* print only if available */
1238 if ((e == 'p') && (strlen(printcmd) == 0))
1240 /* can't file if not allowed */
1242 && (rc_allow_attachments == 0))
1244 /* link only if browser avail*/
1246 && (strlen(rc_url_cmd) == 0))
1248 } while ((e != 'a') && (e != 'n') && (e != 's')
1249 && (e != 'd') && (e != 'm') && (e != 'p')
1250 && (e != 'q') && (e != 'b') && (e != 'h')
1251 && (e != 'r') && (e != 'f') && (e != '?')
1252 && (e != 'u') && (e != 'c') && (e != 'y'));
1294 printf("mY next\r");
1297 printf("? <help>\r");
1300 if (userflags & US_DISAPPEAR)
1301 printf("\r%79s\r", "");
1308 printf("Options available here:\n");
1309 printf(" ? Help (prints this message)\n");
1310 printf(" S Stop reading immediately\n");
1311 printf(" A Again (repeats last message)\n");
1312 printf(" N Next (continue with next message)\n");
1313 printf(" Y My Next (continue with next message you authored)\n");
1314 printf(" B Back (go back to previous message)\n");
1316 || (room_flags & QR_MAILBOX)) {
1317 printf(" D Delete this message\n");
1319 (" M Move message to another room\n");
1321 printf(" C Copy message to another room\n");
1322 if (strlen(printcmd) > 0)
1323 printf(" P Print this message\n");
1325 (" Q Quote portions of this message for your next post\n");
1327 (" H Headers (display message headers only)\n");
1329 printf(" R Reply to this message\n");
1330 if (rc_allow_attachments)
1332 (" F (save attachments to a file)\n");
1333 if (strlen(rc_url_cmd) > 0)
1334 printf(" U (list URL's for display)\n");
1339 freopen(prtfile, "w", stdout);
1341 hold_color = enable_color;
1346 freopen(temp2, "w", stdout);
1348 hold_color = enable_color;
1360 newprompt("Enter target room: ",
1361 targ, ROOMNAMELEN - 1);
1362 if (strlen(targ) > 0) {
1363 sprintf(cmd, "MOVE %ld|%s|%d",
1365 (e == 'c' ? 1 : 0));
1368 printf("%s\n", &cmd[4]);
1378 newprompt("Which section? ", filename,
1379 ((sizeof filename) - 1));
1380 snprintf(cmd, sizeof cmd,
1381 "OPNA %ld|%s", msg_arr[a], filename);
1384 if (cmd[0] == '2') {
1385 extract(filename, &cmd[4], 2);
1386 download_to_local_disk(filename,
1387 extract_int(&cmd[4],
1390 printf("%s\n", &cmd[4]);
1394 printf("*** Delete this message? ");
1396 sprintf(cmd, "DELE %ld", msg_arr[a]);
1399 printf("%s\n", &cmd[4]);
1407 read_message(msg_arr[a], READ_HEADER);
1410 savedpos = num_msgs;
1411 entmsg(1, (DEFAULT_ENTRY == 46 ? 2 : 0));
1412 num_msgs = savedpos;
1418 { /* hack hack hack */
1419 /* find the next message by me, stay here if we find nothing */
1422 for (finda = a; ((finda < num_msgs) && (finda >= 0)); finda += rdir)
1424 /* this is repetitivly dumb, but that's what computers are for.
1425 We have to load up messages until we find one by us */
1429 sprintf(buf, "MSG0 %ld|%d", msg_arr[finda], 1); /* read the header so we can get 'from=' */
1432 while (serv_gets(buf), strcmp(buf, "000"))
1434 if ((!strncasecmp(buf, "from=", 5)) && (finda != a)) /* Skip current message. */
1436 if (strcasecmp(buf+5, fullname) == 0)
1438 a = lasta; /* meesa current */
1443 // we are now in synch with the server
1446 lasta = finda; /* keep one behind or we skip on the reentrance to the for */
1450 } /* end for loop */
1451 } /* end read routine */
1457 * View and edit a system message
1459 void edit_system_message(char *which_message)
1465 sprintf(desc, "system message '%s'", which_message);
1466 sprintf(read_cmd, "MESG %s", which_message);
1467 sprintf(write_cmd, "EMSG %s", which_message);
1468 do_edit(desc, read_cmd, "NOOP", write_cmd);
1475 * Verify the message base
1477 void check_message_base(void)
1482 ("Please read the documentation before running this command.\n"
1483 "Having done so, do you still want to check the message base? ");
1489 if (buf[0] != '1') {
1490 printf("%s\n", &buf[4]);
1494 while (serv_gets(buf), strcmp(buf, "000")) {
1495 printf("%s\n", buf);