From: Wilfried Göesgens Date: Sun, 15 Jul 2007 21:14:10 +0000 (+0000) Subject: * added a comment infront of the svn modifieable returns. Now it will be me listed... X-Git-Tag: v7.86~3231 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=46c921f7d98ad2b588065bdb2da1b637772225a7 * added a comment infront of the svn modifieable returns. Now it will be me listed on all those places till the next commit ;-) --- diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 97397b52b..9e092a47b 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -2143,15 +2143,22 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms lprintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() skips repl checks\n"); } +#if 0 /* Submit this room for net processing */ network_queue_room(&CC->room, NULL); +#endif + + /* Submit this room for processing by hooks */ + PerformRoomHooks(&CC->room); +#if 0 #ifdef HAVE_LIBSIEVE /* If this is someone's inbox, submit the room for sieve processing */ if (!strcasecmp(&CC->room.QRname[11], MAILROOM)) { sieve_queue_room(&CC->room); } #endif /* HAVE_LIBSIEVE */ +#endif /* Go back to the room we were in before we wandered here... */ getroom(&CC->room, hold_rm); diff --git a/citadel/serv_autocompletion.c b/citadel/serv_autocompletion.c index 994b4e833..239985c65 100644 --- a/citadel/serv_autocompletion.c +++ b/citadel/serv_autocompletion.c @@ -252,5 +252,7 @@ void cmd_auto(char *argbuf) { char *serv_autocompletion_init(void) { CtdlRegisterProtoHook(cmd_auto, "AUTO", "Do recipient autocompletion"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_bio.c b/citadel/serv_bio.c index a39e4e31d..19820a956 100644 --- a/citadel/serv_bio.c +++ b/citadel/serv_bio.c @@ -139,6 +139,8 @@ char *serv_bio_init(void) CtdlRegisterProtoHook(cmd_ebio, "EBIO", "Enter your bio"); CtdlRegisterProtoHook(cmd_rbio, "RBIO", "Read a user's bio"); CtdlRegisterProtoHook(cmd_lbio, "LBIO", "List users with bios"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_calendar.c b/citadel/serv_calendar.c index 8fb05e78b..2171f381b 100644 --- a/citadel/serv_calendar.c +++ b/citadel/serv_calendar.c @@ -2147,6 +2147,8 @@ char *serv_calendar_init(void) CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP); CtdlRegisterFixedOutputHook("text/calendar", ical_fixed_output); #endif + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_chat.c b/citadel/serv_chat.c index cc42c278d..765d486d9 100644 --- a/citadel/serv_chat.c +++ b/citadel/serv_chat.c @@ -821,6 +821,8 @@ char *serv_chat_init(void) CtdlRegisterSessionHook(cmd_gexp_async, EVT_ASYNC); CtdlRegisterSessionHook(delete_instant_messages, EVT_STOP); CtdlRegisterXmsgHook(send_instant_message, XMSG_PRI_LOCAL); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_expire.c b/citadel/serv_expire.c index 6e6306e99..ab0a95214 100644 --- a/citadel/serv_expire.c +++ b/citadel/serv_expire.c @@ -840,5 +840,7 @@ char *serv_expire_init(void) { CtdlRegisterSessionHook(purge_databases, EVT_TIMER); CtdlRegisterProtoHook(cmd_fsck, "FSCK", "Check message ref counts"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_extensions.c b/citadel/serv_extensions.c index e6ae83f70..173ee6f68 100644 --- a/citadel/serv_extensions.c +++ b/citadel/serv_extensions.c @@ -37,6 +37,8 @@ struct NetprocFunctionHook *NetprocHookTable = NULL; struct DeleteFunctionHook *DeleteHookTable = NULL; struct ServiceFunctionHook *ServiceHookTable = NULL; struct FixedOutputHook *FixedOutputTable = NULL; +struct RoomFunctionHook *RoomHookTable = NULL; + struct ProtoFunctionHook { void (*handler) (char *cmdbuf); @@ -502,6 +504,53 @@ void CtdlDestroyMessageHook(void) } +void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *)) +{ + struct RoomFunctionHook *newfcn; + + newfcn = (struct RoomFunctionHook *) + malloc(sizeof(struct RoomFunctionHook)); + newfcn->next = RoomHookTable; + newfcn->fcn_ptr = fcn_ptr; + RoomHookTable = newfcn; + + lprintf(CTDL_INFO, "Registered a new room function\n"); +} + + +void CtdlUnregisterRoomHook(int (*fcn_ptr)(struct ctdlroom *)) +{ + struct RoomFunctionHook *cur, *p; + + for (cur = RoomHookTable; cur != NULL; cur = cur->next) { + while (cur != NULL && fcn_ptr == cur->fcn_ptr) { + lprintf(CTDL_INFO, "Unregistered room function\n"); + p = cur->next; + if (cur == RoomHookTable) { + RoomHookTable = p; + } + free(cur); + cur = p; + } + } +} + + +void CtdlDestroyRoomHooks(void) +{ + struct RoomFunctionHook *cur, *p; + + cur = RoomHookTable; + while (cur != NULL) + { + lprintf(CTDL_INFO, "Unregistered room function\n"); + p = cur->next; + free(cur); + cur = p; + } + RoomHookTable = NULL; +} + void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) ) { struct NetprocFunctionHook *newfcn; @@ -894,6 +943,23 @@ int PerformMessageHooks(struct CtdlMessage *msg, int EventType) } +int PerformRoomHooks(struct ctdlroom *target_room) +{ + struct RoomFunctionHook *fcn; + int total_retval = 0; + + lprintf(CTDL_DEBUG, "Performing room hooks\n"); + + for (fcn = RoomHookTable; fcn != NULL; fcn = fcn->next) { + total_retval = total_retval + + (*fcn->fcn_ptr) (target_room); + } + + /* Return the sum of the return codes from the hook functions. + */ + return total_retval; +} + int PerformNetprocHooks(struct CtdlMessage *msg, char *target_room) { diff --git a/citadel/serv_extensions.h b/citadel/serv_extensions.h index 4ed2b5369..ccdd95979 100644 --- a/citadel/serv_extensions.h +++ b/citadel/serv_extensions.h @@ -76,6 +76,12 @@ void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) ); void CtdlDestroyNetprocHooks(void); int PerformNetprocHooks(struct CtdlMessage *, char *); +void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) ); +void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) ); +void CtdlDestroyRoomHooks(void); +int PerformRoomHooks(struct ctdlroom *); + + void CtdlRegisterDeleteHook(void (*handler)(char *, long) ); void CtdlUnregisterDeleteHook(void (*handler)(char *, long) ); void CtdlDestroyDeleteHooks(void); diff --git a/citadel/serv_fulltext.c b/citadel/serv_fulltext.c index 0626a77b0..028f95868 100644 --- a/citadel/serv_fulltext.c +++ b/citadel/serv_fulltext.c @@ -471,5 +471,7 @@ char *serv_fulltext_init(void) { initialize_ft_cache(); CtdlRegisterProtoHook(cmd_srch, "SRCH", "Full text search"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_funambol.c b/citadel/serv_funambol.c index 271dc102f..9e0601246 100644 --- a/citadel/serv_funambol.c +++ b/citadel/serv_funambol.c @@ -223,5 +223,7 @@ char *serv_funambol_init(void) { create_notify_queue(); CtdlRegisterSessionHook(do_notify_queue, EVT_TIMER); - return "$Id: serv_funambol.c $"; + + /* return our Subversion id for the Log */ + return "$Id$"; } diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index b91800a87..9599d19ed 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -1596,5 +1596,7 @@ char *serv_imap_init(void) NULL, imaps_greeting, imap_command_loop, NULL); #endif CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_inetcfg.c b/citadel/serv_inetcfg.c index 5d49d5fa8..d5623d989 100644 --- a/citadel/serv_inetcfg.c +++ b/citadel/serv_inetcfg.c @@ -181,6 +181,8 @@ char *serv_inetcfg_init(void) { CtdlRegisterMessageHook(inetcfg_aftersave, EVT_AFTERSAVE); inetcfg_init(); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_ldap.c b/citadel/serv_ldap.c index c54ac7926..6d8acc1f7 100644 --- a/citadel/serv_ldap.c +++ b/citadel/serv_ldap.c @@ -597,5 +597,7 @@ char *serv_ldap_init(void) } #endif /* HAVE_LDAP */ + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_listsub.c b/citadel/serv_listsub.c index 16a0b9633..be0953728 100644 --- a/citadel/serv_listsub.c +++ b/citadel/serv_listsub.c @@ -565,5 +565,7 @@ void cmd_subs(char *cmdbuf) { char *serv_listsub_init(void) { CtdlRegisterProtoHook(cmd_subs, "SUBS", "List subscribe/unsubscribe"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_managesieve.c b/citadel/serv_managesieve.c index 11ad9da42..9b53968e1 100644 --- a/citadel/serv_managesieve.c +++ b/citadel/serv_managesieve.c @@ -589,6 +589,8 @@ char *serv_managesieve_init(void) char *serv_managesieve_init(void) { lprintf(CTDL_INFO, "This server is missing libsieve. Managesieve protocol is disabled..\n"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_mrtg.c b/citadel/serv_mrtg.c index a28896cb1..ec2493d76 100644 --- a/citadel/serv_mrtg.c +++ b/citadel/serv_mrtg.c @@ -130,5 +130,7 @@ void cmd_mrtg(char *argbuf) { char *serv_mrtg_init(void) { CtdlRegisterProtoHook(cmd_mrtg, "MRTG", "Supply stats to MRTG"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_netfilter.c b/citadel/serv_netfilter.c index 9585ae524..4f6f53bd0 100644 --- a/citadel/serv_netfilter.c +++ b/citadel/serv_netfilter.c @@ -106,5 +106,7 @@ int filter_the_idiots(struct CtdlMessage *msg, char *target_room) { char *serv_netfilter_init(void) { CtdlRegisterNetprocHook(filter_the_idiots); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_network.c b/citadel/serv_network.c index 1aaee9a32..840ebd508 100644 --- a/citadel/serv_network.c +++ b/citadel/serv_network.c @@ -2055,6 +2055,12 @@ void cmd_netp(char *cmdbuf) CC->net_node); } +int network_room_handler (struct ctdlroom *room) +{ + network_queue_room(room, NULL); + return 0; +} + /* * Module entry point */ @@ -2066,5 +2072,8 @@ char *serv_network_init(void) CtdlRegisterProtoHook(cmd_netp, "NETP", "Identify as network poller"); CtdlRegisterProtoHook(cmd_nsyn, "NSYN", "Synchronize room to node"); CtdlRegisterSessionHook(network_do_queue, EVT_TIMER); + CtdlRegisterRoomHook(network_room_handler); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_newuser.c b/citadel/serv_newuser.c index b1dc2d5bf..ffde5e3b2 100644 --- a/citadel/serv_newuser.c +++ b/citadel/serv_newuser.c @@ -95,5 +95,7 @@ void CopyNewUserGreetings(void) { char *serv_newuser_init(void) { CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_notes.c b/citadel/serv_notes.c index be07912d8..23a8d5832 100644 --- a/citadel/serv_notes.c +++ b/citadel/serv_notes.c @@ -105,5 +105,7 @@ int serv_notes_beforesave(struct CtdlMessage *msg) char *serv_notes_init(void) { CtdlRegisterMessageHook(serv_notes_beforesave, EVT_BEFORESAVE); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_pas2.c b/citadel/serv_pas2.c index 0de1a66ee..f2bc4e62f 100644 --- a/citadel/serv_pas2.c +++ b/citadel/serv_pas2.c @@ -88,5 +88,7 @@ void cmd_pas2(char *argbuf) char *serv_pas2_init(void) { CtdlRegisterProtoHook(cmd_pas2, "PAS2", "APOP-based login"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_pop3.c b/citadel/serv_pop3.c index 5880b97e9..a03c6ee6e 100644 --- a/citadel/serv_pop3.c +++ b/citadel/serv_pop3.c @@ -725,5 +725,7 @@ char *serv_pop3_init(void) NULL); #endif CtdlRegisterSessionHook(pop3_cleanup_function, EVT_STOP); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_rwho.c b/citadel/serv_rwho.c index 0123145f0..6af26ab09 100644 --- a/citadel/serv_rwho.c +++ b/citadel/serv_rwho.c @@ -260,5 +260,7 @@ char *serv_rwho_init(void) CtdlRegisterProtoHook(cmd_rchg, "RCHG", "Masquerade roomname"); CtdlRegisterProtoHook(cmd_uchg, "UCHG", "Masquerade username"); CtdlRegisterProtoHook(cmd_stel, "STEL", "Enter/exit stealth mode"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_sieve.c b/citadel/serv_sieve.c index 3418ab8d9..a07218a15 100644 --- a/citadel/serv_sieve.c +++ b/citadel/serv_sieve.c @@ -1225,6 +1225,16 @@ BAIL: res = sieve2_free(&sieve2_context); } +int serv_sieve_room(struct ctdlroom *room) +{ + if (!strcasecmp(&room->QRname[11], MAILROOM)) { + sieve_queue_room(room); +/* + return 1; +*/ + } + return 0; +} char *serv_sieve_init(void) @@ -1239,6 +1249,9 @@ char *serv_sieve_init(void) char *serv_sieve_init(void) { lprintf(CTDL_INFO, "This server is missing libsieve. Mailbox filtering will be disabled.\n"); + CtdlRegisterRoomHook(serv_sieve_room); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 91aa23646..65476a9f4 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -1849,5 +1849,7 @@ char *serv_smtp_init(void) CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER); CtdlRegisterSessionHook(smtp_cleanup_function, EVT_STOP); CtdlRegisterProtoHook(cmd_smtp, "SMTP", "SMTP utility commands"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_spam.c b/citadel/serv_spam.c index 9d7c46471..468a09737 100644 --- a/citadel/serv_spam.c +++ b/citadel/serv_spam.c @@ -148,5 +148,7 @@ bail: close(sock); char *serv_spam_init(void) { CtdlRegisterMessageHook(spam_assassin, EVT_SMTPSCAN); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_test.c b/citadel/serv_test.c index f3bf3c59c..c79e6aace 100644 --- a/citadel/serv_test.c +++ b/citadel/serv_test.c @@ -72,5 +72,7 @@ char *serv_test_init(void) CtdlRegisterSessionHook(SessionStartTest, EVT_START); CtdlRegisterSessionHook(SessionStopTest, EVT_STOP); CtdlRegisterSessionHook(LoginTest, EVT_LOGIN); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_upgrade.c b/citadel/serv_upgrade.c index c54117e0f..1c3012a51 100644 --- a/citadel/serv_upgrade.c +++ b/citadel/serv_upgrade.c @@ -229,5 +229,7 @@ void check_server_upgrades(void) { char *serv_upgrade_init(void) { check_server_upgrades(); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index 288c04fb0..f5451a555 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -729,5 +729,7 @@ void cmd_artv(char *cmdbuf) { char *serv_vandelay_init(void) { CtdlRegisterProtoHook(cmd_artv, "ARTV", "import/export data store"); + + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index fe20b40af..b8f7a4a0c 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -1384,5 +1384,6 @@ char *serv_vcard_init(void) chown(filename, CTDLUID, (-1)); } + /* return our Subversion id for the Log */ return "$Id$"; } diff --git a/citadel/server.h b/citadel/server.h index 46702117b..96949ed15 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -379,7 +379,6 @@ extern struct MessageFunctionHook *MessageHookTable; #define EVT_SMTPSCAN 203 /* called before submitting a msg from SMTP */ - /* * NetprocFunctionHook extensions are used for hooks which implement handlers * for incoming network messages. @@ -441,6 +440,17 @@ struct ServiceFunctionHook { extern struct ServiceFunctionHook *ServiceHookTable; +/* + * RoomFunctionHook extensions are used for hooks which impliment room + * processing functions when new messages are added EG. SIEVE. + */ +struct RoomFunctionHook { + struct RoomFunctionHook *next; + int (*fcn_ptr) (struct ctdlroom *); +}; +extern struct RoomFunctionHook *RoomHookTable; + + /* Defines the relationship of a user to a particular room */ struct visit {