removed node display and network parameters from text client
[citadel.git] / textclient / src / messages.c
index 5b694e85c58543c8d5ace6be545678625e5f84ca..aeb5a4e0035a2a266e037844f3d5bf08e5667e7b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Text client functions for reading and writing of messages
  *
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
 
 #include <stdarg.h>
 #include <libcitadel.h>
-///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "citadel_decls.h"
 #include "messages.h"
 #include "commands.h"
 #include "tuiconfig.h"
 #include "rooms.h"
-//#ifndef HAVE_SNPRINTF
-///#include "snprintf.h"
-//#endif
 #include "screen.h"
 
 #define MAXWORDBUF SIZ
@@ -439,7 +435,7 @@ int read_message(CtdlIPC *ipc,
        FILE *dest) /* Destination file, NULL for screen */
 {
        char buf[SIZ];
-       char now[SIZ];
+       char now[256];
        int format_type = 0;
        int fr = 0;
        int nhdr = 0;
@@ -497,10 +493,10 @@ int read_message(CtdlIPC *ipc,
                if (!IsEmptyStr(message->email)) {
                        scr_printf("rfca=%s\n", message->email);
                }
-               scr_printf("hnod=%s\nroom=%s\nnode=%s\ntime=%s",
-                               message->hnod, message->room,
-                               message->node, 
-                               asctime(localtime(&message->time)));
+               scr_printf("room=%s\ntime=%s",
+                       message->room,
+                       asctime(localtime(&message->time))
+               );
                if (!IsEmptyStr(message->recipient)) {
                        scr_printf("rcpt=%s\n", message->recipient);
                }
@@ -542,7 +538,9 @@ int read_message(CtdlIPC *ipc,
                        scr_printf(" ****");
                }
        } else {
-               fmt_date(now, sizeof now, message->time, 0);
+               struct tm thetime;
+               localtime_r(&message->time, &thetime);
+               strftime(now, sizeof now, "%F %R", &thetime);
                if (dest) {
                        fprintf(dest, "%s from %s ", now, message->author);
                        if (!IsEmptyStr(message->email)) {
@@ -564,35 +562,6 @@ int read_message(CtdlIPC *ipc,
                                scr_printf("> ");
                        }
                }
-               if (!IsEmptyStr(message->node)) {
-                       if ((room_flags & QR_NETWORK)
-                           || ((strcasecmp(message->node, ipc->ServInfo.nodename)
-                            && (strcasecmp(message->node, ipc->ServInfo.fqdn))))) {
-                               if (IsEmptyStr(message->email)) {
-                                       if (dest) {
-                                               fprintf(dest, "@%s ", message->node);
-                                       } else {
-                                               color(DIM_WHITE);
-                                               scr_printf("@");
-                                               color(BRIGHT_YELLOW);
-                                               scr_printf("%s ", message->node);
-                                       }
-                               }
-                       }
-               }
-               if (strcasecmp(message->hnod, ipc->ServInfo.humannode)
-                   && (!IsEmptyStr(message->hnod)) && (IsEmptyStr(message->email))) {
-                       if (dest) {
-                               fprintf(dest, "(%s) ", message->hnod);
-                       } else {
-                               color(DIM_WHITE);
-                               scr_printf("(");
-                               color(BRIGHT_WHITE);
-                               scr_printf("%s", message->hnod);
-                               color(DIM_WHITE);
-                               scr_printf(") ");
-                       }
-               }
                if (strcasecmp(message->room, room_name) && (IsEmptyStr(message->email))) {
                        if (dest) {
                                fprintf(dest, "in %s> ", message->room);
@@ -635,8 +604,7 @@ int read_message(CtdlIPC *ipc,
        /* But if we can't do that, set it to a Citadel address.
         */
        if (!strcmp(reply_to, NO_REPLY_TO)) {
-               snprintf(reply_to, sizeof(reply_to), "%s @ %s",
-                        message->author, message->node);
+               safestrncpy(reply_to, message->author, sizeof(reply_to));
        }
 
        if (message->msgid != NULL) {
@@ -882,7 +850,7 @@ int client_make_message(CtdlIPC *ipc,
        FILE *fp;
        int a, b, e_ex_code;
        long beg;
-       char datestr[SIZ];
+       char datestr[256];
        char header[SIZ];
        int cksum = 0;
 
@@ -891,7 +859,10 @@ int client_make_message(CtdlIPC *ipc,
                mode = 0;
        }
 
-       fmt_date(datestr, sizeof datestr, time(NULL), 0);
+       struct tm thetime;
+       time_t now = time(NULL);
+       localtime_r(&now, &thetime);
+       strftime(datestr, sizeof datestr, "%F %R", &thetime);
        header[0] = 0;
 
        if (room_flags & QR_ANONONLY && !recipient) {
@@ -1210,7 +1181,9 @@ int entmsg(CtdlIPC *ipc,
 
        /* If the user is a dumbass, tell them how to type. */
        if ((userflags & US_EXPERT) == 0) {
-               formout(ipc, "entermsg");
+               scr_printf("Entering message.  Word wrap will give you soft linebreaks.  Pressing the\n");
+               scr_printf("'enter' key will give you a hard linebreak and an indent.  Press 'enter' twice\n");
+               scr_printf("when finished.\n");
        }
 
        /* Handle the selection of a recipient, if necessary. */