]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/serv_extensions.c
Removed all the disused CtdlUnregister functions.
[citadel.git] / citadel / server / serv_extensions.c
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;