fix dlen
[citadel.git] / textclient / citadel.c
index c5133b40038d16743ce85c667ffe45df2b95b2b0..ba1be6cb3ce5ce958e1fdc893543fbba34ef943a 100644 (file)
@@ -2,13 +2,7 @@
 //
 // Copyright (c) 1987-2022 by the citadel.org team
 //
-// This program is open source software.  Use, duplication, and/or
-// disclosure are subject to the GNU General Purpose License version 3.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// This program is open source software.  Use, duplication, or disclosure is subject to the GNU General Public License version 3.
 
 #include "textclient.h"
 
@@ -38,8 +32,6 @@ int uglistsize = 0;
 char is_mail = 0;              /* nonzero when we're in a mail room */
 char axlevel = AxDeleted;      /* access level */
 char is_room_aide = 0;         /* boolean flag, 1 if room admin */
-int timescalled;
-int posted;
 unsigned userflags;
 long usernum = 0L;             /* user number */
 time_t lastcall = 0L;          /* Date/time of previous login */
@@ -80,12 +72,12 @@ void ctdl_logoff(char *file, int line, CtdlIPC * ipc, int code) {
        }
 
        // Shut down the server connection ... but not if the logoff code is 3,
-       // because that means we're exiting because we already lost the server.
+       // because that means we're exiting because we already lost the server.
        if (code != 3) {
                CtdlIPCQuit(ipc);
        }
 
-       // now clean up various things
+       // now clean up various things
        unlink(temp);
        unlink(temp2);
        nukedir(tempdir);
