Removed all the disused CtdlUnregister functions.
authorArt Cancro <ajc@citadel.org>
Thu, 31 Aug 2023 03:28:30 +0000 (23:28 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 31 Aug 2023 03:28:30 +0000 (23:28 -0400)
We don't call Unregister functions anymore because our objective is now
to close the databases and GTFO when the server needs to shut down.

citadel/server/ctdl_module.h
citadel/server/modules/fulltext/serv_fulltext.c
citadel/server/msgbase.c
citadel/server/serv_extensions.c

index 54c8ed61b3ad89881bd403f739de1a7a6f8b3156..e3ec8098bf3f0e4ca2c01db221fdc198b33ca99c 100644 (file)
@@ -99,32 +99,15 @@ extern int threading;
 
 
 void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType, int Priority);
-void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
 void CtdlShutdownServiceHooks(void);
-
 void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
-void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
-
 void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
-void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
-
 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, struct recptypes *), int EventType);
-void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, struct recptypes *), int EventType);
-
 void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
-void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
-
 void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
-void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
-
 void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
-void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
-
 void CtdlRegisterEVCleanupHook(void (*fcn_ptr)(void));
-void CtdlUnregisterEVCleanupHook(void (*fcn_ptr)(void));
-
 void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
-
 void CtdlRegisterServiceHook(int tcp_port,
                             char *sockpath,
                             void (*h_greeting_function) (void),
@@ -132,17 +115,8 @@ void CtdlRegisterServiceHook(int tcp_port,
                             void (*h_async_function) (void),
                             const char *ServiceName
 );
-void CtdlUnregisterServiceHook(int tcp_port,
-                       char *sockpath,
-                        void (*h_greeting_function) (void),
-                        void (*h_command_function) (void),
-                        void (*h_async_function) (void)
-);
-
 void CtdlRegisterFixedOutputHook(char *content_type, void (*output_function) (char *supplied_data, int len));
-void CtdlUnRegisterFixedOutputHook(char *content_type);
 void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg));
-void CtdlRegisterSearchFuncHook(Array (*)(const char *), char *name);
 
 /*
  * if you say a) (which may take a while)
@@ -250,13 +224,6 @@ enum {
        ac_internal,
 };
 
-
-
-/*
- * API declarations from serv_extensions.h
- */
-void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name);
-
 #define NODENAME               CtdlGetConfigStr("c_nodename")
 #define FQDN                   CtdlGetConfigStr("c_fqdn")
 #define CREATAIDE              CtdlGetConfigInt("c_creataide")
index 167e050d4598be91ad9e8a4bac34be22ee1135f6..ede6fb35592584070a91a06635d8f9d718995c12 100644 (file)
@@ -344,7 +344,7 @@ char *ctdl_module_init_fulltext(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_srch, "SRCH", "Full text search");
                CtdlRegisterDeleteHook(ft_delete_remove);
-               CtdlRegisterSearchFuncHook(ft_search, "fulltext");
+               //CtdlRegisterSearchFuncHook(ft_search, "fulltext");
                CtdlRegisterSessionHook(do_fulltext_indexing, EVT_TIMER, PRIO_CLEANUP + 300);
        }
        // return our module name for the log
