client-move: edits to finish this.
authorWilfried Goesgens <dothebart@citadel.org>
Wed, 18 Jul 2012 14:24:09 +0000 (16:24 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Wed, 18 Jul 2012 14:24:09 +0000 (16:24 +0200)
23 files changed:
citadel/citadel.h
citadel/configure.ac
citadel/include/citadel_dirs.h
citadel/sysconfig.h
citadel/utillib/citadel_dirs.c
libcitadel/lib/libcitadel.h
textclient/Makefile.in
textclient/aclocal.m4
textclient/bootstrap
textclient/debian/rules
textclient/src/citadel.c
textclient/src/citadel_ipc.c
textclient/src/client_chat.c
textclient/src/client_passwords.c
textclient/src/commands.c
textclient/src/include/citadel_ipc.h
textclient/src/ipc_c_tcp.c
textclient/src/messages.c
textclient/src/rooms.c
textclient/src/routines.c
textclient/src/routines2.c
textclient/src/screen.c
textclient/src/tuiconfig.c

index 0d18972200d745a0fec0b9bdd47faa567dee8dd0..87224168af6d7d86cacb5ea62ea0e17f5c44c36b 100644 (file)
@@ -61,12 +61,7 @@ extern "C" {
 
 /* Various length constants */
 
-#define UGLISTLEN      100     /* you get a ungoto list of this size */
 #define ROOMNAMELEN    128     /* The size of a roomname string */
-#define NONCE_SIZE     128     /* Added by <bc> to allow for APOP auth 
-                                * it is BIG becuase there is a hostname
-                                * in the nonce, as per the APOP RFC.
-                                */
                                         
 #define USERNAME_SIZE  64      /* The size of a username string */
 #define MAX_EDITORS    5       /* # of external editors supported */
@@ -202,50 +197,9 @@ struct floor {
 #define NEWREGISTER    0               /* new user to register */
 #define REREGISTER     1               /* existing user reregistering */
 
-#define READ_HEADER    2
-#define READ_MSGBODY   3
-
-/* commands we can send to the stty_ctdl() routine */
-#define SB_NO_INTR     0               /* set to Citadel client mode, i/q disabled */
-#define SB_YES_INTR    1               /* set to Citadel client mode, i/q enabled */
-#define SB_SAVE                2               /* save settings */
-#define SB_RESTORE     3               /* restore settings */
-#define SB_LAST                4               /* redo the last command sent */
-
-#define        NEXT_KEY        15
-#define STOP_KEY       3
-
-/* citadel.rc stuff */
-#define RC_NO          0               /* always no */
-#define RC_YES         1               /* always yes */
-#define RC_DEFAULT     2               /* setting depends on user config */
-
-/* keepalives */
-enum {
-       KA_NO,                          /* no keepalives */
-       KA_YES,                         /* full keepalives */
-       KA_HALF                         /* half keepalives */
-};
-
-/* for <;G>oto and <;S>kip commands */
-#define GF_GOTO                0               /* <;G>oto floor mode */
-#define GF_SKIP                1               /* <;S>kip floor mode */
-#define GF_ZAP         2               /* <;Z>ap floor mode */
-
 /* number of items which may be handled by the CONF command */
 #define NUM_CONFIGS 70
 
-/*
- * MIME types used in Citadel for configuration stuff
- */
-#define SPOOLMIME      "application/x-citadel-delivery-list"
-#define        INTERNETCFG     "application/x-citadel-internet-config"
-#define IGNETCFG       "application/x-citadel-ignet-config"
-#define IGNETMAP       "application/x-citadel-ignet-map"
-#define FILTERLIST     "application/x-citadel-filter-list"
-#define SIEVECONFIG    "application/x-citadel-sieve-config"
-#define XMPPMORTUARY   "application/x-citadel-xmpp-mortuary"
-
 #define TRACE  syslog(LOG_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
 
 #ifndef LONG_MAX
index 943a8457126c660a59878de6cf197153a6b59da2..41c00e0d9d44e212d5c0e1dae7ddd6d4d16b296f 100644 (file)
@@ -247,11 +247,6 @@ fi
 
 AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
 
-
-
-AC_ARG_ENABLE(threaded-client, [  --disable-threaded-client
-                         disable multithreaded client])
-
 AC_ARG_ENABLE(pie, [  --enable-pie            build position-independent executables])
 
 AC_ARG_WITH(pam, [  --with-pam              use PAM if present (see PAM.txt before you try this)])
@@ -284,10 +279,6 @@ else
        test -d /usr/local/BerkeleyDB.4.5 && db_dir=/usr/local/BerkeleyDB.4.5
 fi
 
-dnl By default, we only build the client (citadel and whobbs) unless we can
-dnl figure out how to build with POSIX threads.
-TARGETS=client
-
 AC_CANONICAL_HOST
 PTHREAD_DEFS=-D_REENTRANT
 AC_MSG_CHECKING([how to compile with POSIX threads])
@@ -996,10 +987,7 @@ AC_CACHE_CHECK([for pthread_create], ac_cv_func_pthread_create,
 #endif],
 ac_cv_func_pthread_create=yes, ac_cv_func_pthread_create=no)])
 if test "$ac_cv_func_pthread_create" = yes; then
-       test "$DATABASE" && TARGETS="client server utils"
-       if test "x$enable_threaded_client" != xno; then
-               AC_DEFINE(THREADED_CLIENT, [], [define this if you want to enable the multithreaded client])
-       fi
+       test "$DATABASE" && TARGETS="server utils"
 fi
 
 AC_REPLACE_FUNCS(snprintf getutline)
@@ -1084,7 +1072,6 @@ if test "$abs_srcdir" != "$abs_builddir"; then
    fi
    mkdir -p $abs_builddir/utils
    mkdir -p $abs_builddir/utillib
-   mkdir -p $abs_builddir/textclient
 fi
 
 if test -n "$srcdir"; then 
index 51929cc6376810fe4d11b161d1a0ef36700d66d8..3a0b6d86e38573f630970387cd37c7c2d6417281 100644 (file)
@@ -37,7 +37,6 @@ extern char ctdl_utilbin_dir[PATH_MAX];
 
 /* some of the frequently used files */
 extern char file_citadel_control[PATH_MAX];
-extern char file_citadel_rc[PATH_MAX];
 extern char file_citadel_config[PATH_MAX];
 extern char file_citadel_urlshorteners[PATH_MAX];
 extern char file_lmtp_socket[PATH_MAX];
index 97ecc1dff8e55e3415f1baf08919a485e85e6ff4..a2a00f52b238d9b0e2fdf8f3f5f174b4be7e4e8a 100644 (file)
  */
 #define CHATLOG                "/dev/null"
 
-/* 
- * S_KEEPALIVE is a watchdog timer.  It is used to send "keep
- * alive" messages to the server to prevent the server from assuming the
- * client is dead and terminating the session.  30 seconds is the recommended
- * value; I can't think of any good reason to change it.
- */
-#define S_KEEPALIVE    30
-
 /*
  * Logging level to use if none is specified on the command line.
  * Note that this will suppress messages before they even get to syslog().
index a884179541db2ed2bed371adb2b8f3f31314821a..ff624707408c15484dd1051169705489c714323c 100644 (file)
@@ -65,7 +65,6 @@ char ctdl_bin_dir[PATH_MAX]="";
 
 /* some of our files, that are needed in several places */
 char file_citadel_control[PATH_MAX]="";
-char file_citadel_rc[PATH_MAX]="";
 char file_citadel_config[PATH_MAX]="";
 char file_citadel_urlshorteners[PATH_MAX]="";
 char file_lmtp_socket[PATH_MAX]="";
@@ -233,11 +232,6 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
                         "%scitadel.config",
                         ctdl_autoetc_dir);
        StripSlashes(file_citadel_config, 0);
