mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-01 17:53:00 +01:00
* src/odbc/odbc_queries.erl: Fix removal of private_storage of an
account when the account is removed * src/mod_privacy.erl: Remove privacy lists of an account when the account is removed (EJAB-720) * src/mod_privacy_odbc.erl: Likewise SVN Revision: 1742
This commit is contained in:
parent
4469880c2e
commit
74f15f790a
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2008-12-23 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/odbc/odbc_queries.erl: Fix removal of private_storage of an
|
||||
account when the account is removed
|
||||
|
||||
* src/mod_privacy.erl: Remove privacy lists of an account when the
|
||||
account is removed (EJAB-720)
|
||||
* src/mod_privacy_odbc.erl: Likewise
|
||||
|
||||
2008-12-19 Christophe Romain <christophe.romain@process-one.net>
|
||||
|
||||
|
||||
2008-12-19 Christophe Romain <christophe.romain@process-one.net>
|
||||
|
||||
* src/mod_pubsub/mod_pubsub.erl: Fix send_last_published_item issue
|
||||
|
@ -35,6 +35,7 @@
|
||||
process_iq_get/5,
|
||||
get_user_list/3,
|
||||
check_packet/6,
|
||||
remove_user/2,
|
||||
updated_list/3]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
@ -57,6 +58,8 @@ start(Host, Opts) ->
|
||||
?MODULE, check_packet, 50),
|
||||
ejabberd_hooks:add(privacy_updated_list, Host,
|
||||
?MODULE, updated_list, 50),
|
||||
ejabberd_hooks:add(remove_user, Host,
|
||||
?MODULE, remove_user, 50),
|
||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY,
|
||||
?MODULE, process_iq, IQDisc).
|
||||
|
||||
@ -71,6 +74,8 @@ stop(Host) ->
|
||||
?MODULE, check_packet, 50),
|
||||
ejabberd_hooks:delete(privacy_updated_list, Host,
|
||||
?MODULE, updated_list, 50),
|
||||
ejabberd_hooks:delete(remove_user, Host,
|
||||
?MODULE, remove_user, 50),
|
||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY).
|
||||
|
||||
process_iq(_From, _To, IQ) ->
|
||||
@ -659,6 +664,16 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
|
||||
end.
|
||||
|
||||
|
||||
remove_user(User, Server) ->
|
||||
LUser = jlib:nodeprep(User),
|
||||
LServer = jlib:nameprep(Server),
|
||||
F = fun() ->
|
||||
mnesia:delete({privacy,
|
||||
{LUser, LServer}})
|
||||
end,
|
||||
mnesia:transaction(F).
|
||||
|
||||
|
||||
updated_list(_,
|
||||
#userlist{name = OldName} = Old,
|
||||
#userlist{name = NewName} = New) ->
|
||||
@ -670,7 +685,6 @@ updated_list(_,
|
||||
end.
|
||||
|
||||
|
||||
|
||||
update_table() ->
|
||||
Fields = record_info(fields, privacy),
|
||||
case mnesia:table_info(privacy, attributes) of
|
||||
|
@ -35,6 +35,7 @@
|
||||
process_iq_get/5,
|
||||
get_user_list/3,
|
||||
check_packet/6,
|
||||
remove_user/2,
|
||||
updated_list/3]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
@ -53,6 +54,8 @@ start(Host, Opts) ->
|
||||
?MODULE, check_packet, 50),
|
||||
ejabberd_hooks:add(privacy_updated_list, Host,
|
||||
?MODULE, updated_list, 50),
|
||||
ejabberd_hooks:add(remove_user, Host,
|
||||
?MODULE, remove_user, 50),
|
||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY,
|
||||
?MODULE, process_iq, IQDisc).
|
||||
|
||||
@ -67,6 +70,8 @@ stop(Host) ->
|
||||
?MODULE, check_packet, 50),
|
||||
ejabberd_hooks:delete(privacy_updated_list, Host,
|
||||
?MODULE, updated_list, 50),
|
||||
ejabberd_hooks:delete(remove_user, Host,
|
||||
?MODULE, remove_user, 50),
|
||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY).
|
||||
|
||||
process_iq(_From, _To, IQ) ->
|
||||
@ -658,6 +663,12 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
|
||||
end.
|
||||
|
||||
|
||||
remove_user(User, Server) ->
|
||||
LUser = jlib:nodeprep(User),
|
||||
LServer = jlib:nameprep(Server),
|
||||
sql_del_privacy_lists(LUser, LServer).
|
||||
|
||||
|
||||
updated_list(_,
|
||||
#userlist{name = OldName} = Old,
|
||||
#userlist{name = NewName} = New) ->
|
||||
@ -873,3 +884,16 @@ sql_set_privacy_list(ID, RItems) ->
|
||||
") "
|
||||
"values ('", ID, "', ", Items, ");"])
|
||||
end, RItems).
|
||||
|
||||
sql_del_privacy_lists(LUser, LServer) ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
Server = ejabberd_odbc:escape(LServer),
|
||||
ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
["delete from privacy_list where username='", Username, "';"]),
|
||||
ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
["delete from privacy_list_data where value='", Username++"@"++Server, "';"]),
|
||||
ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
["delete from privacy_default_list where username='", Username, "';"]).
|
||||
|
@ -376,7 +376,7 @@ get_private_data(LServer, Username, LXMLNS) ->
|
||||
"namespace='", LXMLNS, "';"]).
|
||||
|
||||
del_user_private_storage(LServer, Username) ->
|
||||
ejabberd_odbc:sql_transaction(
|
||||
ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
["delete from private_storage where username='", Username, "';"]).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user