26
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-28 17:38:54 +01:00

API renaming : jid_to_binary -> to_binary

SVN Revision: 2134
This commit is contained in:
Karim Gemayel 2009-06-01 16:59:08 +00:00
parent 7a884ced32
commit 9abe47f350
13 changed files with 73 additions and 73 deletions

View File

@ -415,7 +415,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
?INFO_MSG(
"(~w) Accepted legacy authentication for ~s by ~s",
[StateData#state.socket,
exmpp_jid:jid_to_binary(JID), AuthModule]),
exmpp_jid:to_binary(JID), AuthModule]),
SID = {now(), self()},
Conn = get_conn_type(StateData),
Info = [{ip, StateData#state.ip}, {conn, Conn},
@ -454,7 +454,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
?INFO_MSG(
"(~w) Failed legacy authentication for ~s",
[StateData#state.socket,
exmpp_jid:jid_to_binary(JID)]),
exmpp_jid:to_binary(JID)]),
Res = exmpp_iq:error_without_original(El,
'not-authorized'),
send_element(StateData, Res),
@ -464,7 +464,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
?INFO_MSG(
"(~w) Forbidden legacy authentication for ~s",
[StateData#state.socket,
exmpp_jid:jid_to_binary(JID)]),
exmpp_jid:to_binary(JID)]),
Res = exmpp_iq:error_without_original(El,
'not-allowed'),
send_element(StateData, Res),
@ -733,7 +733,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
allow ->
?INFO_MSG("(~w) Opened session for ~s",
[StateData#state.socket,
exmpp_jid:jid_to_binary(JID)]),
exmpp_jid:to_binary(JID)]),
SID = {now(), self()},
Conn = get_conn_type(StateData),
Info = [{ip, StateData#state.ip}, {conn, Conn},
@ -770,7 +770,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
StateData#state.server, [JID]),
?INFO_MSG("(~w) Forbidden session for ~s",
[StateData#state.socket,
exmpp_jid:jid_to_binary(JID)]),
exmpp_jid:to_binary(JID)]),
Err = exmpp_server_session:error(El, 'not-allowed'),
send_element(StateData, Err),
fsm_next_state(wait_for_session, StateData)
@ -1222,7 +1222,7 @@ terminate(_Reason, StateName, StateData) ->
replaced ->
?INFO_MSG("(~w) Replaced session for ~s",
[StateData#state.socket,
exmpp_jid:jid_to_binary(StateData#state.jid)]),
exmpp_jid:to_binary(StateData#state.jid)]),
From = StateData#state.jid,
Packet = exmpp_presence:unavailable(),
Packet1 = exmpp_presence:set_status(Packet,
@ -1238,7 +1238,7 @@ terminate(_Reason, StateName, StateData) ->
_ ->
?INFO_MSG("(~w) Close session for ~s",
[StateData#state.socket,
exmpp_jid:jid_to_binary(StateData#state.jid)]),
exmpp_jid:to_binary(StateData#state.jid)]),
EmptySet = ?SETS:new(),
case StateData of

View File

@ -126,7 +126,7 @@ get_sm_commands(Acc, _From, To, <<>>, Lang) ->
end,
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(To)),
[?XMLATTR('jid', exmpp_jid:to_binary(To)),
?XMLATTR('node', ?NS_ADHOC_s),
?XMLATTR('name', translate:translate(Lang, "Commands"))]
}],

View File

@ -106,7 +106,7 @@ get_caps(LJID) ->
get_caps(_, 0) ->
nothing;
get_caps({U, S, R}, Retry) ->
BJID = exmpp_jid:jid_to_binary(U, S, R),
BJID = exmpp_jid:to_binary(U, S, R),
case catch mnesia:dirty_read({user_caps, BJID}) of
[#user_caps{caps=waiting}] ->
timer:sleep(2000),
@ -120,7 +120,7 @@ get_caps({U, S, R}, Retry) ->
%% clear_caps removes user caps from database
clear_caps(JID) ->
R = exmpp_jid:prep_resource(JID),
BJID = exmpp_jid:jid_to_binary(JID),
BJID = exmpp_jid:to_binary(JID),
BUID = exmpp_jid:bare_jid_to_binary(JID),
catch mnesia:dirty_delete({user_caps, BJID}),
catch mnesia:dirty_delete_object(#user_caps_resources{uid = BUID, resource = list_to_binary(R)}),
@ -317,7 +317,7 @@ handle_cast({note_caps, From,
U = exmpp_jid:prep_node(From),
S = exmpp_jid:prep_domain(From),
R = exmpp_jid:resource(From),
BJID = exmpp_jid:jid_to_binary(From),
BJID = exmpp_jid:to_binary(From),
mnesia:transaction(fun() ->
mnesia:dirty_write(#user_caps{jid = BJID, caps = caps_to_binary(Caps)}),
case ejabberd_sm:get_user_resources(U, S) of
@ -360,7 +360,7 @@ handle_cast({note_caps, From,
{noreply, State#state{disco_requests = NewRequests}}
end;
handle_cast({wait_caps, From}, State) ->
BJID = exmpp_jid:jid_to_binary(From),
BJID = exmpp_jid:to_binary(From),
mnesia:dirty_write(#user_caps{jid = BJID, caps = waiting}),
{noreply, State};
handle_cast({disco_response, From, _To, #iq{id = ID, type = Type, payload = Payload}},
@ -392,7 +392,7 @@ handle_cast({disco_response, From, _To, #iq{id = ID, type = Type, payload = Payl
%gen_server:cast(self(), visit_feature_queries),
%?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:to_list(From), SubEls]);
{result, Payload} ->
?DEBUG("Invalid IQ contents from ~s:~n~p", [exmpp_jid:jid_to_binary(From), Payload]);
?DEBUG("Invalid IQ contents from ~s:~n~p", [exmpp_jid:to_binary(From), Payload]);
_ ->
%% Can't do anything about errors
ok

View File

@ -100,7 +100,7 @@ stop(Host) ->
-define(NODEJID(To, Name, Node),
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(To)),
[?XMLATTR('jid', exmpp_jid:to_binary(To)),
?XMLATTR('name', ?T(Lang, Name)),
?XMLATTR('node', Node)]}).
@ -263,7 +263,7 @@ adhoc_sm_items(Acc, From, To, Lang) ->
empty -> []
end,
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(To)),
[?XMLATTR('jid', exmpp_jid:to_binary(To)),
?XMLATTR('name', ?T(Lang, "Configuration")),
?XMLATTR('node', <<"config">>)]}],
{result, Items ++ Nodes};
@ -303,7 +303,7 @@ get_user_resources(BareJID) ->
lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid',
exmpp_jid:jid_to_binary(
exmpp_jid:to_binary(
exmpp_jid:full(BareJID, R))),
?XMLATTR('name',
exmpp_jid:prep_node(BareJID))]}
@ -382,7 +382,7 @@ get_permission_level(JID) ->
allow ->
PermLev = get_permission_level(From),
case get_local_items({PermLev, LServer}, LNode,
exmpp_jid:jid_to_binary(To), Lang) of
exmpp_jid:to_binary(To), Lang) of
{result, Res} ->
{result, Res};
{error, Error} ->
@ -407,7 +407,7 @@ get_local_items(Acc, From, To, <<>>, Lang) ->
allow ->
PermLev = get_permission_level(From),
case get_local_items({PermLev, LServer}, [],
exmpp_jid:jid_to_binary(To), Lang) of
exmpp_jid:to_binary(To), Lang) of
{result, Res} ->
{result, Items ++ Res};
{error, _Error} ->
@ -530,8 +530,8 @@ get_local_items({_, Host}, ["all users", [$@ | Diap]], _Server, _Lang) ->
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
lists:map(fun({S, U}) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(U, S)),
?XMLATTR('name', exmpp_jid:jid_to_binary(U, S))]}
[?XMLATTR('jid', exmpp_jid:to_binary(U, S)),
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
end, Sub)
end of
{'EXIT', _Reason} ->
@ -623,8 +623,8 @@ get_online_vh_users(Host) ->
SURs = lists:sort([{S, U, R} || {U, S, R} <- USRs]),
lists:map(fun({S, U, R}) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(U, S, R)),
?XMLATTR('name', exmpp_jid:jid_to_binary(U, S))]}
[?XMLATTR('jid', exmpp_jid:to_binary(U, S, R)),
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
end, SURs)
end.
@ -638,8 +638,8 @@ get_all_vh_users(Host) ->
N when N =< 100 ->
lists:map(fun({S, U}) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(U, S)),
?XMLATTR('name', exmpp_jid:jid_to_binary(U, S))]}
[?XMLATTR('jid', exmpp_jid:to_binary(U, S)),
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
end, SUsers);
N ->
NParts = trunc(math:sqrt(N * 0.618)) + 1,

View File

@ -397,7 +397,7 @@ get_user_resources(JID) ->
lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
?XMLATTR('jid',
exmpp_jid:jid_to_binary(exmpp_jid:full(JID, R))),
exmpp_jid:to_binary(exmpp_jid:full(JID, R))),
?XMLATTR('name', exmpp_jid:prep_node(JID))
]}
end, lists:sort(Rs)).

