X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fserv_extensions.c;h=f81008464df5247f96343d9335b11a2936414e88;hb=a520d904d0069654c57d2b69618bee1225ee3067;hp=73a1b7911094dc48858a5cf95b5d2c824c1fcee5;hpb=45fc293fa4f3071711a67c85b1337e5b1eebea23;p=citadel.git diff --git a/citadel/serv_extensions.c b/citadel/serv_extensions.c index 73a1b7911..f81008464 100644 --- a/citadel/serv_extensions.c +++ b/citadel/serv_extensions.c @@ -2,7 +2,7 @@ * Citadel Extension Loader * Originally written by Brian Costello * - * Copyright (c) 1987-2019 by the citadel.org team + * Copyright (c) 1987-2021 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 3. @@ -110,7 +110,7 @@ XmsgFunctionHook *XmsgHookTable = NULL; /* * RoomFunctionHook extensions are used for hooks which impliment room - * processing functions when new messages are added EG. SIEVE. + * processing functions when new messages are added. */ typedef struct RoomFunctionHook RoomFunctionHook; struct RoomFunctionHook { @@ -128,9 +128,6 @@ struct SearchFunctionHook { }; SearchFunctionHook *SearchFunctionHookTable = NULL; -CleanupFunctionHook *CleanupHookTable = NULL; -CleanupFunctionHook *EVCleanupHookTable = NULL; - ServiceFunctionHook *ServiceHookTable = NULL; typedef struct ProtoFunctionHook ProtoFunctionHook; @@ -211,8 +208,8 @@ void LogPrintMessages(long err) StrBufAppendBufPlain(Message, HKEY("\n\n"), 0); StrBufAppendBufPlain(Message, CKEY(ErrGeneral[3]), 0); - syslog(LOG_EMERG, "extensions: %s", ChrPtr(Message)); - syslog(LOG_EMERG, "extensions: %s", ErrSubject); + syslog(LOG_ERR, "extensions: %s", ChrPtr(Message)); + syslog(LOG_ERR, "extensions: %s", ErrSubject); quickie_message("Citadel", NULL, NULL, AIDEROOM, ChrPtr(Message), FMT_FIXED, ErrSubject); FreeStrBuf(&Message); @@ -277,134 +274,6 @@ void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc) syslog(LOG_DEBUG, "extensions: registered server command %s (%s)", cmd, desc); } -void CtdlDestroyProtoHooks(void) -{ - - DeleteHash(&ProtoHookList); -} - - -void CtdlRegisterCleanupHook(void (*fcn_ptr) (void)) -{ - - CleanupFunctionHook *newfcn; - - newfcn = (CleanupFunctionHook *) - malloc(sizeof(CleanupFunctionHook)); - newfcn->next = CleanupHookTable; - newfcn->h_function_pointer = fcn_ptr; - CleanupHookTable = newfcn; - - syslog(LOG_DEBUG, "extensions: registered a new cleanup function"); -} - - -void CtdlUnregisterCleanupHook(void (*fcn_ptr) (void)) -{ - CleanupFunctionHook *cur, *p, *last; - last = NULL; - cur = CleanupHookTable; - while (cur != NULL) - { - if (fcn_ptr == cur->h_function_pointer) - { - syslog(LOG_DEBUG, "extensions: unregistered cleanup function"); - p = cur->next; - - free(cur); - cur = NULL; - - if (last != NULL) - last->next = p; - else - CleanupHookTable = p; - cur = p; - } - else { - last = cur; - cur = cur->next; - } - } -} - - -void CtdlDestroyCleanupHooks(void) -{ - CleanupFunctionHook *cur, *p; - - cur = CleanupHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed cleanup function"); - p = cur->next; - free(cur); - cur = p; - } - CleanupHookTable = NULL; -} - -void CtdlRegisterEVCleanupHook(void (*fcn_ptr) (void)) -{ - - CleanupFunctionHook *newfcn; - - newfcn = (CleanupFunctionHook *) - malloc(sizeof(CleanupFunctionHook)); - newfcn->next = EVCleanupHookTable; - newfcn->h_function_pointer = fcn_ptr; - EVCleanupHookTable = newfcn; - - syslog(LOG_DEBUG, "extensions: registered a new cleanup function"); -} - - -void CtdlUnregisterEVCleanupHook(void (*fcn_ptr) (void)) -{ - CleanupFunctionHook *cur, *p, *last; - last = NULL; - cur = EVCleanupHookTable; - while (cur != NULL) - { - if (fcn_ptr == cur->h_function_pointer) - { - syslog(LOG_DEBUG, "extensions: unregistered cleanup function"); - p = cur->next; - - free(cur); - cur = NULL; - - if (last != NULL) - last->next = p; - else - EVCleanupHookTable = p; - cur = p; - } - else { - last = cur; - cur = cur->next; - } - } -} - - -void CtdlDestroyEVCleanupHooks(void) -{ - CleanupFunctionHook *cur, *p; - - cur = EVCleanupHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed cleanup function"); - p = cur->next; - cur->h_function_pointer(); - free(cur); - cur = p; - } - EVCleanupHookTable = NULL; -} - - - void CtdlRegisterSessionHook(void (*fcn_ptr) (void), int EventType, int Priority) { @@ -458,21 +327,6 @@ void CtdlUnregisterSessionHook(void (*fcn_ptr) (void), int EventType) } } -void CtdlDestroySessionHooks(void) -{ - SessionFunctionHook *cur, *p; - - cur = SessionHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed session function"); - p = cur->next; - free(cur); - cur = p; - } - SessionHookTable = NULL; -} - void CtdlRegisterUserHook(void (*fcn_ptr) (ctdluser *), int EventType) { @@ -519,21 +373,6 @@ void CtdlUnregisterUserHook(void (*fcn_ptr) (struct ctdluser *), int EventType) } } -void CtdlDestroyUserHooks(void) -{ - UserFunctionHook *cur, *p; - - cur = UserHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed user function"); - p = cur->next; - free(cur); - cur = p; - } - UserHookTable = NULL; -} - void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *), int EventType) { @@ -578,21 +417,6 @@ void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *) } } -void CtdlDestroyMessageHook(void) -{ - MessageFunctionHook *cur, *p; - - cur = MessageHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed message function (type %d)", cur->eventtype); - p = cur->next; - free(cur); - cur = p; - } - MessageHookTable = NULL; -} - void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *)) { @@ -636,22 +460,6 @@ void CtdlUnregisterRoomHook(int (*fcn_ptr)(struct ctdlroom *)) } -void CtdlDestroyRoomHooks(void) -{ - RoomFunctionHook *cur, *p; - - cur = RoomHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed room function"); - p = cur->next; - free(cur); - cur = p; - } - RoomHookTable = NULL; -} - - void CtdlRegisterDeleteHook(void (*handler)(char *, long) ) { DeleteFunctionHook *newfcn; @@ -694,22 +502,6 @@ void CtdlUnregisterDeleteHook(void (*handler)(char *, long) ) } -void CtdlDestroyDeleteHooks(void) -{ - DeleteFunctionHook *cur, *p; - - cur = DeleteHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed delete function"); - p = cur->next; - free(cur); - cur = p; - } - DeleteHookTable = NULL; -} - - void CtdlRegisterFixedOutputHook(char *content_type, void (*handler)(char *, int) ) { FixedOutputHook *newfcn; @@ -753,21 +545,6 @@ void CtdlUnregisterFixedOutputHook(char *content_type) } } -void CtdlDestroyFixedOutputHooks(void) -{ - FixedOutputHook *cur, *p; - - cur = FixedOutputTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed fixed output function for %s", cur->content_type); - p = cur->next; - free(cur); - cur = p; - - } - FixedOutputTable = NULL; -} /* returns nonzero if we found a hook and used it */ int PerformFixedOutputHooks(char *content_type, char *content, int content_length) @@ -828,22 +605,6 @@ void CtdlUnregisterXmsgHook(int (*fcn_ptr) (char *, char *, char *, char *), int } -void CtdlDestroyXmsgHooks(void) -{ - XmsgFunctionHook *cur, *p; - - cur = XmsgHookTable; - while (cur != NULL) - { - syslog(LOG_DEBUG, "extensions: destroyed x-msg function (priority %d)", cur->order); - p = cur->next; - free(cur); - cur = p; - } - XmsgHookTable = NULL; -} - - void CtdlRegisterServiceHook(int tcp_port, char *sockpath, void (*h_greeting_function) (void), @@ -964,39 +725,6 @@ void CtdlShutdownServiceHooks(void) } -void CtdlDestroyServiceHook(void) -{ - const char *Text; - ServiceFunctionHook *cur, *p; - - cur = ServiceHookTable; - while (cur != NULL) - { - if (cur->msock != -1) - { - close(cur->msock); - Text = "Closed"; - } - else - { - Text = " Not closing again"; - } - - if (cur->sockpath) { - syslog(LOG_INFO, "extensions: %s UNIX domain socket %s", Text, cur->sockpath); - unlink(cur->sockpath); - } else if (cur->tcp_port) { - syslog(LOG_INFO, "extensions: %s TCP port %d", Text, cur->tcp_port); - } else { - syslog(LOG_INFO, "extensions: destroyed service \"%s\"", cur->ServiceName); - } - p = cur->next; - free(cur); - cur = p; - } - ServiceHookTable = NULL; -} - void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name) { SearchFunctionHook *newfcn; @@ -1042,18 +770,6 @@ void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), } } -void CtdlDestroySearchHooks(void) -{ - SearchFunctionHook *cur, *p; - - cur = SearchFunctionHookTable; - SearchFunctionHookTable = NULL; - while (cur != NULL) { - p = cur->next; - free(cur); - cur = p; - } -} void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name) {