* Citadel Extension Loader
* Originally written by Brian Costello <btx@calyx.net>
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2019 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.
MessageFunctionHook *MessageHookTable = NULL;
-/*
- * NetprocFunctionHook extensions are used for hooks which implement handlers
- * for incoming network messages.
- */
-typedef struct NetprocFunctionHook NetprocFunctionHook;
-struct NetprocFunctionHook {
- NetprocFunctionHook *next;
- int (*h_function_pointer) (struct CtdlMessage *msg, char *target_room);
-};
-NetprocFunctionHook *NetprocHookTable = NULL;
-
-
/*
* DeleteFunctionHook extensions are used for hooks which get called when a
* message is about to be deleted.
static StrBuf *portlist = NULL;
-
static StrBuf *errormessages = NULL;
ConstStr ErrPortWhere = { HKEY("\"Admin->System Preferences->Network\".\n\nThe failed ports and sockets are: ")};
ConstStr ErrPortHint = { HKEY("If you want Citadel to provide you with that functionality, "
"check the output of \"netstat -lnp\" on Linux, or \"netstat -na\" on BSD"
- " and stop the program that binds these ports.\n You should eventually remove "
- " their initscripts in /etc/init.d so that you won't get this trouble once more.\n"
- " After that goto \"Administration -> Shutdown Citadel\" to make Citadel restart & retry to bind this port.\n")};
+ " and disable the program that binds these ports.\n")};
void LogPrintMessages(long err)
RoomHookTable = NULL;
}
-void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) )
-{
- NetprocFunctionHook *newfcn;
-
- newfcn = (NetprocFunctionHook *)
- malloc(sizeof(NetprocFunctionHook));
- newfcn->next = NetprocHookTable;
- newfcn->h_function_pointer = handler;
- NetprocHookTable = newfcn;
-
- syslog(LOG_DEBUG, "extensions: registered a new netproc function");
-}
-
-
-void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) )
-{
- NetprocFunctionHook *cur, *p, *last;
-
- cur = NetprocHookTable;
- last = NULL;
-
- while (cur != NULL) {
- if (handler == cur->h_function_pointer)
- {
- syslog(LOG_DEBUG, "extensions: unregistered netproc function");
- p = cur->next;
- free(cur);
- if (last != NULL) {
- last->next = p;
- }
- else {
- NetprocHookTable = p;
- }
- cur = p;
- }
- else {
- last = cur;
- cur = cur->next;
- }
- }
-}
-
-void CtdlDestroyNetprocHooks(void)
-{
- NetprocFunctionHook *cur, *p;
-
- cur = NetprocHookTable;
- while (cur != NULL)
- {
- syslog(LOG_DEBUG, "extensions: destroyed netproc function");
- p = cur->next;
- free(cur);
- cur = p;
- }
- NetprocHookTable = NULL;
-}
-
void CtdlRegisterDeleteHook(void (*handler)(char *, long) )
{
}
-int PerformNetprocHooks(struct CtdlMessage *msg, char *target_room)
-{
- NetprocFunctionHook *fcn;
- int total_retval = 0;
-
- for (fcn = NetprocHookTable; fcn != NULL; fcn = fcn->next) {
- total_retval = total_retval +
- (*fcn->h_function_pointer) (msg, target_room);
- }
-
- /* Return the sum of the return codes from the hook functions.
- * A nonzero return code will cause the message to *not* be imported.
- */
- return total_retval;
-}
-
-
void PerformDeleteHooks(char *room, long msgnum)
{
DeleteFunctionHook *fcn;
}
-
-
-
int PerformXmsgHooks(char *sender, char *sender_email, char *recp, char *msg)
{
XmsgFunctionHook *fcn;