-       snprintf(file_citadel_rc, 
-                        sizeof file_citadel_rc,
-                        "%scitadel.rc",
-                        ctdl_etc_dir);
-       StripSlashes(file_citadel_rc, 0);
        snprintf(file_citadel_urlshorteners, 
                         sizeof file_citadel_urlshorteners,
                         "%scitadel_urlshorteners.rc",
@@ -356,7 +350,6 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
        DBG_PRINT(ctdl_bin_dir);
        DBG_PRINT(ctdl_utilbin_dir);
        DBG_PRINT(file_citadel_control);
-       DBG_PRINT(file_citadel_rc);
        DBG_PRINT(file_citadel_config);
        DBG_PRINT(file_lmtp_socket);
        DBG_PRINT(file_lmtp_unfiltered_socket);
index 296d1cee50a0de60f1a7bef41184198ce4524931..46b103e41a7a7cdd2330e6fccf54607ff45fa543 100644 (file)
@@ -655,5 +655,108 @@ extern ConstStr RoomNetCfgStrs[maxRoomNetCfg];
 /* a nice consistent place to define how we turn a message id into a thread id hash */
 #define ThreadIdHash(Buf) abs(HashLittle(ChrPtr(Buf), StrLength(Buf)))
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * MIME types used in Citadel for configuration stuff
+ */
+#define SPOOLMIME      "application/x-citadel-delivery-list"
+#define        INTERNETCFG     "application/x-citadel-internet-config"
+#define IGNETCFG       "application/x-citadel-ignet-config"
+#define IGNETMAP       "application/x-citadel-ignet-map"
+#define FILTERLIST     "application/x-citadel-filter-list"
+#define SIEVECONFIG    "application/x-citadel-sieve-config"
+#define XMPPMORTUARY   "application/x-citadel-xmpp-mortuary"
+#define INTERNETCFG     "application/x-citadel-internet-config"
+
+#define LISTING_FOLLOWS                100
+#define CIT_OK                 200
+#define MORE_DATA              300
+#define SEND_LISTING           400
+#define ERROR                  500
+#define BINARY_FOLLOWS         600
+#define SEND_BINARY            700
+#define START_CHAT_MODE                800
+
+#define INTERNAL_ERROR         10
+#define TOO_BIG                        11
+#define ILLEGAL_VALUE          12
+#define NOT_LOGGED_IN          20
+#define CMD_NOT_SUPPORTED      30
+#define SERVER_SHUTTING_DOWN   31
+#define PASSWORD_REQUIRED      40
+#define ALREADY_LOGGED_IN      41
+#define USERNAME_REQUIRED      42
+#define HIGHER_ACCESS_REQUIRED 50
+#define MAX_SESSIONS_EXCEEDED  51
+#define RESOURCE_BUSY          52
+#define RESOURCE_NOT_OPEN      53
+#define NOT_HERE               60
+#define INVALID_FLOOR_OPERATION        61
+#define NO_SUCH_USER           70
+#define FILE_NOT_FOUND         71
+#define ROOM_NOT_FOUND         72
+#define NO_SUCH_SYSTEM         73
+#define ALREADY_EXISTS         74
+#define MESSAGE_NOT_FOUND      75
+
+#define ASYNC_MSG              900
+#define ASYNC_GEXP             02
+
+#define QR_PERMANENT   1               /* Room does not purge              */
+#define QR_INUSE       2               /* Set if in use, clear if avail    */
+#define QR_PRIVATE     4               /* Set for any type of private room */
+#define QR_PASSWORDED  8               /* Set if there's a password too    */
+#define QR_GUESSNAME   16              /* Set if it's a guessname room     */
+#define QR_DIRECTORY   32              /* Directory room                   */
+#define QR_UPLOAD      64              /* Allowed to upload                */
+#define QR_DOWNLOAD    128             /* Allowed to download              */
+#define QR_VISDIR      256             /* Visible directory                */
+#define QR_ANONONLY    512             /* Anonymous-Only room              */
+#define QR_ANONOPT     1024            /* Anonymous-Option room            */
+#define QR_NETWORK     2048            /* Shared network room              */
+#define QR_PREFONLY    4096            /* Preferred status needed to enter */
+#define QR_READONLY    8192            /* Aide status required to post     */
+#define QR_MAILBOX     16384           /* Set if this is a private mailbox */
+
+#define QR2_SYSTEM     1               /* System room; hide by default     */
+#define QR2_SELFLIST   2               /* Self-service mailing list mgmt   */
+#define QR2_COLLABDEL  4               /* Anyone who can post can delete   */
+#define QR2_SUBJECTREQ 8               /* Subject strongly recommended */
+#define QR2_SMTP_PUBLIC        16              /* Listservice Subscribers may post */
+#define QR2_MODERATED  32              /* Listservice aide has to permit posts  */
+
+#define US_NEEDVALID   1               /* User needs to be validated       */
+#define US_EXTEDIT     2               /* Always use external editor       */
+#define US_PERM                4               /* Permanent user                   */
+#define US_LASTOLD     16              /* Print last old message with new  */
+#define US_EXPERT      32              /* Experienced user                 */
+#define US_UNLISTED    64              /* Unlisted userlog entry           */
+#define US_NOPROMPT    128             /* Don't prompt after each message  */
+#define US_PROMPTCTL   256             /* <N>ext & <S>top work at prompt   */
+#define US_DISAPPEAR   512             /* Use "disappearing msg prompts"   */
+#define US_REGIS       1024            /* Registered user                  */
+#define US_PAGINATOR   2048            /* Pause after each screen of text  */
+#define US_INTERNET    4096            /* Internet mail privileges         */
+#define US_FLOORS      8192            /* User wants to see floors         */
+#define US_COLOR       16384           /* User wants ANSI color support    */
+#define US_USER_SET    (US_LASTOLD | US_EXPERT | US_UNLISTED | \
+                       US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | \
+                       US_FLOORS | US_COLOR | US_PROMPTCTL | US_EXTEDIT)
+
+#define UA_KNOWN                2      /* Room appears in a 'known rooms' list */
+#define UA_GOTOALLOWED          4      /* User may goto this room if specified by exact name */
+#define UA_HASNEWMSGS           8      /* Unread messages exist in this room */
+#define UA_ZAPPED               16     /* User has forgotten (zapped) this room */
+#define UA_POSTALLOWED         32      /* User may post top-level messages here */
+#define UA_ADMINALLOWED                64      /* Aide or Room Aide rights exist here */
+#define UA_DELETEALLOWED       128     /* User is allowed to delete messages from this room */
+#define UA_REPLYALLOWED                256     /* User is allowed to reply to existing messages here */
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif // LIBCITADEL_H
index 54203aae40804583af5a31f97ddbb0ee3ae0a283..a10ed3fd487327c52bc523058b6c1e70563ed8d3 100644 (file)
@@ -37,7 +37,7 @@ AUTOCONF=@AUTOCONF@
 chkpwd_LIBS=@chkpwd_LIBS@
 CC=@CC@
 CFLAGS=@CFLAGS@ -I ./include/