View File

@ -199,5 +199,5 @@ do_client_version(enabled, From, To) ->
%% Print in log
Values_string1 = [io_lib:format("~n~s: ~p", [N, V]) || {N, V} <- Values],
Values_string2 = lists:concat(Values_string1),
?INFO_MSG("Information of the client: ~s~s", [exmpp_jid:jid_to_binary(To), Values_string2]).
?INFO_MSG("Information of the client: ~s~s", [exmpp_jid:to_binary(To), Values_string2]).

View File

@ -569,7 +569,7 @@ iq_disco_items(Host, From, Lang, none) when is_binary(Host) ->
{true,
#xmlel{name = 'item',
attrs = [?XMLATTR('jid',
exmpp_jid:jid_to_binary(Name,
exmpp_jid:to_binary(Name,
Host)),
?XMLATTR('name',
Desc)]}};

View File

@ -132,7 +132,7 @@ init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Creator, _Nick, D
room_shaper = Shaper}),
State1 = set_opts(DefRoomOpts, State),
?INFO_MSG("Created MUC room ~s@~s by ~s",
[Room, Host, exmpp_jid:jid_to_binary(Creator)]),
[Room, Host, exmpp_jid:to_binary(Creator)]),
{ok, normal_state, State1};
init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Opts]) ->
process_flag(trap_exit, true),
@ -585,11 +585,11 @@ handle_event({destroy, Reason}, _StateName, StateData) ->
end}, StateData),
?INFO_MSG("Destroyed MUC room ~s with reason: ~p",
[exmpp_jid:jid_to_binary(StateData#state.jid), Reason]),
[exmpp_jid:to_binary(StateData#state.jid), Reason]),
{stop, normal, StateData};
handle_event(destroy, StateName, StateData) ->
?INFO_MSG("Destroyed MUC room ~s",
[exmpp_jid:jid_to_binary(StateData#state.jid)]),
[exmpp_jid:to_binary(StateData#state.jid)]),
handle_event({destroy, none}, StateName, StateData);
handle_event({set_affiliations, Affiliations}, StateName, StateData) ->
@ -984,7 +984,7 @@ process_presence(From, Nick, #xmlel{name = 'presence'} = Packet,
(?DICT:to_list(StateData1#state.users) == []) of
true ->
?INFO_MSG("Destroyed MUC room ~s because it's temporary and empty",
[exmpp_jid:jid_to_binary(StateData#state.jid)]),
[exmpp_jid:to_binary(StateData#state.jid)]),
{stop, normal, StateData1};
_ ->
{next_state, normal_state, StateData1}
@ -1036,7 +1036,7 @@ decide_fate_message(error, Packet, From, StateData) ->
%% If this is an error stanza and its condition matches a criteria
true ->
Reason = io_lib:format("This participant is considered a ghost and is expulsed: ~s",
[exmpp_jid:jid_to_binary(From)]),
[exmpp_jid:to_binary(From)]),
{expulse_sender, Reason};
false ->
continue_delivery
@ -1833,7 +1833,7 @@ send_new_presence(NJID, Reason, StateData) ->
case (Info#user.role == moderator) orelse
((StateData#state.config)#config.anonymous == false) of
true ->
[?XMLATTR('jid', exmpp_jid:jid_to_binary(RealJID)),
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
?XMLATTR('affiliation', SAffiliation),
?XMLATTR('role', SRole)];
_ ->
@ -1889,7 +1889,7 @@ send_existing_presences(ToJID, StateData) ->
((StateData#state.config)#config.anonymous ==
false) of
true ->
[?XMLATTR('jid', exmpp_jid:jid_to_binary(FromJID)),
[?XMLATTR('jid', exmpp_jid:to_binary(FromJID)),
?XMLATTR('affiliation',
affiliation_to_binary(FromAffiliation)),
?XMLATTR('role', role_to_binary(FromRole))];
@ -1946,7 +1946,7 @@ send_nick_changing(JID, OldNick, StateData) ->
case (Info#user.role == moderator) orelse
((StateData#state.config)#config.anonymous == false) of
true ->
[?XMLATTR('jid', exmpp_jid:jid_to_binary(RealJID)),
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
?XMLATTR('affiliation', SAffiliation),
?XMLATTR('role', SRole),
?XMLATTR('nick', Nick)];
@ -1959,7 +1959,7 @@ send_nick_changing(JID, OldNick, StateData) ->
case (Info#user.role == moderator) orelse
((StateData#state.config)#config.anonymous == false) of
true ->
[?XMLATTR('jid', exmpp_jid:jid_to_binary(RealJID)),
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
?XMLATTR('affiliation', SAffiliation),
?XMLATTR('role', SRole)];
_ ->
@ -2151,7 +2151,7 @@ items_with_affiliation(SAffiliation, StateData) ->
attrs = [?XMLATTR('affiliation',
affiliation_to_binary(Affiliation)),
?XMLATTR('jid',
exmpp_jid:jid_to_binary(N, D, R))],
exmpp_jid:to_binary(N, D, R))],
children = [ #xmlel{name = 'reason',
children = [#xmlcdata{cdata = Reason}]}]};
@ -2161,7 +2161,7 @@ items_with_affiliation(SAffiliation, StateData) ->
attrs = [?XMLATTR('affiliation',
affiliation_to_binary(Affiliation)),
?XMLATTR('jid',
exmpp_jid:jid_to_binary(N, D, R))]}
exmpp_jid:to_binary(N, D, R))]}
end, search_affiliation(SAffiliation, StateData)).
user_to_item(#user{role = Role,
@ -2174,7 +2174,7 @@ user_to_item(#user{role = Role,
?XMLATTR('role', role_to_binary(Role)),
?XMLATTR('affiliation', affiliation_to_binary(Affiliation)),
?XMLATTR('nick', Nick),
?XMLATTR('jid', exmpp_jid:jid_to_binary(JID))]
?XMLATTR('jid', exmpp_jid:to_binary(JID))]
}.
search_role(Role, StateData) ->
@ -2201,7 +2201,7 @@ process_admin_items_set(UJID, Items, Lang, StateData) ->
case find_changed_items(UJID, UAffiliation, URole, Items, Lang, StateData, []) of
{result, Res} ->
?INFO_MSG("Processing MUC admin query from ~s in room ~s:~n ~p",
[exmpp_jid:jid_to_binary(UJID), exmpp_jid:jid_to_binary(StateData#state.jid), Res]),
[exmpp_jid:to_binary(UJID), exmpp_jid:to_binary(StateData#state.jid), Res]),
NSD =
lists:foldl(
fun(E, SD) ->
@ -2693,7 +2693,7 @@ process_iq_owner(From, set, Lang, SubEl, StateData) ->
end;
[#xmlel{name = 'destroy'} = SubEl1] ->
?INFO_MSG("Destroyed MUC room ~s by the owner ~s",
[exmpp_jid:jid_to_binary(StateData#state.jid), exmpp_jid:jid_to_binary(From)]),
[exmpp_jid:to_binary(StateData#state.jid), exmpp_jid:to_binary(From)]),
destroy_room(SubEl1, StateData);
Items ->
process_admin_items_set(From, Items, Lang, StateData)
@ -3289,7 +3289,7 @@ process_iq_disco_items(From, get, _Lang, StateData) ->
fun({_LJID, Info}) ->
Nick = Info#user.nick,
#xmlel{name = 'item', attrs = [?XMLATTR('jid',
exmpp_jid:jid_to_binary(
exmpp_jid:to_binary(
StateData#state.room,
StateData#state.host,
Nick)),
@ -3371,7 +3371,7 @@ check_invitation(From, Els, Lang, StateData) ->
[#xmlel{ns = ?NS_MUC_USER,
name = 'invite',
attrs = [?XMLATTR('from',
exmpp_jid:jid_to_binary(From))],
exmpp_jid:to_binary(From))],
children = [#xmlel{ns =?NS_MUC_USER, name = 'reason',
children = [#xmlcdata{cdata = Reason} ]}]
++ ContinueEl}],
@ -3391,8 +3391,8 @@ check_invitation(From, Els, Lang, StateData) ->
io_lib:format(
translate:translate(Lang,
"~s invites you to the room ~s"),
[exmpp_jid:jid_to_binary(From),
exmpp_jid:jid_to_binary(StateData#state.room,
[exmpp_jid:to_binary(From),
exmpp_jid:to_binary(StateData#state.room,
StateData#state.host)
]),
case (StateData#state.config)#config.password_protected of
@ -3417,7 +3417,7 @@ check_invitation(From, Els, Lang, StateData) ->
children = IEl ++ PasswdEl},
#xmlel{ns = 'jabber:x:conference', name = 'x',
attrs = [?XMLATTR('jid',
exmpp_jid:jid_to_binary(
exmpp_jid:to_binary(
StateData#state.room,
StateData#state.host)
)],
@ -3454,7 +3454,7 @@ check_decline_invitation(Packet) ->
%% The original stanza must be slightly modified.
send_decline_invitation({Packet, XEl, DEl = #xmlel{name='decline'}, ToJID},
RoomJID, FromJID) ->
FromString = exmpp_jid:jid_to_binary(FromJID),
FromString = exmpp_jid:to_binary(FromJID),
DEl1 = exmpp_xml:remove_attribute(DEl, 'to'),
DEl2 = exmpp_xml:set_attribute(DEl1, 'from',FromString),

View File

@ -224,7 +224,7 @@ value_to_binary(Type, Val) ->
case Type of
jid ->
{N, D, R} = Val,
exmpp_jid:jid_to_binary(N, D, R);
exmpp_jid:to_binary(N, D, R);
group -> Val;
subscription ->
case Val of

View File

@ -230,7 +230,7 @@ value_to_binary(Type, Val) ->
case Type of
jid ->
{N, D, R} = Val,
exmpp_jid:jid_to_binary(N, D, R);
exmpp_jid:to_binary(N, D, R);
group -> Val;
subscription ->
case Val of

View File

@ -580,7 +580,7 @@ disco_sm_items(Acc, From, To, <<>>, _Lang) ->
NodeItems = lists:map(
fun(#pubsub_node{nodeid = {_, Node}}) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(LJID)),
[?XMLATTR('jid', exmpp_jid:to_binary(LJID)),
?XMLATTR('node', node_to_string(Node))]}
end, Nodes),
{result, NodeItems ++ Items}
@ -606,7 +606,7 @@ disco_sm_items(Acc, From, To, NodeB, _Lang) ->
%% "node" is forbidden by XEP-0060.
{result, Name} = node_action(Host, Node, get_item_name, [NodeId, Id]),
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(LJID)),
[?XMLATTR('jid', exmpp_jid:to_binary(LJID)),
?XMLATTR('name', Name)]}
end, AllItems),
{result, NodeItems ++ Items};
@ -1250,7 +1250,7 @@ send_authorization_request(#pubsub_node{owners = Owners, nodeid = {Host, Node}},
?XMLATTR('type', <<"jid-single">>),
?XMLATTR('label', translate:translate(Lang, "Subscriber Address"))], children =
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
[#xmlcdata{cdata = exmpp_jid:jid_to_binary(U, S, R)}]}]},
[#xmlcdata{cdata = exmpp_jid:to_binary(U, S, R)}]}]},
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
[?XMLATTR('var', <<"pubsub#allow">>),
?XMLATTR('type', <<"boolean">>),
@ -1296,7 +1296,7 @@ send_authorization_approval(Host, JID, SNode, Subscription) ->
Stanza = event_stanza(
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
[?XMLATTR('node', SNode),
?XMLATTR('jid', exmpp_jid:jid_to_binary(JID)),
?XMLATTR('jid', exmpp_jid:to_binary(JID)),
?XMLATTR('subscription', subscription_to_string(Subscription))]}]),
ejabberd_router ! {route, service_jid(Host), JID, Stanza}.
@ -1633,7 +1633,7 @@ subscribe_node(Host, Node, From, JID) ->
%% TODO, this is subscription-notification, should depends on node features
Fields =
[?XMLATTR('node', node_to_string(Node)),
?XMLATTR('jid', exmpp_jid:jid_to_binary(Subscriber)),
?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
?XMLATTR('subscription', subscription_to_string(Subscription))],
[#xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
@ -2104,7 +2104,7 @@ get_affiliations(Host, Node, JID) ->
fun({_, none}) -> [];
({{AU, AS, AR}, Affiliation}) ->
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliation', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(AU, AS, AR)),
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
?XMLATTR('affiliation', affiliation_to_string(Affiliation))]}]
end, Affiliations),
{result, [#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
@ -2230,11 +2230,11 @@ get_subscriptions(Host, Node, JID, Plugins) when is_list(Plugins) ->
[] ->
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
[?XMLATTR('node', node_to_string(SubsNode)),
?XMLATTR('jid', exmpp_jid:jid_to_binary(SubJID)),
?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
SubsNode ->
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(SubJID)),
[?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
_ ->
[]
@ -2270,11 +2270,11 @@ get_subscriptions(Host, Node, JID) ->
fun({_, none}) -> [];
({{AU, AS, AR}, Subscription}) ->
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(AU, AS, AR)),
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
({{AU, AS, AR}, Subscription, SubId}) ->
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
[?XMLATTR('jid', exmpp_jid:jid_to_binary(AU, AS, AR)),
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
?XMLATTR('subscription', subscription_to_string(Subscription)),
?XMLATTR('subid', SubId)]}]
end, Subscriptions),

View File

@ -200,7 +200,7 @@ get_user_roster(Acc, {U, S} = US) when is_binary(U), is_binary(S) ->
item_to_xml(Item) ->
{U, S, R} = Item#roster.jid,
Attrs1 = exmpp_xml:set_attribute_in_list([],
'jid', exmpp_jid:jid_to_binary(U, S, R)),
'jid', exmpp_jid:to_binary(U, S, R)),
Attrs2 = case Item#roster.name of
<<>> ->
Attrs1;
@ -853,8 +853,8 @@ get_in_pending_subscriptions(Ls, User, Server)
{U0, S0, R0} = R#roster.jid,
Pres1 = exmpp_presence:subscribe(),
Pres2 = exmpp_stanza:set_jids(Pres1,
exmpp_jid:jid_to_binary(U0, S0, R0),
exmpp_jid:jid_to_binary(JID)),
exmpp_jid:to_binary(U0, S0, R0),
exmpp_jid:to_binary(JID)),
exmpp_presence:set_status(Pres2, Message)
end,
lists:filter(

View File

@ -160,7 +160,7 @@ get_roster(LUser, LServer) when is_binary(LUser), is_binary(LServer)->
[];
R ->
{U2, S2, R2} = R#roster.jid,
SJID = exmpp_jid:jid_to_binary(U2, S2, R2),
SJID = exmpp_jid:to_binary(U2, S2, R2),
Groups = lists:flatmap(
fun({S, G}) when S == SJID ->
[G];
@ -179,7 +179,7 @@ get_roster(LUser, LServer) when is_binary(LUser), is_binary(LServer)->
item_to_xml(Item) ->
{U, S, R} = Item#roster.jid,
Attrs1 = exmpp_xml:set_attribute_in_list([],
'jid', exmpp_jid:jid_to_binary(U, S, R)),
'jid', exmpp_jid:to_binary(U, S, R)),
Attrs2 = case Item#roster.name of
<<>> ->
Attrs1;
@ -222,7 +222,7 @@ process_item_set(From, To, #xmlel{} = El) ->
LServer = binary_to_list(Server),
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
Username = ejabberd_odbc:escape(User),
SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_binary(U0, S0, R0)),
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(U0, S0, R0)),
F = fun() ->
{selected,
["username", "jid", "nick", "subscription",
@ -426,7 +426,7 @@ process_subscription(Direction, User, Server, JID1, Type, Reason)
LServer = binary_to_list(Server),
{N0,D0,R0} = LJID = jlib:short_prepd_jid(JID1),
Username = ejabberd_odbc:escape(User),
SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_binary(N0,D0,R0)),
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(N0,D0,R0)),
F = fun() ->
Item =
case odbc_queries:get_roster_by_jid(LServer, Username, SJID) of
@ -699,7 +699,7 @@ process_item_set_t(LUser, LServer, #xmlel{} = El) ->
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, 'jid', <<>>)),
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
Username = ejabberd_odbc:escape(LUser),
SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_binary(U0, S0, R0)),
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(U0, S0, R0)),
Item = #roster{usj = {LUser, LServer, LJID},
us = {LUser, LServer},
jid = LJID},
@ -768,8 +768,8 @@ get_in_pending_subscriptions(Ls, User, Server)
{U0, S0, R0} = R#roster.jid,
Pres1 = exmpp_presence:subscribe(),
Pres2 = exmpp_stanza:set_jids(Pres1,
exmpp_jid:jid_to_binary(U0, S0, R0),
exmpp_jid:jid_to_binary(JID)),
exmpp_jid:to_binary(U0, S0, R0),
exmpp_jid:to_binary(JID)),
exmpp_presence:set_status(Pres2, Message)
end,
lists:flatmap(
@ -800,7 +800,7 @@ get_jid_info(_, User, Server, JID) when is_binary(User), is_binary(Server) ->
LServer = binary_to_list(Server),
LJID = {N, D, R} = jlib:short_prepd_jid(JID),
Username = ejabberd_odbc:escape(User),
SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_binary(N, D, R)),
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(N, D, R)),
case catch odbc_queries:get_subscription(LServer, Username, SJID) of
{selected, ["subscription"], [{SSubscription}]} ->
Subscription = case SSubscription of
@ -823,7 +823,7 @@ get_jid_info(_, User, Server, JID) when is_binary(User), is_binary(Server) ->
{none, []};
true ->
{LR_N, LR_D, LR_R} = LRJID,
SRJID = ejabberd_odbc:escape(exmpp_jid:jid_to_binary(LR_N, LR_D, LR_R)),
SRJID = ejabberd_odbc:escape(exmpp_jid:to_binary(LR_N, LR_D, LR_R)),
case catch odbc_queries:get_subscription(LServer, Username, SRJID) of
{selected, ["subscription"], [{SSubscription}]} ->
Subscription = case SSubscription of
@ -891,7 +891,7 @@ record_to_string(#roster{us = {User, _Server},
askmessage = AskMessage}) ->
Username = ejabberd_odbc:escape(User),
{U, S, R} = JID,
SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_binary(U, S, R)),
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(U, S, R)),
Nick = ejabberd_odbc:escape(Name),
SSubscription = case Subscription of
both -> "B";
@ -915,7 +915,7 @@ groups_to_string(#roster{us = {User, _Server},
groups = Groups}) ->
Username = ejabberd_odbc:escape(User),
{U, S, R} = JID,
SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_binary(U, S, R)),
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(U, S, R)),
%% Empty groups do not need to be converted to string to be inserted in
%% the database