3 #ifndef SERV_EXTENSIONS_H
4 #define SERV_EXTENSIONS_H
9 * This is where we declare all of the server extensions we have.
10 * We'll probably start moving these to a more sane location in the near
11 * future. For now, this just shuts up the compiler.
13 //void serv_calendar_destroy(void);
14 //char *serv_test_init(void);
15 //char *serv_postfix_tcpdict(void);
22 * Structure defentitions for hook tables
26 struct LogFunctionHook {
27 struct LogFunctionHook *next;
29 void (*h_function_pointer) (char *);
31 extern struct LogFunctionHook *LogHookTable;
33 struct CleanupFunctionHook {
34 struct CleanupFunctionHook *next;
35 void (*h_function_pointer) (void);
37 extern struct CleanupFunctionHook *CleanupHookTable;
39 struct FixedOutputHook {
40 struct FixedOutputHook *next;
41 char content_type[64];
42 void (*h_function_pointer) (char *, int);
44 extern struct FixedOutputHook *FixedOutputTable;
49 * SessionFunctionHook extensions are used for any type of hook for which
50 * the context in which it's being called (which is determined by the event
51 * type) will make it obvious for the hook function to know where to look for
54 struct SessionFunctionHook {
55 struct SessionFunctionHook *next;
56 void (*h_function_pointer) (void);
59 extern struct SessionFunctionHook *SessionHookTable;
63 * UserFunctionHook extensions are used for any type of hook which implements
64 * an operation on a user or username (potentially) other than the one
65 * operating the current session.
67 struct UserFunctionHook {
68 struct UserFunctionHook *next;
69 void (*h_function_pointer) (struct ctdluser *usbuf);
72 extern struct UserFunctionHook *UserHookTable;
75 * MessageFunctionHook extensions are used for hooks which implement handlers
76 * for various types of message operations (save, read, etc.)
78 struct MessageFunctionHook {
79 struct MessageFunctionHook *next;
80 int (*h_function_pointer) (struct CtdlMessage *msg);
83 extern struct MessageFunctionHook *MessageHookTable;
87 * NetprocFunctionHook extensions are used for hooks which implement handlers
88 * for incoming network messages.
90 struct NetprocFunctionHook {
91 struct NetprocFunctionHook *next;
92 int (*h_function_pointer) (struct CtdlMessage *msg, char *target_room);
94 extern struct NetprocFunctionHook *NetprocHookTable;
98 * DeleteFunctionHook extensions are used for hooks which get called when a
99 * message is about to be deleted.
101 struct DeleteFunctionHook {
102 struct DeleteFunctionHook *next;
103 void (*h_function_pointer) (char *target_room, long msgnum);
105 extern struct DeleteFunctionHook *DeleteHookTable;
109 * ExpressMessageFunctionHook extensions are used for hooks which implement
110 * the sending of an instant message through various channels. Any function
111 * registered should return the number of recipients to whom the message was
112 * successfully transmitted.
114 struct XmsgFunctionHook {
115 struct XmsgFunctionHook *next;
116 int (*h_function_pointer) (char *, char *, char *);
119 extern struct XmsgFunctionHook *XmsgHookTable;
125 * ServiceFunctionHook extensions are used for hooks which implement various
126 * protocols (either on TCP or on unix domain sockets) directly in the Citadel server.
128 struct ServiceFunctionHook {
129 struct ServiceFunctionHook *next;
132 void (*h_greeting_function) (void) ;
133 void (*h_command_function) (void) ;
134 void (*h_async_function) (void) ;
136 const char* ServiceName; /* this is just for debugging and logging purposes. */
138 extern struct ServiceFunctionHook *ServiceHookTable;
142 * RoomFunctionHook extensions are used for hooks which impliment room
143 * processing functions when new messages are added EG. SIEVE.
145 struct RoomFunctionHook {
146 struct RoomFunctionHook *next;
147 int (*fcn_ptr) (struct ctdlroom *);
149 extern struct RoomFunctionHook *RoomHookTable;
152 struct MaintenanceThreadHook {
153 struct MaintenanceThreadHook *next;
155 void *(*fcn_ptr) (void *arg);
156 pthread_t MaintenanceThread_tid;
158 extern struct MaintenanceThreadHook *MaintenanceThreadHookTable;
161 struct SearchFunctionHook {
162 struct SearchFunctionHook *next;
163 void (*fcn_ptr) (int *, long **, char *);
166 extern struct SearchFunctionHook *SearchFunctionHookTable;
170 void initialize_server_extensions(void);
171 int DLoader_Exec_Cmd(char *cmdbuf);
172 char *Dynamic_Module_Init(void);
174 void CtdlDestroySessionHooks(void);
175 void PerformSessionHooks(int EventType);
177 void CtdlDestroyUserHooks(void);
178 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
180 int PerformXmsgHooks(char *, char *, char *);
181 void CtdlDestroyXmsgHooks(void);
185 void CtdlDestroyMessageHook(void);
186 int PerformMessageHooks(struct CtdlMessage *, int EventType);
189 void CtdlDestroyNetprocHooks(void);
190 int PerformNetprocHooks(struct CtdlMessage *, char *);
192 void CtdlDestroyRoomHooks(void);
193 int PerformRoomHooks(struct ctdlroom *);
196 void CtdlDestroyDeleteHooks(void);
197 void PerformDeleteHooks(char *, long);
200 void CtdlDestroyCleanupHooks(void);
202 void CtdlDestroyProtoHooks(void);
204 void CtdlDestroyServiceHook(void);
206 void CtdlDestroyFixedOutputHooks(void);
207 int PerformFixedOutputHooks(char *, char *, int);
209 void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, char *search_string, char *func_name);
211 #endif /* SERV_EXTENSIONS_H */