index 27c3e51b0b45f2d362fee1f4f298ffcf58fd58eb..60e1140cf3b9f05a6c3958b587e85f07c96c1d0c 100644 (file)
@@ -719,7 +719,8 @@ int CtdlForEachMessage(int mode, long ref, char *search_string,
                 * NULL means use any search function available.
                 * otherwise replace with a char * to name of search routine
                 */
-               CtdlModuleDoSearch(&num_search_msgs, &search_msgs, search_string, "fulltext");
+               CtdlModuleDoSearch(search_string, "fulltext");
+               //FIXME FOOFOO DO ARRAY
 
                if (num_search_msgs > 0) {
        
index 0763916ae60304d0983a845e961ec8e989df5301..33796ac97bf433f8a4845239949f9054b89f899e 100644 (file)
@@ -113,15 +113,6 @@ struct RoomFunctionHook {
 };
 RoomFunctionHook *RoomHookTable = NULL;
 
-
-typedef struct SearchFunctionHook SearchFunctionHook;
-struct SearchFunctionHook {
-       SearchFunctionHook *next;
-       void (*fcn_ptr) (int *, long **, const char *);
-       char *name;
-};
-SearchFunctionHook *SearchFunctionHookTable = NULL;
-
 ServiceFunctionHook *ServiceHookTable = NULL;
 
 typedef struct ProtoFunctionHook ProtoFunctionHook;
@@ -289,35 +280,6 @@ void CtdlRegisterSessionHook(void (*fcn_ptr) (void), int EventType, int Priority
 }
 
 
-void CtdlUnregisterSessionHook(void (*fcn_ptr) (void), int EventType)
-{
-       SessionFunctionHook *cur, *p, *last;
-       last = NULL;
-       cur = SessionHookTable;
-       while  (cur != NULL) {
-               if ((fcn_ptr == cur->h_function_pointer) &&
-                   (EventType == cur->eventtype))
-               {
-                       syslog(LOG_DEBUG, "extensions: unregistered session function (type %d)", EventType);
-                       p = cur->next;
-
-                       free(cur);
-                       cur = NULL;
-
-                       if (last != NULL)
-                               last->next = p;
-                       else 
-                               SessionHookTable = p;
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 void CtdlRegisterUserHook(void (*fcn_ptr) (ctdluser *), int EventType)
 {
 
@@ -335,35 +297,6 @@ void CtdlRegisterUserHook(void (*fcn_ptr) (ctdluser *), int EventType)
 }
 
 
-void CtdlUnregisterUserHook(void (*fcn_ptr) (struct ctdluser *), int EventType)
-{
-       UserFunctionHook *cur, *p, *last;
-       last = NULL;
-       cur = UserHookTable;
-       while (cur != NULL) {
-               if ((fcn_ptr == cur->h_function_pointer) &&
-                   (EventType == cur->eventtype))
-               {
-                       syslog(LOG_DEBUG, "extensions: unregistered user function (type %d)", EventType);
-                       p = cur->next;
-
-                       free(cur);
-                       cur = NULL;
-
-                       if (last != NULL)
-                               last->next = p;
-                       else 
-                               UserHookTable = p;
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, struct recptypes *), int EventType)
 {
 
@@ -380,34 +313,6 @@ void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, struct recptyp
 }
 
 
-void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, struct recptypes *), int EventType)
-{
-       MessageFunctionHook *cur, *p, *last;
-       last = NULL;
-       cur = MessageHookTable;
-       while (cur != NULL) {
-               if ((handler == cur->h_function_pointer) &&
-                   (EventType == cur->eventtype))
-               {
-                       syslog(LOG_DEBUG, "extensions: unregistered message function (type %d)", EventType);
-                       p = cur->next;
-                       free(cur);
-                       cur = NULL;
-
-                       if (last != NULL)
-                               last->next = p;
-                       else 
-                               MessageHookTable = p;
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *))
 {
        RoomFunctionHook *newfcn;
@@ -422,34 +327,6 @@ void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *))
 }
 
 
-void CtdlUnregisterRoomHook(int (*fcn_ptr)(struct ctdlroom *))
-{
-       RoomFunctionHook *cur, *p, *last;
-       last = NULL;
-       cur = RoomHookTable;
-       while (cur != NULL)
-       {
-               if (fcn_ptr == cur->fcn_ptr) {
-                       syslog(LOG_DEBUG, "extensions: unregistered room function");
-                       p = cur->next;
-
-                       free(cur);
-                       cur = NULL;
-
-                       if (last != NULL)
-                               last->next = p;
-                       else 
-                               RoomHookTable = p;
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 void CtdlRegisterDeleteHook(void (*handler)(char *, long) )
 {
        DeleteFunctionHook *newfcn;
@@ -464,34 +341,6 @@ void CtdlRegisterDeleteHook(void (*handler)(char *, long) )
 }
 
 
-void CtdlUnregisterDeleteHook(void (*handler)(char *, long) )
-{
-       DeleteFunctionHook *cur, *p, *last;
-
-       last = NULL;
-       cur = DeleteHookTable;
-       while (cur != NULL) {
-               if (handler == cur->h_function_pointer )
-               {
-                       syslog(LOG_DEBUG, "extensions: unregistered delete function");
-                       p = cur->next;
-                       free(cur);
-
-                       if (last != NULL)
-                               last->next = p;
-                       else
-                               DeleteHookTable = p;
-
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 void CtdlRegisterFixedOutputHook(char *content_type, void (*handler)(char *, int) )
 {
        FixedOutputHook *newfcn;
@@ -507,35 +356,6 @@ void CtdlRegisterFixedOutputHook(char *content_type, void (*handler)(char *, int
 }
 
 
-void CtdlUnregisterFixedOutputHook(char *content_type)
-{
-       FixedOutputHook *cur, *p, *last;
-
-       last = NULL;
-       cur = FixedOutputTable;
-       while (cur != NULL) {
-               /* This will also remove duplicates if any */
-               if (!strcasecmp(content_type, cur->content_type)) {
-                       syslog(LOG_DEBUG, "extensions: unregistered fixed output function for %s", content_type);
-                       p = cur->next;
-                       free(cur);
-
-                       if (last != NULL)
-                               last->next = p;
-                       else
-                               FixedOutputTable = p;
-                       
-                       cur = p;
-               }
-               else
-               {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 /* returns nonzero if we found a hook and used it */
 int PerformFixedOutputHooks(char *content_type, char *content, int content_length)
 {
@@ -565,36 +385,6 @@ void CtdlRegisterXmsgHook(int (*fcn_ptr) (char *, char *, char *, char *), int o
 }
 
 
-void CtdlUnregisterXmsgHook(int (*fcn_ptr) (char *, char *, char *, char *), int order)
-{
-       XmsgFunctionHook *cur, *p, *last;
-
-       last = NULL;
-       cur = XmsgHookTable;
-       while (cur != NULL) {
-               /* This will also remove duplicates if any */
-               if (fcn_ptr == cur->h_function_pointer &&
-                   order == cur->order) {
-                       syslog(LOG_DEBUG, "extensions: unregistered x-msg function (priority %d)", order);
-                       p = cur->next;
-                       free(cur);
-
-                       if (last != NULL) {
-                               last->next = p;
-                       }
-                       else {
-                               XmsgHookTable = p;
-                       }
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 void CtdlRegisterServiceHook(int tcp_port,
                             char *sockpath,
                             void (*h_greeting_function) (void),
@@ -647,50 +437,6 @@ void CtdlRegisterServiceHook(int tcp_port,
 }
 
 
-void CtdlUnregisterServiceHook(int tcp_port, char *sockpath,
-                       void (*h_greeting_function) (void),
-                       void (*h_command_function) (void),
-                       void (*h_async_function) (void)
-                       )
-{
-       ServiceFunctionHook *cur, *p, *last;
-
-       last = NULL;
-       cur = ServiceHookTable;
-       while (cur != NULL) {
-               /* This will also remove duplicates if any */
-               if (h_greeting_function == cur->h_greeting_function &&
-                   h_command_function == cur->h_command_function &&
-                   h_async_function == cur->h_async_function &&
-                   tcp_port == cur->tcp_port && 
-                   !(sockpath && cur->sockpath && strcmp(sockpath, cur->sockpath)) )
-               {
-                       if (cur->msock > 0)
-                               close(cur->msock);
-                       if (sockpath) {
-                               syslog(LOG_INFO, "extensions: closed UNIX domain socket %s", sockpath);
-                               unlink(sockpath);
-                       } else if (tcp_port) {
-                               syslog(LOG_INFO, "extensions: closed TCP port %d", tcp_port);
-                       } else {
-                               syslog(LOG_INFO, "extensions: unregistered service \"%s\"", cur->ServiceName);
-                       }
-                       p = cur->next;
-                       free(cur);
-                       if (last != NULL)
-                               last->next = p;
-                       else
-                               ServiceHookTable = p;
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
 // During shutdown we can close all of the listening sockets.
 void CtdlShutdownServiceHooks(void) {
        ServiceFunctionHook *cur;
@@ -712,63 +458,6 @@ void CtdlShutdownServiceHooks(void) {
 }
 
 
-void CtdlRegisterSearchFuncHook(Array (*fcn_ptr)(const char *), char *name) {
-       SearchFunctionHook *newfcn;
-
-       if (!name || !fcn_ptr) {
-               return;
-       }
-       
-       newfcn = (SearchFunctionHook *) malloc(sizeof(SearchFunctionHook));
-       newfcn->next = SearchFunctionHookTable;
-       newfcn->name = name;
-       newfcn->fcn_ptr = fcn_ptr;
-       SearchFunctionHookTable = newfcn;
-
-       syslog(LOG_DEBUG, "extensions: registered a new search function (%s)", name);
-}
-
-
-void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name) {
-       SearchFunctionHook *cur, *p, *last;
-       
-       last = NULL;
-       cur = SearchFunctionHookTable;
-       while (cur != NULL) {
-               if (fcn_ptr &&
-                   (cur->fcn_ptr == fcn_ptr) &&
-                   name && !strcmp(name, cur->name))
-               {
-                       syslog(LOG_DEBUG, "extensions: unregistered search function(%s)", name);
-                       p = cur->next;
-                       free (cur);
-                       if (last != NULL)
-                               last->next = p;
-                       else
-                               SearchFunctionHookTable = p;
-                       cur = p;
-               }
-               else {
-                       last = cur;
-                       cur = cur->next;
-               }
-       }
-}
-
-
-void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name) {
-       SearchFunctionHook *fcn = NULL;
-
-       for (fcn = SearchFunctionHookTable; fcn != NULL; fcn = fcn->next) {
-               if (!func_name || !strcmp(func_name, fcn->name)) {
-                       (*fcn->fcn_ptr) (num_msgs, search_msgs, search_string);
-                       return;
-               }
-       }
-       *num_msgs = 0;
-}
-
-
 void PerformSessionHooks(int EventType) {
        SessionFunctionHook *fcn = NULL;