@@ -144,7 +136,7 @@ void formout(CtdlIPC * ipc, char *name) {
 
 void userlist(CtdlIPC * ipc, char *patn) {
        char buf[SIZ];
-       char fl[26];            // a buffer this small will prevent it overrunning the column
+       char fl[64];            // a buffer this small will prevent it overrunning the column
        struct tm tmbuf;
        time_t lc;
        int r;                  // IPC response code
@@ -156,8 +148,8 @@ void userlist(CtdlIPC * ipc, char *patn) {
                return;
        }
 
-       scr_printf("       User Name           Num  L Last Visit Logins Messages\n");
-       scr_printf("------------------------- ----- - ---------- ------ --------\n");
+       scr_printf("User Name                                                        Last Login\n");
+       scr_printf("---------------------------------------------------------------- ----------\n");
        if (listing != NULL)
                while (!IsEmptyStr(listing)) {
                        extract_token(buf, listing, 0, '\n', sizeof buf);
@@ -166,12 +158,10 @@ void userlist(CtdlIPC * ipc, char *patn) {
                        if (sigcaught == 0) {
                                extract_token(fl, buf, 0, '|', sizeof fl);
                                if (pattern(fl, patn) >= 0) {
-                                       scr_printf("%-25s ", fl);
-                                       scr_printf("%5ld %d ", extract_long(buf, 2), extract_int(buf, 1));
+                                       scr_printf("%-64s ", fl);
                                        lc = extract_long(buf, 3);
                                        localtime_r(&lc, &tmbuf);
-                                       scr_printf("%02d/%02d/%04d ", (tmbuf.tm_mon + 1), tmbuf.tm_mday, (tmbuf.tm_year + 1900));
-                                       scr_printf("%6ld %8ld\n", extract_long(buf, 4), extract_long(buf, 5));
+                                       scr_printf("%02d/%02d/%04d\n", (tmbuf.tm_mon + 1), tmbuf.tm_mday, (tmbuf.tm_year + 1900));
                                }
 
                        }
@@ -185,8 +175,6 @@ void userlist(CtdlIPC * ipc, char *patn) {
 void load_user_info(char *params) {
        extract_token(fullname, params, 0, '|', sizeof fullname);
        axlevel = extract_int(params, 1);
-       timescalled = extract_int(params, 2);
-       posted = extract_int(params, 3);
        userflags = extract_int(params, 4);
        usernum = extract_long(params, 5);
        lastcall = extract_long(params, 6);
@@ -405,29 +393,27 @@ void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) {
                readinfo(ipc);
 
        /* check for newly arrived mail if we can   FIXME use BIFF command for this
-       if (newmailcount > 0) {
-               color(BRIGHT_RED);
-               if (newmailcount == 1) {
-                       scr_printf("*** A new mail message has arrived.\n");
-               }
-               else {
-                       scr_printf("*** %d new mail messages have arrived.\n", newmailcount);
-               }
-               color(DIM_WHITE);
-               if (!IsEmptyStr(rc_gotmail_cmd)) {
-                       rv = system(rc_gotmail_cmd);
-                       if (rv)
-                               scr_printf("*** failed to check for mail calling %s Reason %d.\n", rc_gotmail_cmd, rv);
-               }
-       }
-       */
+          if (newmailcount > 0) {
+          color(BRIGHT_RED);
+          if (newmailcount == 1) {
+          scr_printf("*** A new mail message has arrived.\n");
+          }
+          else {
+          scr_printf("*** %d new mail messages have arrived.\n", newmailcount);
+          }
+          color(DIM_WHITE);
+          if (!IsEmptyStr(rc_gotmail_cmd)) {
+          rv = system(rc_gotmail_cmd);
+          if (rv)
+          scr_printf("*** failed to check for mail calling %s Reason %d.\n", rc_gotmail_cmd, rv);
+          }
+          }
+        */
 
        free(room);
 
        if (screenwidth > 5)
-               snprintf(&status_line[1], screenwidth - 1, "%s  |  %s  |  %s  |  %s  |  %d new mail  |",
-                        (secure ? "Encrypted" : "Unencrypted"),
-                        ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, 0);           // FIXME use BIFF
+               snprintf(&status_line[1], screenwidth - 1, "%s  |  %s  |  %s  |  %s  |  %d new mail  |", (secure ? "Encrypted" : "Unencrypted"), ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, 0);   // FIXME use BIFF
 }
 
 
@@ -828,7 +814,7 @@ void read_config(CtdlIPC * ipc) {
        int r;                  /* IPC response code */
        char _fullname[USERNAME_SIZE];
        long _usernum;
-       int _axlevel, _timescalled, _posted;
+       int _axlevel;
        time_t _lastcall;
        struct ctdluser *user = NULL;
 
@@ -842,8 +828,6 @@ void read_config(CtdlIPC * ipc) {
        _usernum = extract_long(buf, 2);
        _axlevel = extract_int(buf, 3);
        _lastcall = extract_long(buf, 4);
-       _timescalled = extract_int(buf, 5);
-       _posted = extract_int(buf, 6);
        free(resp);
        resp = NULL;
 
@@ -856,10 +840,8 @@ void read_config(CtdlIPC * ipc) {
        }
 
        /* show misc user info */
-       scr_printf("%s\nAccess level: %d (%s)\n"
-                  "User #%ld / %d Calls / %d Posts", _fullname, _axlevel, axdefs[(int) _axlevel], _usernum, _timescalled, _posted);
        if (_lastcall > 0L) {
-               scr_printf(" / Curr login: %s", asctime(localtime(&_lastcall)));
+               scr_printf("Last login: %s", asctime(localtime(&_lastcall)));
        }
        scr_printf("\n");
 
@@ -1049,7 +1031,7 @@ void get_serv_info(CtdlIPC * ipc, char *supplied_hostname) {
        // Indicate to the server that we prefer to decode Base64 and
        // quoted-printable on the client side.
        if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "dont_decode") / 100) != 2) {
-               scr_printf("Error %s:%d", __FILE__ , __LINE__);
+               scr_printf("Error %s:%d", __FILE__, __LINE__);
                logoff(ipc, 0);
        }
 
@@ -1062,7 +1044,7 @@ void get_serv_info(CtdlIPC * ipc, char *supplied_hostname) {
         * the plain text when we have it available.
         */
        if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/plain|text/html|text/x-markdown") / 100) != 2) {
-               scr_printf("Error %s:%d", __FILE__ , __LINE__);
+               scr_printf("Error %s:%d", __FILE__, __LINE__);
                logoff(ipc, 0);
        }
 }
@@ -1561,10 +1543,8 @@ int main(int argc, char **argv) {
        }
 
        color(BRIGHT_WHITE);
-       scr_printf("\n%s\nAccess level: %d (%s)\n"
-                  "User #%ld / Login #%d", fullname, axlevel, axdefs[(int) axlevel], usernum, timescalled);
        if (lastcall > 0L) {
-               scr_printf(" / Last login: %s", asctime(localtime(&lastcall)));
+               scr_printf("Last login: %s", asctime(localtime(&lastcall)));
        }
        scr_printf("\n");