* rework imap tokenizer, we no longer copy the stuff around, we keep a reference...
[citadel.git] / citadel / serv_extensions.h
1 /* $Id$ */
2
3 #ifndef SERV_EXTENSIONS_H
4 #define SERV_EXTENSIONS_H
5
6 #include "server.h"
7
8 /*
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.
12  */
13 //void serv_calendar_destroy(void);
14 //char *serv_test_init(void);
15 //char *serv_postfix_tcpdict(void);
16 /*
17  */
18
19  
20  
21 /*
22  * Structure defentitions for hook tables
23  */
24  
25
26 struct LogFunctionHook {
27         struct LogFunctionHook *next;
28         int loglevel;
29         void (*h_function_pointer) (char *);
30 };
31 extern struct LogFunctionHook *LogHookTable;
32
33 struct CleanupFunctionHook {
34         struct CleanupFunctionHook *next;
35         void (*h_function_pointer) (void);
36 };
37 extern struct CleanupFunctionHook *CleanupHookTable;
38
39 struct FixedOutputHook {
40         struct FixedOutputHook *next;
41         char content_type[64];
42         void (*h_function_pointer) (char *, int);
43 };
44 extern struct FixedOutputHook *FixedOutputTable;
45
46
47
48 /*
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
52  * pertinent data.
53  */
54 struct SessionFunctionHook {
55         struct SessionFunctionHook *next;
56         void (*h_function_pointer) (void);
57         int eventtype;
58 };
59 extern struct SessionFunctionHook *SessionHookTable;
60
61
62 /*
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.
66  */
67 struct UserFunctionHook {
68         struct UserFunctionHook *next;
69         void (*h_function_pointer) (struct ctdluser *usbuf);
70         int eventtype;
71 };
72 extern struct UserFunctionHook *UserHookTable;
73
74 /*
75  * MessageFunctionHook extensions are used for hooks which implement handlers
76  * for various types of message operations (save, read, etc.)
77  */
78 struct MessageFunctionHook {
79         struct MessageFunctionHook *next;
80         int (*h_function_pointer) (struct CtdlMessage *msg);
81         int eventtype;
82 };
83 extern struct MessageFunctionHook *MessageHookTable;
84
85
86 /*
87  * NetprocFunctionHook extensions are used for hooks which implement handlers
88  * for incoming network messages.
89  */
90 struct NetprocFunctionHook {
91         struct NetprocFunctionHook *next;
92         int (*h_function_pointer) (struct CtdlMessage *msg, char *target_room);
93 };
94 extern struct NetprocFunctionHook *NetprocHookTable;
95
96
97 /*
98  * DeleteFunctionHook extensions are used for hooks which get called when a
99  * message is about to be deleted.
100  */
101 struct DeleteFunctionHook {
102         struct DeleteFunctionHook *next;
103         void (*h_function_pointer) (char *target_room, long msgnum);
104 };
105 extern struct DeleteFunctionHook *DeleteHookTable;
106
107
108 /*
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.
113  */
114 struct XmsgFunctionHook {
115         struct XmsgFunctionHook *next;
116         int (*h_function_pointer) (char *, char *, char *, char *);
117         int order;
118 };
119 extern struct XmsgFunctionHook *XmsgHookTable;
120
121
122
123
124 /*
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.
127  */
128 struct ServiceFunctionHook {
129         struct ServiceFunctionHook *next;
130         int tcp_port;
131         char *sockpath;
132         void (*h_greeting_function) (void) ;
133         void (*h_command_function) (void) ;
134         void (*h_async_function) (void) ;
135         int msock;
136         const char* ServiceName; /* this is just for debugging and logging purposes. */
137 };
138 extern struct ServiceFunctionHook *ServiceHookTable;
139
140
141 /*
142  * RoomFunctionHook extensions are used for hooks which impliment room
143  * processing functions when new messages are added EG. SIEVE.
144  */
145 struct RoomFunctionHook {
146         struct RoomFunctionHook *next;
147         int (*fcn_ptr) (struct ctdlroom *);
148 };
149 extern struct RoomFunctionHook *RoomHookTable;
150
151
152
153 struct SearchFunctionHook {
154         struct SearchFunctionHook *next;
155         void (*fcn_ptr) (int *, long **, const char *);
156         char *name;
157 };
158 extern struct SearchFunctionHook *SearchFunctionHookTable;
159
160  
161  
162 void initialize_server_extensions(void);
163 int DLoader_Exec_Cmd(char *cmdbuf);
164 char *Dynamic_Module_Init(void);
165
166 void CtdlDestroySessionHooks(void);
167 void PerformSessionHooks(int EventType);
168
169 void CtdlDestroyUserHooks(void);
170 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
171
172 int PerformXmsgHooks(char *, char *, char *, char *);
173 void CtdlDestroyXmsgHooks(void);
174
175
176
177 void CtdlDestroyMessageHook(void);
178 int PerformMessageHooks(struct CtdlMessage *, int EventType);
179
180
181 void CtdlDestroyNetprocHooks(void);
182 int PerformNetprocHooks(struct CtdlMessage *, char *);
183
184 void CtdlDestroyRoomHooks(void);
185 int PerformRoomHooks(struct ctdlroom *);
186
187
188 void CtdlDestroyDeleteHooks(void);
189 void PerformDeleteHooks(char *, long);
190
191
192 void CtdlDestroyCleanupHooks(void);
193
194 void CtdlDestroyProtoHooks(void);
195
196 void CtdlDestroyServiceHook(void);
197
198 void CtdlDestroyFixedOutputHooks(void);
199 int PerformFixedOutputHooks(char *, char *, int);
200
201
202 #endif /* SERV_EXTENSIONS_H */