-CPPFLAGS=@CPPFLAGS@ -I. -I ./include/
+CPPFLAGS=@CPPFLAGS@ -I. -I ./src/include/
 DATABASE=@DATABASE@
 DEFS=@DEFS@ -DDIFF=\"@DIFF@\" -DPATCH=\"@PATCH@\"
 LDFLAGS=@LDFLAGS@
@@ -70,6 +70,7 @@ SOURCES=src/client_chat.c \
        src/tuiconfig.c \
        src/citadel.c \
        src/citadel_ipc.c \
+       src/ecrash.c \
        src/ipc_c_tcp.c \
        src/screen.c
 
@@ -93,10 +94,11 @@ citadel$(EXEEXT): src/citadel.o  \
        src/routines2.o \
        src/tuiconfig.o \
        src/screen.o \
+       src/ecrash.o \
        src/citadel_ipc.o \
        src/ipc_c_tcp.o \
        $(LIBOBJS)
-       $(CC) citadel.o \
+       $(CC) src/citadel.o \
        src/client_chat.o \
        src/client_passwords.o \
        src/commands.o \
@@ -107,6 +109,7 @@ citadel$(EXEEXT): src/citadel.o  \
        src/routines2.o \
        src/tuiconfig.o \
        src/screen.o \
+       src/ecrash.o \
        src/citadel_ipc.o \
        src/ipc_c_tcp.o \
        $(LIBOBJS) \
