Changes to dynloader et al to handle ICQ module being written
authorArt Cancro <ajc@citadel.org>
Sun, 18 Jul 1999 18:53:40 +0000 (18:53 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 18 Jul 1999 18:53:40 +0000 (18:53 +0000)
citadel/ChangeLog
citadel/citserver.c
citadel/citserver.h
citadel/dynloader.c
citadel/serv_chat.c
citadel/serv_chat.h
citadel/server.h

index b563ddaf277934e87451be7dc8ed78a9d5834753..c42b341e9e834d934efa715b445c171f1cdfad32 100644 (file)
@@ -1,3 +1,6 @@
+Sun Jul 18 14:53:16 EDT 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us> 
+       * Changes to dynloader et al to handle ICQ module being written
+
 1999-07-17 Nathan Bryant <bryant@cs.usm.maine.edu>
        * chkpwd.c: DELETED CVS REVISION 1.3 (backed out Art's last change)
          use 'cvs update -r 1.2 chkpwd.c; cvs update -A chkpwd.c' NOW to
index 5543386a978e858280b5d4dfbf719c44d166b23f..45d23b95e9f5c879bd8b6ee8debcb1a97d6182f6 100644 (file)
@@ -41,6 +41,7 @@
 struct CitContext *ContextList = NULL;
 int ScheduledShutdown = 0;
 int do_defrag = 0;
+int (*CtdlSendExpressMessageFunc) (char *, char *, char *) = NULL;
 
 /*
  * Various things that need to be initialized at startup
@@ -1257,6 +1258,9 @@ void *context_loop(struct CitContext *con)
                                    ERROR);
                        }
 
+               /* Run any after-each-command outines registered by modules */
+               PerformSessionHooks(EVT_CMD);
+
                } while(strncasecmp(cmdbuf, "QUIT", 4));
 
        cleanup(EXIT_NORMAL);
index 0db931cb89f6bed47a6338e99c31b533e30d2707..c19e13e14cce75a249ac719383311260764ee0c3 100644 (file)
@@ -29,3 +29,4 @@ void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes);
 int CtdlGetDynamicSymbol(void);
 
 extern int do_defrag;
+int (*CtdlSendExpressMessageFunc) (char *, char *, char *);
index 1f6dab1cd164c956ab981a0492d1775ad5346872..92bae4aa8efde71a47408a4078a9f35e44e3ced9 100644 (file)
 #include <pthread.h>
 #endif
 #include <limits.h>
+#include <ctype.h>
 #include "dynloader.h"
 #include "citadel.h"
 #include "server.h"
 #include "sysdep_decls.h"
+#include "tools.h"
 
 #ifndef HAVE_SNPRINTF
 #include <stdarg.h>
@@ -74,8 +76,9 @@ int DLoader_Exec_Cmd(char *cmdbuf)
 void DLoader_Init(char *pathname)
 {
        void *fcn_handle;
-       const char *dl_error;
+       char dl_error[256];
        DIR *dir;
+       int i;
        struct dirent *dptr;
        struct DLModule_Info *(*h_init_fcn) (void);
        struct DLModule_Info *dl_info;
@@ -89,6 +92,7 @@ void DLoader_Init(char *pathname)
        while ((dptr = readdir(dir)) != NULL) {
                if (dptr->d_name[0] == '.')
                        continue;
+               lprintf(9, "Attempting to load %s\n", dptr->d_name);
 
                snprintf(pathbuf, PATH_MAX, "%s/%s", pathname, dptr->d_name);
 #ifdef RTLD_NOW
@@ -97,8 +101,12 @@ void DLoader_Init(char *pathname)
                if (!(fcn_handle = dlopen(pathbuf, DL_LAZY)))
 #endif
                {
-                       /* dl_error = dlerror(); */
-                       fprintf(stderr, "DLoader_Init dlopen failed\n");
+                       safestrncpy(dl_error, dlerror(), sizeof dl_error);
+                       for (i=0; i<strlen(dl_error); ++i)
+                               if (!isprint(dl_error[i]))
+                                       dl_error[i]='.';
+                       fprintf(stderr, "DLoader_Init dlopen failed: %s\n",
+                               dl_error);
                        continue;
                }
                h_init_fcn = (struct DLModule_Info * (*)(void))
@@ -108,8 +116,8 @@ void DLoader_Init(char *pathname)
                    dlsym(fcn_handle, "_Dynamic_Module_Init");
 #endif
 
-               if ((dl_error = dlerror()) != NULL) {
-                       fprintf(stderr, "DLoader_Init dlsym failed (%s)\n", dl_error);
+               if (dlerror() != NULL) {
+                       fprintf(stderr, "DLoader_Init dlsym failed\n");
                        continue;
                }
                dl_info = h_init_fcn();
index 27c6449386f32c9c5f4f8fbf19a768c316005341..b050b963a101ca80de4ec0e7716233aa11f0540e 100644 (file)
@@ -59,6 +59,8 @@ static struct DLModule_Info info =
 
 struct DLModule_Info *Dynamic_Module_Init(void)
 {
+       CtdlSendExpressMessageFunc = send_express_message;
+
        CtdlRegisterProtoHook(cmd_chat, "CHAT", "Begin real-time chat");
        CtdlRegisterProtoHook(cmd_pexp, "PEXP", "Poll for express messages");
        CtdlRegisterProtoHook(cmd_gexp, "GEXP", "Get express messages");
index 982a184118008545dc4596d9ccca307c86efd5dc..d7fd9847f4fb864b0d74b0b530fa59d94dcbeba8 100644 (file)
@@ -9,3 +9,4 @@ char check_express (void);
 void cmd_sexp (char *argbuf);
 void delete_express_messages(void);
 void cmd_gexp(char *);
+int send_express_message(char *, char *, char *);
index add73474afd142e17e43023d7426e6b7849c5da8..b815334423d3a7fe75d5932189b1f308f9206758 100644 (file)
@@ -224,6 +224,7 @@ extern struct SessionFunctionHook *SessionHookTable;
 #define EVT_NEWROOM    3       /* Changing rooms */
 #define EVT_LOGOUT     4       /* A user is logging out */
 #define EVT_SETPASS    5       /* Setting or changing password */
+#define EVT_CMD                6       /* Called after each server command */
 
 
 /*