]> code.citadel.org Git - citadel.git/blobdiff - citadel/citadel.c
The encoding and decoding tables for Base64 are
[citadel.git] / citadel / citadel.c
index e9c979adbc91489e818998f93994dd4db53acbfc..4b12583689c1729ce810411a3e21361660726cfd 100644 (file)
 #include <pwd.h>
 #include <stdarg.h>
 #include <errno.h>
-
+#include <libcitadel.h>
 #include "citadel.h"
 #include "citadel_ipc.h"
 #include "axdefs.h"
 #include "routines.h"
 #include "routines2.h"
+#include "tuiconfig.h"
 #include "rooms.h"
 #include "messages.h"
 #include "commands.h"
 #include "client_chat.h"
 #include "client_passwords.h"
 #include "citadel_decls.h"
-#include "tools.h"
 #include "sysdep.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
@@ -52,6 +52,7 @@
 #include "screen.h"
 #include "citadel_dirs.h"
 
+#include "ecrash.h"
 #include "md5.h"
 
 #define IFEXPERT if (userflags&US_EXPERT)
@@ -102,13 +103,30 @@ char curr_floor = 0;              /* number of current floor */
 char floorlist[128][SIZ];      /* names of floors */
 int termn8 = 0;                        /* Set to nonzero to cause a logoff */
 int secure;                    /* Set to nonzero when wire is encrypted */
-int can_do_msg4 = 0;           /* Set to nonzero if the server can handle MSG4 commands */
 
 extern char instant_msgs;      /* instant messages waiting! */
 extern int rc_ansi_color;      /* ansi color value from citadel.rc */
 extern int next_lazy_cmd;
 
 CtdlIPC *ipc_for_signal_handlers;      /* KLUDGE cover your eyes */
+int enable_syslog = 0;
+
+
+/*
+ * lprintf()  ...   Write logging information; 
+ *                  simple here to have the same 
+ *                  symbols in the client.
+ */
+enum LogLevel {CTDL_EMERG};
+
+void lprintf(enum LogLevel loglevel, const char *format, ...) {   
+       va_list arg_ptr;
+
+       va_start(arg_ptr, format);
+       vfprintf(stderr, format, arg_ptr);   
+       va_end(arg_ptr);   
+       fflush(stderr);
+}   
 
 /*
  * here is our 'clean up gracefully and exit' routine
@@ -221,8 +239,8 @@ void userlist(CtdlIPC *ipc, char *patn)
                return;
        }
 
-       pprintf("       User Name           Num  L  LastCall  Calls Posts\n");
-       pprintf("------------------------- ----- - ---------- ----- -----\n");
+       pprintf("       User Name           Num  L Last Visit Logins Messages\n");
+       pprintf("------------------------- ----- - ---------- ------ --------\n");
        if (listing != NULL) while (!IsEmptyStr(listing)) {
                extract_token(buf, listing, 0, '\n', sizeof buf);
                remove_token(listing, 0, '\n');
@@ -239,7 +257,7 @@ void userlist(CtdlIPC *ipc, char *patn)
                               (tmbuf.tm_mon + 1),
                               tmbuf.tm_mday,
                               (tmbuf.tm_year + 1900));
-                       pprintf("%5ld %5ld\n", extract_long(buf, 4), extract_long(buf, 5));
+                       pprintf("%6ld %8ld\n", extract_long(buf, 4), extract_long(buf, 5));
                    }
 
                }
@@ -1006,7 +1024,7 @@ void system_info(CtdlIPC *ipc)
     scr_printf("Connected users %d / Active users %d / Highest message #%ld\n", mrtg_users, mrtg_active_users, mrtg_himessage);
     scr_printf("Server uptime: %s\n", mrtg_server_uptime);
     scr_printf("Your system administrator is %s.\n", ipc->ServInfo.sysadm);
-    scr_printf("Copyright (C)1987-2007 by the Citadel development team\n");
+    scr_printf("Copyright (C)1987-2008 by the Citadel development team\n");
 }
 
 /*
@@ -1134,9 +1152,17 @@ void get_serv_info(CtdlIPC *ipc, char *supplied_hostname)
         * it to the reader's screen width, but since our HTML-to-text parser
         * isn't really all that great, it's probably better to just go with
         * the plain text when we have it available.
+        *
+        * We also indicate to the server that we prefer to decode Base64 and
+        * quoted-printable on the client side.
         */
-       if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/plain|text/html") / 100 )== 2) {
-               can_do_msg4 = 1;
+       if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "dont_decode") / 100 ) != 2) {
+               scr_printf("ERROR: Extremely old server; MSG4 framework not supported.\n");
+               logoff(ipc, 0);
+       }
+       if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/plain|text/html") / 100 ) != 2) {
+               scr_printf("ERROR: Extremely old server; MSG4 framework not supported.\n");
+               logoff(ipc, 0);
        }
 }
 
@@ -1387,10 +1413,29 @@ int main(int argc, char **argv)
        char relhome[PATH_MAX]="";
        char ctdldir[PATH_MAX]=CTDLDIR;
     int lp; 
-
-
-       calc_dirs_n_files(relh, home, relhome, ctdldir);
-       
+#ifdef HAVE_BACKTRACE
+       eCrashParameters params;
+//     eCrashSymbolTable symbol_table;
+#endif
+       calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
+
+#ifdef HAVE_BACKTRACE
+       bzero(&params, sizeof(params));
+       params.filename = file_pid_paniclog;
+//     panic_fd=open(file_pid_paniclog, O_APPEND|O_CREAT|O_DIRECT);
+       params.filep = fopen(file_pid_paniclog, "a+");
+       params.debugLevel = ECRASH_DEBUG_VERBOSE;
+       params.dumpAllThreads = TRUE;
+       params.useBacktraceSymbols = 1;
+///    BuildSymbolTable(&symbol_table);
+//     params.symbolTable = &symbol_table;
+       params.signals[0]=SIGSEGV;
+       params.signals[1]=SIGILL;
+       params.signals[2]=SIGBUS;
+       params.signals[3]=SIGABRT;
+
+       eCrash_Init(&params);
+#endif 
        setIPCDeathHook(screen_delete);
        setIPCErrorPrintf(err_printf);
        setCryptoStatusHook(statusHook);
@@ -2248,6 +2293,14 @@ NEWUSR:  if (IsEmptyStr(rc_password)) {
                         dotknown(ipc, 6, NULL);
                                 break;
 
+                       case 127:           /* Configure POP3 aggregation */
+                               do_pop3client_configuration(ipc);
+                               break;
+
+                       case 128:           /* Configure XML/RSS feed retrieval */
+                               do_rssclient_configuration(ipc);
+                               break;
+
                        default: /* allow some math on the command */
                                /* commands 100... to 100+MAX_EDITORS-1 will
                                   call the appropriate editor... in other
@@ -2287,3 +2340,4 @@ TERMN8:   scr_printf("%s logged out.", fullname);
        goto GSTA;
 
 }      /* end main() */
+