]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_extensions.c
* initiall sieve listing support. authentication works now, we at least answer with...
[citadel.git] / citadel / serv_extensions.c
index e5cf68524315533a7c25f154660bee8f915005eb..cb0618a61cdee24d3affd39ed8a2b499c30ce3af 100644 (file)
@@ -36,6 +36,7 @@ struct MessageFunctionHook *MessageHookTable = NULL;
 struct NetprocFunctionHook *NetprocHookTable = NULL;
 struct DeleteFunctionHook *DeleteHookTable = NULL;
 struct ServiceFunctionHook *ServiceHookTable = NULL;
+struct FixedOutputHook *FixedOutputTable = NULL;
 
 struct ProtoFunctionHook {
        void (*handler) (char *cmdbuf);
@@ -108,6 +109,7 @@ void initialize_server_extensions(void)
        lprintf(CTDL_INFO, "%s\n", serv_chat_init());
        lprintf(CTDL_INFO, "%s\n", serv_expire_init());
        lprintf(CTDL_INFO, "%s\n", serv_imap_init());
+       lprintf(CTDL_INFO, "%s\n", serv_upgrade_init());
        lprintf(CTDL_INFO, "%s\n", serv_inetcfg_init());
        lprintf(CTDL_INFO, "%s\n", serv_listsub_init());
        lprintf(CTDL_INFO, "%s\n", serv_mrtg_init());
@@ -120,11 +122,12 @@ void initialize_server_extensions(void)
        lprintf(CTDL_INFO, "%s\n", serv_smtp_init());
        lprintf(CTDL_INFO, "%s\n", serv_spam_init());
        /* lprintf(CTDL_INFO, "%s\n", serv_test_init()); */
-       lprintf(CTDL_INFO, "%s\n", serv_upgrade_init());
        lprintf(CTDL_INFO, "%s\n", serv_vandelay_init());
        lprintf(CTDL_INFO, "%s\n", serv_vcard_init());
        lprintf(CTDL_INFO, "%s\n", serv_fulltext_init());
        lprintf(CTDL_INFO, "%s\n", serv_autocompletion_init());
+       lprintf(CTDL_INFO, "%s\n", serv_postfix_tcpdict());
+       lprintf(CTDL_INFO, "%s\n", serv_managesieve_init());
 }
 
 
@@ -351,6 +354,59 @@ void CtdlUnregisterDeleteHook(void (*handler)(char *, long) )
 }
 
 
+
+
+void CtdlRegisterFixedOutputHook(char *content_type, void (*handler)(char *, int) )
+{
+       struct FixedOutputHook *newfcn;
+
+       newfcn = (struct FixedOutputHook *)
+           malloc(sizeof(struct FixedOutputHook));
+       newfcn->next = FixedOutputTable;
+       newfcn->h_function_pointer = handler;
+       safestrncpy(newfcn->content_type, content_type, sizeof newfcn->content_type);
+       FixedOutputTable = newfcn;
+
+       lprintf(CTDL_INFO, "Registered a new fixed output function for %s\n", newfcn->content_type);
+}
+
+
+void CtdlUnregisterFixedOutputHook(char *content_type)
+{
+       struct FixedOutputHook *cur, *p;
+
+       for (cur = FixedOutputTable; cur != NULL; cur = cur->next) {
+               /* This will also remove duplicates if any */
+               while (cur != NULL && (!strcasecmp(content_type, cur->content_type))) {
+                       lprintf(CTDL_INFO, "Unregistered fixed output function for %s\n", content_type);
+                       p = cur->next;
+                       if (cur == FixedOutputTable) {
+                               FixedOutputTable = p;
+                       }
+                       free(cur);
+                       cur = p;
+               }
+       }
+}
+
+/* returns nonzero if we found a hook and used it */
+int PerformFixedOutputHooks(char *content_type, char *content, int content_length)
+{
+       struct FixedOutputHook *fcn;
+
+       for (fcn = FixedOutputTable; fcn != NULL; fcn = fcn->next) {
+               if (!strcasecmp(content_type, fcn->content_type)) {
+                       (*fcn->h_function_pointer) (content, content_length);
+                       return(1);
+               }
+       }
+       return(0);
+}
+
+
+
+
+
 void CtdlRegisterXmsgHook(int (*fcn_ptr) (char *, char *, char *), int order)
 {
 
@@ -556,6 +612,8 @@ void PerformDeleteHooks(char *room, long msgnum)
 
 
 
+
+
 int PerformXmsgHooks(char *sender, char *recp, char *msg)
 {
        struct XmsgFunctionHook *fcn;