index 56e89469e4f3265c4fd941720e6f023d9074c88c..899da07b892bf3ce64d9c6b2ee9f5fd58a659429 100644 (file)
@@ -110,3 +110,4 @@ else
 fi
 ])
 
+m4_include([acinclude.m4])
index 636a4b1687313a320736e6cdd3aac72894acc1a4..9f4f846431a5cc1e750ff654927644968663a49d 100755 (executable)
@@ -22,9 +22,6 @@ autoheader
 echo ... running mk_svn_revision.sh ...
 ./scripts/mk_svn_revision.sh
 
-echo ... running mk_module_init.sh ...
-./scripts/mk_module_init.sh
-
 echo
 echo This script has been tested with autoconf 2.53 and
 echo automake 1.5. Other versions may work, but we recommend
index 7e8178d205b4add927b2bad4d9bf171e678b0585..7cb8f65d955c5f9751731d60387ebbd0b246b9dd 100755 (executable)
@@ -125,15 +125,6 @@ install-arch: build-arch
        $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
        $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
 
-       install -D -p -m0755 database_cleanup.sh \
-               $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
-
-       install -D -p -m0644 docs/welcomemail.html \
-               $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
-
-       install -D -p -m0644 docs/welcomemail.txt \
-               $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
-
        dh_install -s --sourcedir=debian/tmp
 
 binary-common:
index 5821df40413c8b86f7fd7e85ebf8c66a5235aa96..3b958891e5874983b54521467d1f00cca6b3780b 100644 (file)
@@ -41,9 +41,9 @@
 #include <stdarg.h>
 #include <errno.h>
 #include <libcitadel.h>
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
-#include "axdefs.h"
+//#include "axdefs.h"
 #include "routines.h"
 #include "routines2.h"
 #include "tuiconfig.h"
@@ -58,7 +58,7 @@
 #include "snprintf.h"
 #endif
 #include "screen.h"
-#include "citadel_dirs.h"
+///#include "citadel_dirs.h"
 
 #include "ecrash.h"
 #include "md5.h"
@@ -1005,8 +1005,8 @@ void system_info(CtdlIPC *ipc)
        CtdlIPCServerInfo(ipc, buf);
 
        scr_printf("You are connected to %s (%s) @%s\n", ipc->ServInfo.nodename, ipc->ServInfo.humannode, ipc->ServInfo.fqdn);
-       scr_printf("running %s with text client v%.2f,\n", ipc->ServInfo.software, (float)REV_LEVEL/100);
-       scr_printf("server build %s,\n", ipc->ServInfo.svn_revision, (float)REV_LEVEL/100);
+       scr_printf("running %s with text client v%.2f,\n", ipc->ServInfo.software, (float)CLIENT_VERSION/100);
+       scr_printf("server build %s,\n", ipc->ServInfo.svn_revision, (float)CLIENT_VERSION/100);
     scr_printf("and located in %s.\n", ipc->ServInfo.site_location);
     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);
@@ -1101,8 +1101,8 @@ void get_serv_info(CtdlIPC *ipc, char *supplied_hostname)
        moreprompt = ipc->ServInfo.moreprompt;
 
        /* be nice and identify ourself to the server */
