]> code.citadel.org Git - citadel.git/blobdiff - citadel/textclient/messages.c
Outside of commands.c, calls to ctdl_getline() have been replaced with more appropria...
[citadel.git] / citadel / textclient / messages.c
index e20888f29097636081056310e7231ad5efafb93f..d55d3ba27d73f68104186501c65acda79788c223 100644 (file)
@@ -48,6 +48,7 @@
 #include "citadel_decls.h"
 #include "messages.h"
 #include "commands.h"
+#include "tuiconfig.h"
 #include "rooms.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
@@ -69,14 +70,12 @@ struct cittext {
 
 void stty_ctdl(int cmd);
 int haschar(const char *st, int ch);
-void ctdl_getline(char *string, int lim);
 int file_checksum(char *filename);
 void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax);
 
 unsigned long *msg_arr = NULL;
 int msg_arr_size = 0;
 int num_msgs;
-char rc_alt_semantics;
 extern char room_name[];
 extern char tempdir[];
 extern unsigned room_flags;
@@ -811,14 +810,12 @@ void replace_string(char *filename, long int startpos)
        long msglen = 0L;
        int rv;
 
-       scr_printf("Enter text to be replaced:\n: ");
-       ctdl_getline(srch_str, (sizeof(srch_str)-1) );
+       newprompt("Enter test to be replaced: ", srch_str, (sizeof(srch_str)-1) );
        if (IsEmptyStr(srch_str)) {
                return;
        }
 
-       scr_printf("Enter text to replace it with:\n: ");
-       ctdl_getline(rplc_str, (sizeof(rplc_str)-1) );
+       newprompt("Enter text to replace it with: ", rplc_str, (sizeof(rplc_str)-1) );
 
        fp = fopen(filename, "r+");
        if (fp == NULL) {
@@ -879,21 +876,11 @@ int client_make_message(CtdlIPC *ipc,
        long beg;
        char datestr[SIZ];
        char header[SIZ];
-       char *editor_path = NULL;
        int cksum = 0;
 
-       if (mode >= 2)
-       {
-               if ((mode-2) < MAX_EDITORS && !IsEmptyStr(editor_paths[mode-2]))
-               {
-                       editor_path = editor_paths[mode-2];
-               } else if (!IsEmptyStr(editor_paths[0]))
-               {
-                       editor_path = editor_paths[0];
-               } else {
-                       scr_printf("*** No editor available; using built-in editor.\n");
-                       mode = 0;
-               }
+       if ( (mode == 2) && (IsEmptyStr(editor_path)) ) {
+               scr_printf("*** No editor available; using built-in editor.\n");
+               mode = 0;
        }
 
        fmt_date(datestr, sizeof datestr, time(NULL), 0);
@@ -1225,10 +1212,10 @@ int entmsg(CtdlIPC *ipc,
                        if (is_reply) {
                                strcpy(buf, reply_to);
                        } else {
-                               scr_printf("Enter recipient: ");
-                               ctdl_getline(buf, (SIZ-100) );
-                               if (IsEmptyStr(buf))
+                               newprompt("Enter recipient: ", buf, SIZ-100);
+                               if (IsEmptyStr(buf)) {
                                        return (1);
+                               }
                        }
                } else
                        strcpy(buf, "sysop");
@@ -1365,12 +1352,10 @@ void process_quote(void)
        while (fgets(buf, 128, qfile) != NULL) {
                scr_printf("%3d %s", ++line, buf);
        }
-       scr_printf("Begin quoting at [1] : ");
-       ctdl_getline(buf, 4);
-       qstart = (buf[0] == 0) ? (1) : atoi(buf);
-       scr_printf("  End quoting at [%d] : ", line);
-       ctdl_getline(buf, 4);
-       qend = (buf[0] == 0) ? (line) : atoi(buf);
+
+       qstart = intprompt("Begin quoting at", 1, 1, line);
+       qend = intprompt("  End quoting at", qstart, qstart, line);
+
        rewind(qfile);
        line = 0;
        if (fgets(buf, 128, qfile) == NULL) {
@@ -1659,11 +1644,6 @@ RMSGREAD:
                                } while ((g != f) && (g >= 0));
                        scr_printf("Message printed.\n");
                }
-               if (rc_alt_semantics && c == 1) {
-                       char buf[SIZ];
-
-                       r = CtdlIPCSetMessageSeen(ipc, msg_arr[a], 1, buf);
-               }
                if (e == SIGQUIT)
                        return;
                if (((userflags & US_NOPROMPT) || (e == SIGINT))
@@ -1963,37 +1943,6 @@ void edit_system_message(CtdlIPC *ipc, char *which_message)
 
 
 
-/*
- * Verify the message base
- */
-void check_message_base(CtdlIPC *ipc)
-{
-       char buf[SIZ];
-       char *transcript = NULL;
-       int r;          /* IPC response code */
-
-       scr_printf
-           ("Please read the documentation before running this command.\n"
-           "Having done so, do you still want to check the message base? ");
-       if (yesno() == 0)
-               return;
-
-       r = CtdlIPCMessageBaseCheck(ipc, &transcript, buf);
-       if (r / 100 != 1) {
-               scr_printf("%s\n", buf);
-               return;
-       }
-
-       while (transcript && !IsEmptyStr(transcript)) {
-               extract_token(buf, transcript, 0, '\n', sizeof buf);
-               remove_token(transcript, 0, '\n');
-               scr_printf("%s\n", buf);
-       }
-       if (transcript) free(transcript);
-       return;
-}
-
-
 /*
  * Loads the contents of a file into memory.  Caller must free the allocated
  * memory.