]> code.citadel.org Git - citadel.git/blobdiff - citadel/dynloader.c
ICQ changes
[citadel.git] / citadel / dynloader.c
index 4b3b5d9959a19b0d2a61bc8528d0704f33a436ed..2fe4a9e52d47c8cd3d5dd1c303b1359a6f6d5851 100644 (file)
@@ -37,6 +37,7 @@ struct LogFunctionHook *LogHookTable = NULL;
 struct CleanupFunctionHook *CleanupHookTable = NULL;
 struct SessionFunctionHook *SessionHookTable = NULL;
 struct UserFunctionHook *UserHookTable = NULL;
+struct XmsgFunctionHook *XmsgHookTable = NULL;
 
 struct ProtoFunctionHook {
        void (*handler) (char *cmdbuf);
@@ -193,6 +194,21 @@ void CtdlRegisterUserHook(void (*fcn_ptr) (char *, long), int EventType)
 }
 
 
+void CtdlRegisterXmsgHook(int (*fcn_ptr) (char *, char *, char *) )
+{
+
+       struct XmsgFunctionHook *newfcn;
+
+       newfcn = (struct XmsgFunctionHook *)
+           mallok(sizeof(struct XmsgFunctionHook));
+       newfcn->next = XmsgHookTable;
+       newfcn->h_function_pointer = fcn_ptr;
+       XmsgHookTable = newfcn;
+
+       lprintf(5, "Registered a new x-msg function\n");
+}
+
+
 void PerformSessionHooks(int EventType)
 {
        struct SessionFunctionHook *fcn;
@@ -225,3 +241,15 @@ void PerformUserHooks(char *username, long usernum, int EventType)
                }
        }
 }
+
+int PerformXmsgHooks(char *sender, char *recp, char *msg)
+{
+       struct XmsgFunctionHook *fcn;
+       int total_sent = 0;
+
+       for (fcn = XmsgHookTable; fcn != NULL; fcn = fcn->next) {
+               total_sent +=
+                       (*fcn->h_function_pointer) (sender, recp, msg);
+       }
+       return total_sent;
+}