-       CtdlIPCIdentifySoftware(ipc, SERVER_TYPE, 0, REV_LEVEL,
-                (ipc->isLocal ? "local" : CITADEL),
+       CtdlIPCIdentifySoftware(ipc, CLIENT_TYPE, 0, CLIENT_VERSION,
+                (ipc->isLocal ? "local" : PACKAGE_STRING),
                 (supplied_hostname) ? supplied_hostname : 
                 /* Look up the , in the bible if you're confused */
                 (locate_host(ipc, buf), buf), buf);
@@ -1419,9 +1419,9 @@ int main(int argc, char **argv)
 
 #ifdef HAVE_BACKTRACE
        bzero(&params, sizeof(params));
-       params.filename = file_pid_paniclog;
+//     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.filep = fopen(file_pid_paniclog, "a+");
        params.debugLevel = ECRASH_DEBUG_VERBOSE;
        params.dumpAllThreads = TRUE;
        params.useBacktraceSymbols = 1;
@@ -1432,7 +1432,7 @@ int main(int argc, char **argv)
        params.signals[2]=SIGBUS;
        params.signals[3]=SIGABRT;
 
-       eCrash_Init(&params);
+///    eCrash_Init(&params);
 #endif 
        setIPCErrorPrintf(scr_printf);
        setCryptoStatusHook(statusHook);
index 15e860a4bb57894592a842622ac6dcd7908be822..8a65f85d92c92d92f0d9006c24f3cef0dba69789 100644 (file)
 #include <pthread.h>
 #endif
 #include <libcitadel.h>
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
-#include "citadel_decls.h"
-#include "citadel_dirs.h"
+//#include "citadel_decls.h"
+//#include "citadel_dirs.h"
 #ifdef THREADED_CLIENT
 pthread_mutex_t rwlock;
 #endif
@@ -63,6 +63,135 @@ pthread_mutex_t **Critters;                 /* Things that need locking */
 #endif
 
 static void (*status_hook)(char *s) = NULL;
+char ctdl_autoetc_dir[PATH_MAX]="";
+char file_citadel_rc[PATH_MAX]="";
+char ctdl_run_dir[PATH_MAX]="";
+char ctdl_etc_dir[PATH_MAX]="";
+char ctdl_home_directory[PATH_MAX] = "";
+char file_citadel_socket[PATH_MAX]="";
+char file_citadel_config[PATH_MAX]="";
+
+
+char *viewdefs[]={
+        "Messages",
+        "Summary",
+        "Address book",
+        "Calendar",
+        "Tasks"
+};
+
+char *axdefs[]={
+        "Deleted",
+        "New User",
+        "Problem User",
+        "Local User",
+        "Network User",
+        "Preferred User",
+        "Aide",
+        "Sysop"
+        };
+
+
+INLINE void CtdlIPC_lock(CtdlIPC *ipc)
+{
+       if (ipc->network_status_cb) ipc->network_status_cb(1);
+#ifdef THREADED_CLIENT
+       pthread_mutex_lock(&(ipc->mutex));
+#endif
+}
+
+
+INLINE void CtdlIPC_unlock(CtdlIPC *ipc)
+{
+#ifdef THREADED_CLIENT
+       pthread_mutex_unlock(&(ipc->mutex));
+#endif
+       if (ipc->network_status_cb) ipc->network_status_cb(0);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+char *libcitadelclient_version_string(void) {
+        return "libcitadelclient(unnumbered)";
+}
+
+
+
+
+#define COMPUTE_DIRECTORY(SUBDIR) memcpy(dirbuffer,SUBDIR, sizeof dirbuffer);\
+       snprintf(SUBDIR,sizeof SUBDIR,  "%s%s%s%s%s%s%s", \
+                        (home&!relh)?ctdl_home_directory:basedir, \
+             ((basedir!=ctdldir)&(home&!relh))?basedir:"/", \
+             ((basedir!=ctdldir)&(home&!relh))?"/":"", \
+                        relhome, \
+             (relhome[0]!='\0')?"/":"",\
+                        dirbuffer,\
+                        (dirbuffer[0]!='\0')?"/":"");
+
+#define DBG_PRINT(A) if (dbg==1) fprintf (stderr,"%s : %s \n", #A, A)
+
+
+void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir, int dbg)
+{
+       const char* basedir = "";
+       char dirbuffer[PATH_MAX] = "";
+
+       StripSlashes(ctdldir, 1);
+
+#ifndef HAVE_RUN_DIR
+       basedir=ctdldir;
+#else
+       basedir=RUN_DIR;
+#endif
+       COMPUTE_DIRECTORY(ctdl_run_dir);
+       StripSlashes(ctdl_run_dir, 1);
+
+
+#ifndef HAVE_AUTO_ETC_DIR
+       basedir=ctdldir;
+#else
+       basedir=AUTO_ETC_DIR;
+#endif
+       COMPUTE_DIRECTORY(ctdl_autoetc_dir);
+       StripSlashes(ctdl_autoetc_dir, 1);
+
+
+#ifndef HAVE_ETC_DIR
+       basedir=ctdldir;
+#else
+       basedir=ETC_DIR;
+#endif
+       COMPUTE_DIRECTORY(ctdl_etc_dir);
+       StripSlashes(ctdl_etc_dir, 1);
+
+
+
+       snprintf(file_citadel_rc, 
+                        sizeof file_citadel_rc,
+                        "%scitadel.rc",
+                        ctdl_etc_dir);
+       StripSlashes(file_citadel_rc, 0);
+
+       snprintf(file_citadel_socket, 
+                        sizeof file_citadel_socket,
+                               "%scitadel.socket",
+                        ctdl_run_dir);
+       StripSlashes(file_citadel_socket, 0);
+
+       snprintf(file_citadel_config, 
+                        sizeof file_citadel_config,
+                        "%scitadel.config",
+                        ctdl_autoetc_dir);
+       StripSlashes(file_citadel_config, 0);
+
+       DBG_PRINT(ctdl_run_dir);
+       DBG_PRINT(file_citadel_socket);
+       DBG_PRINT(ctdl_etc_dir);
+       DBG_PRINT(file_citadel_rc);
+}
 
 void setCryptoStatusHook(void (*hook)(char *s)) {
        status_hook = hook;
@@ -1545,7 +1674,7 @@ int CtdlIPCIdentifySoftware(CtdlIPC *ipc, int developerid, int clientid,
            !software_name) {
                developerid = 8;
                clientid = 0;
-               revision = REV_LEVEL - 600;
+               revision = CLIENT_VERSION - 600;
                software_name = "Citadel (libcitadel)";
        }
        if (!hostname) return -2;
index 760ce5934abb7880c36d45c38dff2e0c537b3943..29f3e267da0f6118a6b423b8620b78e344935593 100644 (file)
@@ -39,7 +39,7 @@
 #endif
 #include <stdarg.h>
 #include <libcitadel.h>
-#include "citadel.h"
+//#include "citadel.h"
 #include "citadel_ipc.h"
 #include "client_chat.h"
 #include "commands.h"
@@ -47,9 +47,9 @@
 #include "citadel_decls.h"
 #include "rooms.h"
 #include "messages.h"
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
+//#ifndef HAVE_SNPRINTF
+//#include "snprintf.h"
+//#endif
 #include "screen.h"
 
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
index aabb7d9182e6e65cfbecc6fc28f0bbe6a6f27875..3e864a41a3328d509e3d04b8258289202c86aa5d 100644 (file)
@@ -24,7 +24,7 @@
 #include <limits.h>
 #include <stdio.h>
 #include <libcitadel.h>
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "commands.h"
 #include "client_passwords.h"
index 426849a95f3091f61eaaa7c2994163b2819d3287..4fe088316685f4eaeb22d26bda1542a82ab13253 100644 (file)
@@ -51,7 +51,7 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <libcitadel.h>
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "commands.h"
 #include "messages.h"
 #include "routines2.h"
 #include "rooms.h"
 #include "client_chat.h"
-#include "citadel_dirs.h"
+////#include "citadel_dirs.h"
 #include "tuiconfig.h"
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
+//#ifndef HAVE_SNPRINTF
+//#include "snprintf.h"
+///#endif
 #include "screen.h"
 #include "ecrash.h"
 
index c67cfd310d303233d8f66cff2003152c1d9bedbd..1236743b24e606ca61d9dc6de089c091197c64e3 100644 (file)
@@ -1,3 +1,8 @@
+#ifdef __GNUC__
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
 
 #define        UDS                     "_UDS_"
 #ifdef __CYGWIN__
@@ -7,7 +12,9 @@
 #endif
 #define DEFAULT_PORT           "504"
 
-#include "sysdep.h"
+#include <libcitadel.h>
+#include <limits.h>
+////#include "sysdep.h"
 #ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
 #include <openssl/rand.h>
 #endif
 
-#include "server.h"
+#define CLIENT_VERSION          811
+#define CLIENT_TYPE               0
+//copycat of: /#include "server.h"
+
+#define ROOMNAMELEN    128     /* The size of a roomname string */
+
+// copycat of citadel_dirs.h
+void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir, int dbg);
+
+//copycat of: /#include "citadel.h"
+/* commands we can send to the stty_ctdl() routine */
+#define SB_NO_INTR      0               /* set to Citadel client mode, i/q disabled */
+#define SB_YES_INTR     1               /* set to Citadel client mode, i/q enabled */
+#define SB_SAVE         2               /* save settings */
+#define SB_RESTORE      3               /* restore settings */
+#define SB_LAST         4               /* redo the last command sent */
+
+#define UGLISTLEN      100     /* you get a ungoto list of this size */
+
+#define USERNAME_SIZE   64      /* The size of a username string */
+#define MAX_EDITORS     5       /* # of external editors supported */
+                                /* MUST be at least 1 */
+
+#define NONCE_SIZE     128     /* Added by <bc> to allow for APOP auth 
+                                * it is BIG becuase there is a hostname
+                                * in the nonce, as per the APOP RFC.
+                                */
+
+/* 
+ * S_KEEPALIVE is a watchdog timer.  It is used to send "keep
+ * alive" messages to the server to prevent the server from assuming the
+ * client is dead and terminating the session.  30 seconds is the recommended
+ * value; I can't think of any good reason to change it.
+ */
+#define S_KEEPALIVE    30
+
+#define READ_HEADER    2
+#define READ_MSGBODY   3
+
+#define NUM_CONFIGS 70
+
+
+
+/*
+ * This struct stores a list of rooms with new messages which the client
+ * fetches from the server.  This allows the client to "march" through
+ * relevant rooms without having to ask the server each time where to go next.
+ */
+typedef struct ExpirePolicy ExpirePolicy;
+struct ExpirePolicy {
+       int expire_mode;
+       int expire_value;
+};
+
+typedef struct march march;
+struct march {
+       struct march *next;
+       char march_name[ROOMNAMELEN];
+       unsigned int march_flags;
+       char march_floor;
+       char march_order;
+       unsigned int march_flags2;
+       int march_access;
+};
+/*
+ * User records.
+ */
+typedef struct ctdluser ctdluser;
+struct ctdluser {                      /* User record                      */
+       int version;                    /* Cit vers. which created this rec  */
+       uid_t uid;                      /* Associate with a unix account?    */
+       char password[32];              /* password                          */
+       unsigned flags;                 /* See US_ flags below               */
+       long timescalled;               /* Total number of logins            */
+       long posted;                    /* Number of messages ever submitted */
+       uint8_t axlevel;                /* Access level                      */
+       long usernum;                   /* User number (never recycled)      */
+       time_t lastcall;                /* Date/time of most recent login    */
+       int USuserpurge;                /* Purge time (in days) for user     */
+       char fullname[64];              /* Display name (primary identifier) */
+};
+typedef struct ctdlroom ctdlroom;
+struct ctdlroom {
+       char QRname[ROOMNAMELEN];       /* Name of room                     */
+       char QRpasswd[10];              /* Only valid if it's a private rm  */
+       long QRroomaide;                /* User number of room aide         */
+       long QRhighest;                 /* Highest message NUMBER in room   */
+       time_t QRgen;                   /* Generation number of room        */
+       unsigned QRflags;               /* See flag values below            */
+       char QRdirname[15];             /* Directory name, if applicable    */
+       long QRinfo;                    /* Info file update relative to msgs*/
+       char QRfloor;                   /* Which floor this room is on      */
+       time_t QRmtime;                 /* Date/time of last post           */
+       struct ExpirePolicy QRep;       /* Message expiration policy        */
+       long QRnumber;                  /* Globally unique room number      */
+       char QRorder;                   /* Sort key for room listing order  */
+       unsigned QRflags2;              /* Additional flags                 */
+       int QRdefaultview;              /* How to display the contents      */
+};
+
+
+/////////////
 
 #ifdef __cplusplus
 extern "C" {
@@ -190,6 +298,8 @@ enum MessageDirection {
        ReadReverse = -1,
        ReadForward = 1
 };
+extern char file_citadel_rc[PATH_MAX];
+extern char file_citadel_config[PATH_MAX];
 
 /* Shared Diffie-Hellman parameters */
 #define DH_P           "F6E33BD70D475906ABCFB368DA2D1E5611D57DFDAC6A10CD78F406D6952519C74E21FFDCC5A780B9359722AACC8036E4CD24D5F5165EAC9EF226DBD9BBCF678F8DDEE86386F1BC20E291A9854A513A2CA326B411DC92E38F2ED2FEB6A3B792F13DB6550371FDBAC5ECA373BE5050CA4905431CA86088737D52B36C8D13CE9CB4EEF4C910285035E8329DD07551A80B87775676DD1067395CCEE9040C9B8BF998C528B3772B4C590A2CF18C5E58929BFCB538A62638B7437A9C68572D15287E97692B0B1EC5444D9DAB6EB062D20B79CA005EC5035065567AFD1FEF9B251D74747C6065D8C8B6B0862D1EE03F3A244C429EADE0CCC5C3A4196F5CBF5AA01A9026EFB20AA90E462BD64620278F271905EB604F38E6CFAE412EAA6C468E3B58170909BC18662FE2053224F30BE4FDB93BF9FBF969D91A5427A0665AC7BD1C43701B991094C92F7A935063055617142164F02973EB4ED86DD74D2BBAB3CD3B28F7BBD8D9F925B0FE92F7F7D0568D783F9ECE7AF96FB5AF274B586924B64639733A73ACA8F2BD1E970DF51ADDD983F7F6361A2B0DC4F086DE26D8656EC8813DE4B74D6D57BC1E690AC2FF1682B7E16938565A41D1DC64C75ADB81DA4582613FC68C0FDD327D35E2CDF20D009465303773EF3870FBDB0985EE7002A95D7912BBCC78187C29DB046763B7FABFF44EABE820F8ED0D7230AA0AF24F428F82448345BC099B"
@@ -366,23 +476,43 @@ char CtdlIPC_get(CtdlIPC* ipc);
 
 
 
-static INLINE void CtdlIPC_lock(CtdlIPC *ipc)
-{
-       if (ipc->network_status_cb) ipc->network_status_cb(1);
-#ifdef THREADED_CLIENT
-       pthread_mutex_lock(&(ipc->mutex));
-#endif
-}
+INLINE void CtdlIPC_lock(CtdlIPC *ipc);
 
+INLINE void CtdlIPC_unlock(CtdlIPC *ipc);
 
-static INLINE void CtdlIPC_unlock(CtdlIPC *ipc)
-{
-#ifdef THREADED_CLIENT
-       pthread_mutex_unlock(&(ipc->mutex));
-#endif
-       if (ipc->network_status_cb) ipc->network_status_cb(0);
-}
+char *libcitadelclient_version_string(void);
 
-#ifdef __cplusplus
-}
+/* commands we can send to the stty_ctdl() routine */
+#define SB_NO_INTR     0               /* set to Citadel client mode, i/q disabled */
+#define SB_YES_INTR    1               /* set to Citadel client mode, i/q enabled */
+#define SB_SAVE                2               /* save settings */
+#define SB_RESTORE     3               /* restore settings */
+#define SB_LAST                4               /* redo the last command sent */
+
+#define        NEXT_KEY        15
+#define STOP_KEY       3
+
+/* citadel.rc stuff */
+#define RC_NO          0               /* always no */
+#define RC_YES         1               /* always yes */
+#define RC_DEFAULT     2               /* setting depends on user config */
+
+/* keepalives */
+enum {
+       KA_NO,                          /* no keepalives */
+       KA_YES,                         /* full keepalives */
+       KA_HALF                         /* half keepalives */
+};
+
+/* for <;G>oto and <;S>kip commands */
+#define GF_GOTO                0               /* <;G>oto floor mode */
+#define GF_SKIP                1               /* <;S>kip floor mode */
+#define GF_ZAP         2               /* <;Z>ap floor mode */
+
+
+#ifndef AXDEFS
+
+extern char *axdefs[];
+
+extern char *viewdefs[];
 #endif
index a6cae96c7335bc297006b518e7a7687caa27365b..d87cdf5b7157dd9e9748c20b9f1d74d6e6e45252 100644 (file)
 #include <errno.h>
 #include <stdarg.h>
 #include <libcitadel.h>
-#include "citadel.h"
+//#include "citadel.h"
 #include "citadel_ipc.h"
-#include "citadel_decls.h"
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
+//#include "citadel_decls.h"
+//#ifndef HAVE_SNPRINTF
+//#include "snprintf.h"
+//#endif
 #include "commands.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+#include <sys/types.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#else
+#include <sgtty.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 
 /* Note that some of these functions may not work with multiple instances. */
 
index 6cc8f6a6f09017a81c321a9bbce98601d599afc8..66299f30be3e43b50df016397bf398c221fcf93a 100644 (file)
 
 #include <stdarg.h>
 #include <libcitadel.h>
-#include "citadel.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
+//#ifndef HAVE_SNPRINTF
+///#include "snprintf.h"
+//#endif
 #include "screen.h"
 
 #define MAXWORDBUF SIZ
index 6dcc99bb6c5e5bda365dd2116f5d109c4b450c8d..732661e5783b8568a4941c8d6a65509f78f87b78 100644 (file)
 #include <errno.h>
 #include <stdarg.h>
 #include <libcitadel.h>
-#include "citadel.h"
+//#include "citadel.h"
 #include "citadel_ipc.h"
 #include "citadel_decls.h"
 #include "rooms.h"
 #include "commands.h"
 #include "messages.h"
 #include "tuiconfig.h"
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
+//#ifndef HAVE_SNPRINTF
+//#include "snprintf.h"
+//#endif
 #include "screen.h"
-#include "citadel_dirs.h"
+//#include "citadel_dirs.h"
 
 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
 
index f7261ee2dd326db782f19cd90b7a1694f830f384..33e05c81a5cc0758bd0146c7e5f7ea4bdf942beb 100644 (file)
@@ -48,7 +48,7 @@
 #endif
 
 #include <libcitadel.h>
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "screen.h"
 
@@ -58,7 +58,7 @@ struct utmp *getutline(struct utmp *ut);
 
 #define ROUTINES_C
 
-#include "citadel.h"
+///#include "citadel.h"
 #include "routines.h"
 #include "commands.h"
 #include "citadel_decls.h"
index afe38dbb909786ad325919156ec64b79cb811bb1..32ec9fc016d0053c74381fc787e6f17d876d4ac9 100644 (file)
 #include <stdarg.h>
 #include <libcitadel.h>
 #include "sysdep.h"
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "citadel_decls.h"
 #include "routines2.h"
 #include "routines.h"
 #include "commands.h"
-#include "messages.h"
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
+//#include "messages.h"
+//#ifndef HAVE_SNPRINTF
+//#include "snprintf.h"
+//#endif
 #include "screen.h"
 
 /* work around solaris include files */
index 6bcc4b5f8a05d2a5b573b010dc6f09b21919258d..4144c240413d254e0226857c214d85a271c325f5 100644 (file)
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include "sysdep.h"
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
+///#ifndef HAVE_SNPRINTF
+///#include "snprintf.h"
+///#endif
 #include <libcitadel.h>
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "citadel_decls.h"
 #include "commands.h"
index 3ec778329a6353b9e499dd97f99416086a558db9..254f4e6bca7f3242129bf76a4ba8be6e818f2857 100644 (file)
 #include <stdarg.h>
 #include <libcitadel.h>
 #include "sysdep.h"
-#include "citadel.h"
+///#include "citadel.h"
 #include "citadel_ipc.h"
 #include "citadel_decls.h"
 #include "tuiconfig.h"
 #include "messages.h"
 #include "routines.h"
 #include "commands.h"
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
+///#ifndef HAVE_SNPRINTF
+///#include "snprintf.h"
+///#endif
 #include "screen.h"
 
 /* work around solaris include files */