diff --git a/ChangeLog b/ChangeLog index f31707cff..666270236 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-01-10 Pablo Polvorin + + * src/mod_vcard_odbc.erl: Fix bug in user search. + + * src/mod_vcard_ldap.erl, src/mod_vcard.erl, src/mod_configure.erl, + src/ejabberd_sm.erl, src/mod_privacy_odbc.erl, src/ejabberd_c2s.erl, + src/ejabberd_local.erl, src/mod_privacy.erl, src/mod_adhoc.erl, + src/mod_pubsub/mod_pubsub.erl, src/mod_vcard_odbc.erl, src/mod_stats.erl, + src/mod_last.erl, src/mod_private.erl, src/mod_roster.erl, + src/mod_disco.erl, src/mod_private_odbc.erl, src/mod_configure2.erl, + src/mod_roster_odbc.erl, src/mod_register.erl, src/mod_version.erl, + src/mod_caps.erl, src/mod_last_odbc.erl, src/mod_time.erl: Update + gen_iq_handler API, require the 'Host' argument to be in binary() format. + 2009-01-10 Christophe Romain * src/mod_pubsub/node_default.erl: fix unsubscription of full jid diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 1ea7de1df..266130320 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -1162,7 +1162,7 @@ handle_info({route, From, To, Packet}, StateName, StateData) -> true -> case exmpp_iq:get_request(Packet) of #xmlel{ns = ?NS_VCARD} -> - Host = binary_to_list(StateData#state.server), + Host = StateData#state.server, case ets:lookup(sm_iqtable, {?NS_VCARD, Host}) of [{_, Module, Function, Opts}] -> gen_iq_handler:handle(Host, Module, Function, Opts, diff --git a/src/ejabberd_local.erl b/src/ejabberd_local.erl index fe3ea584c..190e958b1 100644 --- a/src/ejabberd_local.erl +++ b/src/ejabberd_local.erl @@ -76,7 +76,7 @@ start_link() -> process_iq(From, To, Packet) -> case exmpp_iq:xmlel_to_iq(Packet) of #iq{kind = request, ns = XMLNS} = IQ_Rec -> - Host = exmpp_jid:ldomain_as_list(To), + Host = exmpp_jid:ldomain(To), case ets:lookup(?IQTABLE, {XMLNS, Host}) of [{_, Module, Function}] -> ResIQ = Module:Function(From, To, IQ_Rec), diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index 33ea18656..18d664680 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -661,7 +661,7 @@ get_max_user_sessions(JID) -> process_iq(From, To, Packet) -> case exmpp_iq:xmlel_to_iq(Packet) of #iq{kind = request, ns = XMLNS} = IQ_Rec -> - LServer = exmpp_jid:ldomain_as_list(To), + LServer = exmpp_jid:ldomain(To), case ets:lookup(sm_iqtable, {XMLNS, LServer}) of [{_, Module, Function}] -> ResIQ = Module:Function(From, To, IQ_Rec), diff --git a/src/mod_adhoc.erl b/src/mod_adhoc.erl index 9a92347ed..3769eb330 100644 --- a/src/mod_adhoc.erl +++ b/src/mod_adhoc.erl @@ -51,9 +51,9 @@ start(Host, Opts) -> HostB = list_to_binary(Host), IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_ADHOC, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_ADHOC, ?MODULE, process_local_iq, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ADHOC, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_ADHOC, ?MODULE, process_sm_iq, IQDisc), ejabberd_hooks:add(disco_local_identity, HostB, ?MODULE, get_local_identity, 99), @@ -76,8 +76,8 @@ stop(Host) -> ejabberd_hooks:delete(disco_local_features, HostB, ?MODULE, get_local_features, 99), ejabberd_hooks:delete(disco_local_identity, HostB, ?MODULE, get_local_identity, 99), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ADHOC), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ADHOC). + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_ADHOC), + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_ADHOC). %------------------------------------------------------------------------- diff --git a/src/mod_caps.erl b/src/mod_caps.erl index 19e24edd3..4363722d7 100644 --- a/src/mod_caps.erl +++ b/src/mod_caps.erl @@ -262,7 +262,7 @@ handle_cast({note_caps, From, 'node', lists:concat([Node, "#", SubNode])), Stanza = exmpp_iq:get(?NS_JABBER_CLIENT, Query, ID), ejabberd_local:register_iq_response_handler - (Host, ID, ?MODULE, handle_disco_response), + (list_to_binary(Host), ID, ?MODULE, handle_disco_response), ejabberd_router:route(exmpp_jid:make_bare_jid(Host), From, Stanza), timer:send_after(?CAPS_QUERY_TIMEOUT, self(), {disco_timeout, ID}), @@ -322,7 +322,7 @@ handle_cast({disco_timeout, ID}, #state{host = Host, disco_requests = Requests} %% do not wait a response anymore for this IQ, client certainly will never answer NewRequests = case ?DICT:is_key(ID, Requests) of true -> - ejabberd_local:unregister_iq_response_handler(Host, ID), + ejabberd_local:unregister_iq_response_handler(list_to_binary(Host), ID), ?DICT:erase(ID, Requests); false -> Requests diff --git a/src/mod_configure.erl b/src/mod_configure.erl index 1271e976a..00fcee006 100644 --- a/src/mod_configure.erl +++ b/src/mod_configure.erl @@ -84,8 +84,8 @@ stop(Host) -> ejabberd_hooks:delete(disco_local_identity, HostB, ?MODULE, get_local_identity, 50), ejabberd_hooks:delete(disco_local_features, HostB, ?MODULE, get_local_features, 50), ejabberd_hooks:delete(disco_local_items, HostB, ?MODULE, get_local_items, 50), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ADHOC), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ADHOC). + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_ADHOC), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_ADHOC). %%%----------------------------------------------------------------------- diff --git a/src/mod_configure2.erl b/src/mod_configure2.erl index 252a127bd..d5effc743 100644 --- a/src/mod_configure2.erl +++ b/src/mod_configure2.erl @@ -42,7 +42,7 @@ start(Host, Opts) -> IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE, + gen_iq_handler:add_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_ECONFIGURE, ?MODULE, process_local_iq, IQDisc), % Add nss/names/attrs used by this module to the known lists of Exmpp. exmpp_xml:add_autoload_known_nss([?NS_ECONFIGURE]), @@ -67,7 +67,7 @@ start(Host, Opts) -> ok. stop(Host) -> - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE). + gen_iq_handler:remove_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_ECONFIGURE). process_local_iq(From, To, #iq{type = Type, payload = Request} = IQ_Rec) -> diff --git a/src/mod_disco.erl b/src/mod_disco.erl index ab57c109e..6febc2453 100644 --- a/src/mod_disco.erl +++ b/src/mod_disco.erl @@ -64,13 +64,13 @@ start(Host, Opts) -> ejabberd_local:refresh_iq_handlers(), IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_DISCO_ITEMS, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_DISCO_ITEMS, ?MODULE, process_local_iq_items, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_DISCO_INFO, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_DISCO_INFO, ?MODULE, process_local_iq_info, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_DISCO_ITEMS, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_DISCO_ITEMS, ?MODULE, process_sm_iq_items, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_DISCO_INFO, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_DISCO_INFO, ?MODULE, process_sm_iq_info, IQDisc), catch ets:new(disco_features, [named_table, ordered_set, public]), @@ -103,10 +103,10 @@ stop(Host) -> ejabberd_hooks:delete(disco_local_identity, HostB, ?MODULE, get_local_identity, 100), ejabberd_hooks:delete(disco_local_features, HostB, ?MODULE, get_local_features, 100), ejabberd_hooks:delete(disco_local_items, HostB, ?MODULE, get_local_services, 100), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_DISCO_ITEMS), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_DISCO_INFO), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_DISCO_ITEMS), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_DISCO_INFO), + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_DISCO_ITEMS), + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_DISCO_INFO), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_DISCO_ITEMS), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_DISCO_INFO), catch ets:match_delete(disco_features, {{'_', Host}}), catch ets:match_delete(disco_extra_domains, {{'_', Host}}), ok. diff --git a/src/mod_last.erl b/src/mod_last.erl index b363db588..f1f8e7bda 100644 --- a/src/mod_last.erl +++ b/src/mod_last.erl @@ -53,9 +53,9 @@ start(Host, Opts) -> [{disc_copies, [node()]}, {attributes, record_info(fields, last_activity)}]), update_table(), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_LAST_ACTIVITY, ?MODULE, process_local_iq, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_LAST_ACTIVITY, ?MODULE, process_sm_iq, IQDisc), ejabberd_hooks:add(remove_user, HostB, ?MODULE, remove_user, 50), @@ -68,8 +68,8 @@ stop(Host) -> ?MODULE, remove_user, 50), ejabberd_hooks:delete(unset_presence_hook, HostB, ?MODULE, on_presence_update, 50), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY). + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_LAST_ACTIVITY), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_LAST_ACTIVITY). process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) -> Sec = trunc(element(1, erlang:statistics(wall_clock))/1000), diff --git a/src/mod_last_odbc.erl b/src/mod_last_odbc.erl index 286f19867..4eab4ffea 100644 --- a/src/mod_last_odbc.erl +++ b/src/mod_last_odbc.erl @@ -46,9 +46,9 @@ start(Host, Opts) -> HostB = list_to_binary(Host), IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_LAST_ACTIVITY, ?MODULE, process_local_iq, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_LAST_ACTIVITY, ?MODULE, process_sm_iq, IQDisc), ejabberd_hooks:add(remove_user, HostB, ?MODULE, remove_user, 50), @@ -61,8 +61,8 @@ stop(Host) -> ?MODULE, remove_user, 50), ejabberd_hooks:delete(unset_presence_hook, HostB, ?MODULE, on_presence_update, 50), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY). + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_LAST_ACTIVITY), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_LAST_ACTIVITY). process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) -> Sec = trunc(element(1, erlang:statistics(wall_clock))/1000), diff --git a/src/mod_privacy.erl b/src/mod_privacy.erl index 0b1352d5d..7d035994f 100644 --- a/src/mod_privacy.erl +++ b/src/mod_privacy.erl @@ -59,7 +59,7 @@ start(Host, Opts) -> ?MODULE, check_packet, 50), ejabberd_hooks:add(privacy_updated_list, HostB, ?MODULE, updated_list, 50), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_PRIVACY, ?MODULE, process_iq, IQDisc). stop(Host) -> @@ -74,7 +74,7 @@ stop(Host) -> ?MODULE, check_packet, 50), ejabberd_hooks:delete(privacy_updated_list, HostB, ?MODULE, updated_list, 50), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY). + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_PRIVACY). process_iq(_From, _To, IQ_Rec) -> exmpp_iq:error(IQ_Rec, 'not-allowed'). diff --git a/src/mod_privacy_odbc.erl b/src/mod_privacy_odbc.erl index 943354191..953a2dc2c 100644 --- a/src/mod_privacy_odbc.erl +++ b/src/mod_privacy_odbc.erl @@ -55,7 +55,7 @@ start(Host, Opts) -> ?MODULE, check_packet, 50), ejabberd_hooks:add(privacy_updated_list, HostB, ?MODULE, updated_list, 50), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_PRIVACY, ?MODULE, process_iq, IQDisc). stop(Host) -> @@ -70,7 +70,7 @@ stop(Host) -> ?MODULE, check_packet, 50), ejabberd_hooks:delete(privacy_updated_list, HostB, ?MODULE, updated_list, 50), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_PRIVACY). + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_PRIVACY). process_iq(_From, _To, IQ_Rec) -> exmpp_iq:error(IQ_Rec, 'not-allowed'). diff --git a/src/mod_private.erl b/src/mod_private.erl index a2c37a7bc..f4a30132e 100644 --- a/src/mod_private.erl +++ b/src/mod_private.erl @@ -49,14 +49,14 @@ start(Host, Opts) -> update_table(), ejabberd_hooks:add(remove_user, HostB, ?MODULE, remove_user, 50), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_PRIVATE, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_PRIVATE, ?MODULE, process_sm_iq, IQDisc). stop(Host) -> HostB = list_to_binary(Host), ejabberd_hooks:delete(remove_user, HostB, ?MODULE, remove_user, 50), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_PRIVATE). + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_PRIVATE). process_sm_iq(From, To, #iq{type = Type} = IQ_Rec) -> diff --git a/src/mod_private_odbc.erl b/src/mod_private_odbc.erl index 622b0df0b..59f9947d7 100644 --- a/src/mod_private_odbc.erl +++ b/src/mod_private_odbc.erl @@ -43,14 +43,14 @@ start(Host, Opts) -> IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), ejabberd_hooks:add(remove_user, HostB, ?MODULE, remove_user, 50), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_PRIVATE, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_PRIVATE, ?MODULE, process_sm_iq, IQDisc). stop(Host) -> HostB = list_to_binary(Host), ejabberd_hooks:delete(remove_user, HostB, ?MODULE, remove_user, 50), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_PRIVATE). + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_PRIVATE). process_sm_iq(From, To, #iq{type = Type} = IQ_Rec) -> diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index 96da35ef6..af4a57257 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -166,10 +166,11 @@ init([ServerHost, Opts]) -> ejabberd_hooks:add(presence_probe_hook, ServerHost, ?MODULE, presence_probe, 50), ejabberd_hooks:add(remove_user, ServerHost, ?MODULE, remove_user, 50), IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), + ServerB = list_to_binary(ServerHost), lists:foreach( fun({NS,Mod,Fun}) -> gen_iq_handler:add_iq_handler( - Mod, ServerHost, NS, ?MODULE, Fun, IQDisc) + Mod, ServerB, NS, ?MODULE, Fun, IQDisc) end, [{?NS_PUBSUB, ejabberd_local, iq_local}, {?NS_PUBSUB_OWNER, ejabberd_local, iq_local}, @@ -584,8 +585,9 @@ terminate(_Reason, #state{host = Host, ejabberd_hooks:delete(disco_sm_items, ServerHost, ?MODULE, disco_sm_items, 75), ejabberd_hooks:delete(presence_probe_hook, ServerHost, ?MODULE, presence_probe, 50), ejabberd_hooks:delete(remove_user, ServerHost, ?MODULE, remove_user, 50), + ServerB = list_to_binary(ServerHost), lists:foreach(fun({NS,Mod}) -> - gen_iq_handler:remove_iq_handler(Mod, ServerHost, NS) + gen_iq_handler:remove_iq_handler(Mod, ServerB, NS) end, [{?NS_PUBSUB, ejabberd_local}, {?NS_PUBSUB_OWNER, ejabberd_local}, {?NS_PUBSUB, ejabberd_sm}, diff --git a/src/mod_register.erl b/src/mod_register.erl index 2f1d37b38..3b66aeea8 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -42,9 +42,9 @@ start(Host, Opts) -> HostB = list_to_binary(Host), IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_INBAND_REGISTER, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_INBAND_REGISTER, ?MODULE, process_iq, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_INBAND_REGISTER, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_INBAND_REGISTER, ?MODULE, process_iq, IQDisc), ejabberd_hooks:add(c2s_stream_features, HostB, ?MODULE, stream_feature_register, 50), @@ -63,8 +63,8 @@ stop(Host) -> ?MODULE, stream_feature_register, 50), ejabberd_hooks:delete(c2s_unauthenticated_iq, HostB, ?MODULE, unauthenticated_iq_register, 50), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_INBAND_REGISTER), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_INBAND_REGISTER). + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_INBAND_REGISTER), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_INBAND_REGISTER). stream_feature_register(Acc) -> diff --git a/src/mod_roster.erl b/src/mod_roster.erl index 61de76362..05f0381ac 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -79,7 +79,7 @@ start(Host, Opts) -> ?MODULE, webadmin_page, 50), ejabberd_hooks:add(webadmin_user, HostB, ?MODULE, webadmin_user, 50), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ROSTER, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_ROSTER, ?MODULE, process_iq, IQDisc). stop(Host) -> @@ -104,7 +104,7 @@ stop(Host) -> ?MODULE, webadmin_page, 50), ejabberd_hooks:delete(webadmin_user, HostB, ?MODULE, webadmin_user, 50), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_ROSTER). diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl index 2e63508ed..39c301a4d 100644 --- a/src/mod_roster_odbc.erl +++ b/src/mod_roster_odbc.erl @@ -74,7 +74,7 @@ start(Host, Opts) -> ?MODULE, webadmin_page, 50), ejabberd_hooks:add(webadmin_user, HostB, ?MODULE, webadmin_user, 50), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ROSTER, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_ROSTER, ?MODULE, process_iq, IQDisc). stop(Host) -> @@ -99,7 +99,7 @@ stop(Host) -> ?MODULE, webadmin_page, 50), ejabberd_hooks:delete(webadmin_user, HostB, ?MODULE, webadmin_user, 50), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ROSTER). + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_ROSTER). process_iq(From, To, IQ_Rec) -> diff --git a/src/mod_stats.erl b/src/mod_stats.erl index b1f80a98e..f0b549660 100644 --- a/src/mod_stats.erl +++ b/src/mod_stats.erl @@ -37,11 +37,11 @@ start(Host, Opts) -> IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_STATS, + gen_iq_handler:add_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_STATS, ?MODULE, process_local_iq, IQDisc). stop(Host) -> - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_STATS). + gen_iq_handler:remove_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_STATS). process_local_iq(_From, To, #iq{type = get, diff --git a/src/mod_time.erl b/src/mod_time.erl index c8cdaff63..24ee78489 100644 --- a/src/mod_time.erl +++ b/src/mod_time.erl @@ -40,11 +40,11 @@ start(Host, Opts) -> IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_TIME, + gen_iq_handler:add_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_TIME, ?MODULE, process_local_iq, IQDisc). stop(Host) -> - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_TIME). + gen_iq_handler:remove_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_TIME). process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) -> UTC = jlib:timestamp_to_iso(calendar:universal_time()), diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index b465a14ed..d66912c65 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -85,9 +85,9 @@ start(Host, Opts) -> ejabberd_hooks:add(remove_user, HostB, ?MODULE, remove_user, 50), IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_VCARD, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_VCARD, ?MODULE, process_local_iq, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_VCARD, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_VCARD, ?MODULE, process_sm_iq, IQDisc), ejabberd_hooks:add(disco_sm_features, HostB, ?MODULE, get_sm_features, 50), MyHost = gen_mod:get_opt_host(Host, Opts, "vjud.@HOST@"), @@ -126,9 +126,9 @@ stop(Host) -> HostB = list_to_binary(Host), ejabberd_hooks:delete(remove_user, HostB, ?MODULE, remove_user, 50), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_VCARD), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_VCARD), ejabberd_hooks:delete(disco_sm_features, HostB, ?MODULE, get_sm_features, 50), Proc = gen_mod:get_module_proc(Host, ?PROCNAME), diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index b6f5a35d3..1279bcd7a 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -153,9 +153,10 @@ stop(Host) -> terminate(_Reason, State) -> Host = State#state.serverhost, - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_VCARD), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_VCARD), - ejabberd_hooks:delete(disco_sm_features, list_to_binary(Host), ?MODULE, get_sm_features, 50), + HostB = list_to_binary(Host), + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_VCARD), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_VCARD), + ejabberd_hooks:delete(disco_sm_features, HostB, ?MODULE, get_sm_features, 50), case State#state.search of true -> ejabberd_router:unregister_route(State#state.myhost); @@ -168,11 +169,12 @@ start_link(Host, Opts) -> gen_server:start_link({local, Proc}, ?MODULE, [Host, Opts], []). init([Host, Opts]) -> + HostB = list_to_binary(Host), State = parse_options(Host, Opts), IQDisc = gen_mod:get_opt(iqdisc, Opts, parallel), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_VCARD, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_VCARD, ?MODULE, process_local_iq, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_VCARD, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_VCARD, ?MODULE, process_sm_iq, IQDisc), ejabberd_hooks:add(disco_sm_features, list_to_binary(Host), ?MODULE, get_sm_features, 50), diff --git a/src/mod_vcard_odbc.erl b/src/mod_vcard_odbc.erl index a67412dff..c1f46b685 100644 --- a/src/mod_vcard_odbc.erl +++ b/src/mod_vcard_odbc.erl @@ -49,9 +49,9 @@ start(Host, Opts) -> ejabberd_hooks:add(remove_user, HostB, ?MODULE, remove_user, 50), IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_VCARD, + gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_VCARD, ?MODULE, process_local_iq, IQDisc), - gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_VCARD, + gen_iq_handler:add_iq_handler(ejabberd_sm, HostB, ?NS_VCARD, ?MODULE, process_sm_iq, IQDisc), ejabberd_hooks:add(disco_sm_features, HostB, ?MODULE, get_sm_features, 50), MyHost = gen_mod:get_opt_host(Host, Opts, "vjud.@HOST@"), @@ -90,8 +90,8 @@ stop(Host) -> HostB = list_to_binary(Host), ejabberd_hooks:delete(remove_user, HostB, ?MODULE, remove_user, 50), - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_VCARD), - gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_VCARD), + gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_VCARD), + gen_iq_handler:remove_iq_handler(ejabberd_sm, HostB, ?NS_VCARD), ejabberd_hooks:delete(disco_sm_features, HostB, ?MODULE, get_sm_features, 50), Proc = gen_mod:get_module_proc(Host, ?PROCNAME), Proc ! stop, @@ -295,35 +295,31 @@ do_route(ServerHost, From, To, Packet) -> Lang = exmpp_stanza:get_lang(Packet), case {Type, Request#xmlel.ns} of {set, ?NS_SEARCH} -> - XDataEl = find_xdata_el(Request), - case XDataEl of - false -> - Err = exmpp_iq:error(Packet, 'bad-request'), - ejabberd_router:route(To, From, Err); - _ -> - XData = jlib:parse_xdata_submit(XDataEl), - case XData of - invalid -> - Err = exmpp_iq:error(Packet, - 'bad-request'), - ejabberd_router:route(To, From, - Err); - _ -> - Result = #xmlel{ - ns = ?NS_SEARCH, - name = 'query', - children = [ - #xmlel{ - ns = ?NS_DATA_FORMS, - name = 'x', - attrs = [#xmlattr{name = 'type', - value = <<"result">>}], - children = search_result(Lang, - To, ServerHost, XData)}]}, - ResIQ = exmpp_iq:result(Packet, - Result), - ejabberd_router:route( - To, From, exmpp_iq:iq_to_xmlel(ResIQ)) + XDataEl = find_xdata_el(Request), + case XDataEl of + false -> + Err = exmpp_iq:error(Packet, 'bad-request'), + ejabberd_router:route(To, From, Err); + _ -> + XData = jlib:parse_xdata_submit(XDataEl), + case XData of + invalid -> + Err = exmpp_iq:error(Packet, 'bad-request'), + ejabberd_router:route(To, From, Err); + _ -> + Result = #xmlel{ns = ?NS_SEARCH, + name = 'query', + children = [ + #xmlel{ns = ?NS_DATA_FORMS, + name = 'x', + attrs = [ + #xmlattr{name = 'type', + value = <<"result">>}], + children = search_result(Lang, + To, ServerHost, XData)}]}, + ResIQ = exmpp_iq:result(Packet, Result), + ejabberd_router:route( + To, From, ResIQ) end end; {get, ?NS_SEARCH} -> diff --git a/src/mod_version.erl b/src/mod_version.erl index 19d154048..07d6dfec4 100644 --- a/src/mod_version.erl +++ b/src/mod_version.erl @@ -41,11 +41,11 @@ start(Host, Opts) -> IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_SOFT_VERSION, + gen_iq_handler:add_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_SOFT_VERSION, ?MODULE, process_local_iq, IQDisc). stop(Host) -> - gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_SOFT_VERSION). + gen_iq_handler:remove_iq_handler(ejabberd_local, list_to_binary(Host), ?NS_SOFT_VERSION). process_local_iq(_From, To, #iq{type = Type} = IQ_Rec) ->