25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

"remove_user" hook actualized to expect binary arguments.

Fix webadmin code that performs addition / removal  of users.

SVN Revision: 1892
This commit is contained in:
Pablo Polvorin 2009-02-20 15:30:16 +00:00
parent edc0a9ac87
commit e989d41d50
8 changed files with 27 additions and 15 deletions

View File

@ -1,3 +1,13 @@
2009-02-20 Pablo Polvorin <pablo.polvorin@process-one.net>
* src/mod_offline_odbc.erl, src/mod_privacy_odbc.erl,
src/ejabberd_auth.erl, src/mod_vcard_odbc.erl,
src/mod_private_odbc.erl, src/mod_roster_odbc.erl: remove_user hook
actualized to expect binary arguments.
* src/web/ejabberd_web_admin.erl: Fix add / remove users.
2009-02-19 Christophe Romain <christophe.romain@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: fix nodetree plugin resolver

View File

@ -198,7 +198,7 @@ try_register(User, Server, Password)
end, {error, not_allowed}, auth_modules(Server)),
case Res of
{atomic, ok} ->
ejabberd_hooks:run(register_user, Server,
ejabberd_hooks:run(register_user, list_to_binary(Server),
[User, Server]),
{atomic, ok};
_ -> Res
@ -370,7 +370,8 @@ remove_user(User, Server) when is_list(User), is_list(Server) ->
M:remove_user(User, Server)
end, auth_modules(Server)),
case R of
ok -> ejabberd_hooks:run(remove_user, jlib:nameprep(Server), [User, Server]);
ok -> ejabberd_hooks:run(remove_user, list_to_binary(exmpp_stringprep:nameprep(Server)),
[list_to_binary(User), list_to_binary(Server)]);
_ -> none
end,
R.
@ -393,7 +394,8 @@ remove_user(User, Server, Password)
M:remove_user(User, Server, Password)
end, error, auth_modules(Server)),
case R of
ok -> ejabberd_hooks:run(remove_user, jlib:nameprep(Server), [User, Server]);
ok -> ejabberd_hooks:run(remove_user, list_to_binary(exmpp_stringprep:nameprep(Server)),
[list_to_binary(User), list_to_binary(Server)]);
_ -> none
end,
R.

View File

@ -279,8 +279,8 @@ pop_offline_messages(Ls, User, Server)
remove_user(User, Server)
when is_binary(User), is_binary(Server) ->
try
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
LUser = binary_to_list(exmpp_stringprep:nodeprep(User)),
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
Username = ejabberd_odbc:escape(LUser),
odbc_queries:del_spool_msg(LServer, Username)
catch

View File

@ -679,7 +679,7 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
remove_user(User, Server) ->
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
sql_del_privacy_lists(LUser, LServer).
sql_del_privacy_lists(binary_to_list(LUser), binary_to_list(LServer)).
updated_list(_,

View File

@ -171,8 +171,8 @@ end.
remove_user(User, Server) when is_binary(User), is_binary(Server) ->
try
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
LUser = binary_to_list(exmpp_stringprep:nodeprep(User)),
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
Username = ejabberd_odbc:escape(LUser),
odbc_queries:del_user_private_storage(LServer, Username)
catch

View File

@ -627,8 +627,8 @@ in_auto_reply(_, _, _) -> none.
remove_user(User, Server) when is_binary(User), is_binary(Server) ->
try
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
LUser = binary_to_list(exmpp_stringprep:nodeprep(User)),
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
Username = ejabberd_odbc:escape(LUser),
odbc_queries:del_user_roster_t(LServer, Username),
ok

View File

@ -612,9 +612,9 @@ make_val(Match, Field, Val) ->
% mnesia:transaction(F).
remove_user(User, Server) when is_binary(User), is_binary(server) ->
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
remove_user(User, Server) when is_binary(User), is_binary(Server) ->
LUser = binary_to_list(exmpp_stringprep:nodeprep(User)),
LServer = binary_to_list(exmpp_stringprep:nameprep(Server)),
Username = ejabberd_odbc:escape(LUser),
ejabberd_odbc:sql_transaction(
LServer,

View File

@ -1364,8 +1364,8 @@ list_users_parse_query(Query, Host) ->
lists:keysearch("newuserpassword", 1, Query),
try
JID = exmpp_jid:parse_jid(Username++"@"++Host),
User = exmpp_jid:node(JID),
Server = exmpp_jid:domain(JID),
User = exmpp_jid:node_as_list(JID),
Server = exmpp_jid:domain_as_list(JID),
case ejabberd_auth:try_register(User, Server, Password) of
{error, _Reason} ->
error;