From a10923c197cb7e6a894a527eca416662a57497ce Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Sat, 12 May 2007 16:28:34 +0000 Subject: [PATCH] * src/ejabberd_auth_anonymous.erl: Added anonymous_purge_hook (thanks to Christophe Romain and Mickael Remond) * src/mod_offline.erl: Likewise * src/mod_offline_odbc.erl: Likewise * src/mod_roster.erl: Likewise * src/mod_roster_odbc.erl: Likewise SVN Revision: 765 --- ChangeLog | 9 +++++++++ src/ejabberd_auth_anonymous.erl | 1 + src/mod_offline.erl | 4 ++++ src/mod_offline_odbc.erl | 4 ++++ src/mod_roster.erl | 4 ++++ src/mod_roster_odbc.erl | 4 ++++ 6 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index dff1af061..eca44b631 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-05-12 Alexey Shchepin + + * src/ejabberd_auth_anonymous.erl: Added anonymous_purge_hook + (thanks to Christophe Romain and Mickael Remond) + * src/mod_offline.erl: Likewise + * src/mod_offline_odbc.erl: Likewise + * src/mod_roster.erl: Likewise + * src/mod_roster_odbc.erl: Likewise + 2007-05-09 Alexey Shchepin * src/mod_muc/mod_muc.erl: Bugfix diff --git a/src/ejabberd_auth_anonymous.erl b/src/ejabberd_auth_anonymous.erl index 5090a353c..c3c4ed0c4 100644 --- a/src/ejabberd_auth_anonymous.erl +++ b/src/ejabberd_auth_anonymous.erl @@ -136,6 +136,7 @@ register_connection(SID, #jid{luser = LUser, lserver = LServer}) -> %% Remove an anonymous user from the anonymous users table unregister_connection(SID, #jid{luser = LUser, lserver = LServer}) -> + ejabberd_hooks:run(anonymous_purge_hook, jlib:nameprep(LServer), [LUser, LServer]), remove_connection(SID, LUser, LServer). %% --------------------------------- diff --git a/src/mod_offline.erl b/src/mod_offline.erl index 425406c9d..0f5f89935 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -41,6 +41,8 @@ start(Host, _Opts) -> ?MODULE, pop_offline_messages, 50), ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:add(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), register(gen_mod:get_module_proc(Host, ?PROCNAME), spawn(?MODULE, init, [])). @@ -85,6 +87,8 @@ stop(Host) -> ?MODULE, pop_offline_messages, 50), ejabberd_hooks:delete(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:delete(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), Proc = gen_mod:get_module_proc(Host, ?PROCNAME), exit(whereis(Proc), stop), {wait, Proc}. diff --git a/src/mod_offline_odbc.erl b/src/mod_offline_odbc.erl index e3ac67104..30c0f2bb5 100644 --- a/src/mod_offline_odbc.erl +++ b/src/mod_offline_odbc.erl @@ -32,6 +32,8 @@ start(Host, _Opts) -> ?MODULE, pop_offline_messages, 50), ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:add(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), register(gen_mod:get_module_proc(Host, ?PROCNAME), spawn(?MODULE, init, [Host])). @@ -94,6 +96,8 @@ stop(Host) -> ?MODULE, pop_offline_messages, 50), ejabberd_hooks:delete(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:delete(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), Proc = gen_mod:get_module_proc(Host, ?PROCNAME), exit(whereis(Proc), stop), ok. diff --git a/src/mod_roster.erl b/src/mod_roster.erl index 793892bdc..9d3974ac7 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -47,6 +47,8 @@ start(Host, Opts) -> ?MODULE, get_jid_info, 50), ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:add(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), ejabberd_hooks:add(resend_subscription_requests_hook, Host, ?MODULE, get_in_pending_subscriptions, 50), gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ROSTER, @@ -65,6 +67,8 @@ stop(Host) -> ?MODULE, get_jid_info, 50), ejabberd_hooks:delete(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:delete(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), ejabberd_hooks:delete(resend_subscription_requests_hook, Host, ?MODULE, get_in_pending_subscriptions, 50), gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ROSTER). diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl index ed79edef7..ff076dc5c 100644 --- a/src/mod_roster_odbc.erl +++ b/src/mod_roster_odbc.erl @@ -41,6 +41,8 @@ start(Host, Opts) -> ?MODULE, get_jid_info, 50), ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:add(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), ejabberd_hooks:add(resend_subscription_requests_hook, Host, ?MODULE, get_in_pending_subscriptions, 50), gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ROSTER, @@ -59,6 +61,8 @@ stop(Host) -> ?MODULE, get_jid_info, 50), ejabberd_hooks:delete(remove_user, Host, ?MODULE, remove_user, 50), + ejabberd_hooks:delete(anonymous_purge_hook, Host, + ?MODULE, remove_user, 50), ejabberd_hooks:delete(resend_subscription_requests_hook, Host, ?MODULE, get_in_pending_subscriptions, 50), gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ROSTER).