mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
API renaming : jid_to_binary -> to_binary
SVN Revision: 2134
This commit is contained in:
parent
7a884ced32
commit
9abe47f350
@ -415,7 +415,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
?INFO_MSG(
|
?INFO_MSG(
|
||||||
"(~w) Accepted legacy authentication for ~s by ~s",
|
"(~w) Accepted legacy authentication for ~s by ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_binary(JID), AuthModule]),
|
exmpp_jid:to_binary(JID), AuthModule]),
|
||||||
SID = {now(), self()},
|
SID = {now(), self()},
|
||||||
Conn = get_conn_type(StateData),
|
Conn = get_conn_type(StateData),
|
||||||
Info = [{ip, StateData#state.ip}, {conn, Conn},
|
Info = [{ip, StateData#state.ip}, {conn, Conn},
|
||||||
@ -454,7 +454,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
?INFO_MSG(
|
?INFO_MSG(
|
||||||
"(~w) Failed legacy authentication for ~s",
|
"(~w) Failed legacy authentication for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_binary(JID)]),
|
exmpp_jid:to_binary(JID)]),
|
||||||
Res = exmpp_iq:error_without_original(El,
|
Res = exmpp_iq:error_without_original(El,
|
||||||
'not-authorized'),
|
'not-authorized'),
|
||||||
send_element(StateData, Res),
|
send_element(StateData, Res),
|
||||||
@ -464,7 +464,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
?INFO_MSG(
|
?INFO_MSG(
|
||||||
"(~w) Forbidden legacy authentication for ~s",
|
"(~w) Forbidden legacy authentication for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_binary(JID)]),
|
exmpp_jid:to_binary(JID)]),
|
||||||
Res = exmpp_iq:error_without_original(El,
|
Res = exmpp_iq:error_without_original(El,
|
||||||
'not-allowed'),
|
'not-allowed'),
|
||||||
send_element(StateData, Res),
|
send_element(StateData, Res),
|
||||||
@ -733,7 +733,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
|
|||||||
allow ->
|
allow ->
|
||||||
?INFO_MSG("(~w) Opened session for ~s",
|
?INFO_MSG("(~w) Opened session for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_binary(JID)]),
|
exmpp_jid:to_binary(JID)]),
|
||||||
SID = {now(), self()},
|
SID = {now(), self()},
|
||||||
Conn = get_conn_type(StateData),
|
Conn = get_conn_type(StateData),
|
||||||
Info = [{ip, StateData#state.ip}, {conn, Conn},
|
Info = [{ip, StateData#state.ip}, {conn, Conn},
|
||||||
@ -770,7 +770,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
|
|||||||
StateData#state.server, [JID]),
|
StateData#state.server, [JID]),
|
||||||
?INFO_MSG("(~w) Forbidden session for ~s",
|
?INFO_MSG("(~w) Forbidden session for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_binary(JID)]),
|
exmpp_jid:to_binary(JID)]),
|
||||||
Err = exmpp_server_session:error(El, 'not-allowed'),
|
Err = exmpp_server_session:error(El, 'not-allowed'),
|
||||||
send_element(StateData, Err),
|
send_element(StateData, Err),
|
||||||
fsm_next_state(wait_for_session, StateData)
|
fsm_next_state(wait_for_session, StateData)
|
||||||
@ -1222,7 +1222,7 @@ terminate(_Reason, StateName, StateData) ->
|
|||||||
replaced ->
|
replaced ->
|
||||||
?INFO_MSG("(~w) Replaced session for ~s",
|
?INFO_MSG("(~w) Replaced session for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_binary(StateData#state.jid)]),
|
exmpp_jid:to_binary(StateData#state.jid)]),
|
||||||
From = StateData#state.jid,
|
From = StateData#state.jid,
|
||||||
Packet = exmpp_presence:unavailable(),
|
Packet = exmpp_presence:unavailable(),
|
||||||
Packet1 = exmpp_presence:set_status(Packet,
|
Packet1 = exmpp_presence:set_status(Packet,
|
||||||
@ -1238,7 +1238,7 @@ terminate(_Reason, StateName, StateData) ->
|
|||||||
_ ->
|
_ ->
|
||||||
?INFO_MSG("(~w) Close session for ~s",
|
?INFO_MSG("(~w) Close session for ~s",
|
||||||
[StateData#state.socket,
|
[StateData#state.socket,
|
||||||
exmpp_jid:jid_to_binary(StateData#state.jid)]),
|
exmpp_jid:to_binary(StateData#state.jid)]),
|
||||||
|
|
||||||
EmptySet = ?SETS:new(),
|
EmptySet = ?SETS:new(),
|
||||||
case StateData of
|
case StateData of
|
||||||
|
@ -126,7 +126,7 @@ get_sm_commands(Acc, _From, To, <<>>, Lang) ->
|
|||||||
end,
|
end,
|
||||||
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
|
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'item', attrs =
|
name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(To)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(To)),
|
||||||
?XMLATTR('node', ?NS_ADHOC_s),
|
?XMLATTR('node', ?NS_ADHOC_s),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Commands"))]
|
?XMLATTR('name', translate:translate(Lang, "Commands"))]
|
||||||
}],
|
}],
|
||||||
|
@ -106,7 +106,7 @@ get_caps(LJID) ->
|
|||||||
get_caps(_, 0) ->
|
get_caps(_, 0) ->
|
||||||
nothing;
|
nothing;
|
||||||
get_caps({U, S, R}, Retry) ->
|
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
|
case catch mnesia:dirty_read({user_caps, BJID}) of
|
||||||
[#user_caps{caps=waiting}] ->
|
[#user_caps{caps=waiting}] ->
|
||||||
timer:sleep(2000),
|
timer:sleep(2000),
|
||||||
@ -120,7 +120,7 @@ get_caps({U, S, R}, Retry) ->
|
|||||||
%% clear_caps removes user caps from database
|
%% clear_caps removes user caps from database
|
||||||
clear_caps(JID) ->
|
clear_caps(JID) ->
|
||||||
R = exmpp_jid:prep_resource(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),
|
BUID = exmpp_jid:bare_jid_to_binary(JID),
|
||||||
catch mnesia:dirty_delete({user_caps, BJID}),
|
catch mnesia:dirty_delete({user_caps, BJID}),
|
||||||
catch mnesia:dirty_delete_object(#user_caps_resources{uid = BUID, resource = list_to_binary(R)}),
|
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),
|
U = exmpp_jid:prep_node(From),
|
||||||
S = exmpp_jid:prep_domain(From),
|
S = exmpp_jid:prep_domain(From),
|
||||||
R = exmpp_jid:resource(From),
|
R = exmpp_jid:resource(From),
|
||||||
BJID = exmpp_jid:jid_to_binary(From),
|
BJID = exmpp_jid:to_binary(From),
|
||||||
mnesia:transaction(fun() ->
|
mnesia:transaction(fun() ->
|
||||||
mnesia:dirty_write(#user_caps{jid = BJID, caps = caps_to_binary(Caps)}),
|
mnesia:dirty_write(#user_caps{jid = BJID, caps = caps_to_binary(Caps)}),
|
||||||
case ejabberd_sm:get_user_resources(U, S) of
|
case ejabberd_sm:get_user_resources(U, S) of
|
||||||
@ -360,7 +360,7 @@ handle_cast({note_caps, From,
|
|||||||
{noreply, State#state{disco_requests = NewRequests}}
|
{noreply, State#state{disco_requests = NewRequests}}
|
||||||
end;
|
end;
|
||||||
handle_cast({wait_caps, From}, State) ->
|
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}),
|
mnesia:dirty_write(#user_caps{jid = BJID, caps = waiting}),
|
||||||
{noreply, State};
|
{noreply, State};
|
||||||
handle_cast({disco_response, From, _To, #iq{id = ID, type = Type, payload = Payload}},
|
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),
|
%gen_server:cast(self(), visit_feature_queries),
|
||||||
%?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:to_list(From), SubEls]);
|
%?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:to_list(From), SubEls]);
|
||||||
{result, Payload} ->
|
{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
|
%% Can't do anything about errors
|
||||||
ok
|
ok
|
||||||
|
@ -100,7 +100,7 @@ stop(Host) ->
|
|||||||
|
|
||||||
-define(NODEJID(To, Name, Node),
|
-define(NODEJID(To, Name, Node),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#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('name', ?T(Lang, Name)),
|
||||||
?XMLATTR('node', Node)]}).
|
?XMLATTR('node', Node)]}).
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ adhoc_sm_items(Acc, From, To, Lang) ->
|
|||||||
empty -> []
|
empty -> []
|
||||||
end,
|
end,
|
||||||
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
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('name', ?T(Lang, "Configuration")),
|
||||||
?XMLATTR('node', <<"config">>)]}],
|
?XMLATTR('node', <<"config">>)]}],
|
||||||
{result, Items ++ Nodes};
|
{result, Items ++ Nodes};
|
||||||
@ -303,7 +303,7 @@ get_user_resources(BareJID) ->
|
|||||||
lists:map(fun(R) ->
|
lists:map(fun(R) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid',
|
[?XMLATTR('jid',
|
||||||
exmpp_jid:jid_to_binary(
|
exmpp_jid:to_binary(
|
||||||
exmpp_jid:full(BareJID, R))),
|
exmpp_jid:full(BareJID, R))),
|
||||||
?XMLATTR('name',
|
?XMLATTR('name',
|
||||||
exmpp_jid:prep_node(BareJID))]}
|
exmpp_jid:prep_node(BareJID))]}
|
||||||
@ -382,7 +382,7 @@ get_permission_level(JID) ->
|
|||||||
allow ->
|
allow ->
|
||||||
PermLev = get_permission_level(From),
|
PermLev = get_permission_level(From),
|
||||||
case get_local_items({PermLev, LServer}, LNode,
|
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} ->
|
||||||
{result, Res};
|
{result, Res};
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
@ -407,7 +407,7 @@ get_local_items(Acc, From, To, <<>>, Lang) ->
|
|||||||
allow ->
|
allow ->
|
||||||
PermLev = get_permission_level(From),
|
PermLev = get_permission_level(From),
|
||||||
case get_local_items({PermLev, LServer}, [],
|
case get_local_items({PermLev, LServer}, [],
|
||||||
exmpp_jid:jid_to_binary(To), Lang) of
|
exmpp_jid:to_binary(To), Lang) of
|
||||||
{result, Res} ->
|
{result, Res} ->
|
||||||
{result, Items ++ Res};
|
{result, Items ++ Res};
|
||||||
{error, _Error} ->
|
{error, _Error} ->
|
||||||
@ -530,8 +530,8 @@ get_local_items({_, Host}, ["all users", [$@ | Diap]], _Server, _Lang) ->
|
|||||||
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
||||||
lists:map(fun({S, U}) ->
|
lists:map(fun({S, U}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(U, S)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(U, S)),
|
||||||
?XMLATTR('name', exmpp_jid:jid_to_binary(U, S))]}
|
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
|
||||||
end, Sub)
|
end, Sub)
|
||||||
end of
|
end of
|
||||||
{'EXIT', _Reason} ->
|
{'EXIT', _Reason} ->
|
||||||
@ -623,8 +623,8 @@ get_online_vh_users(Host) ->
|
|||||||
SURs = lists:sort([{S, U, R} || {U, S, R} <- USRs]),
|
SURs = lists:sort([{S, U, R} || {U, S, R} <- USRs]),
|
||||||
lists:map(fun({S, U, R}) ->
|
lists:map(fun({S, U, R}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(U, S, R)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(U, S, R)),
|
||||||
?XMLATTR('name', exmpp_jid:jid_to_binary(U, S))]}
|
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
|
||||||
end, SURs)
|
end, SURs)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -638,8 +638,8 @@ get_all_vh_users(Host) ->
|
|||||||
N when N =< 100 ->
|
N when N =< 100 ->
|
||||||
lists:map(fun({S, U}) ->
|
lists:map(fun({S, U}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(U, S)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(U, S)),
|
||||||
?XMLATTR('name', exmpp_jid:jid_to_binary(U, S))]}
|
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
|
||||||
end, SUsers);
|
end, SUsers);
|
||||||
N ->
|
N ->
|
||||||
NParts = trunc(math:sqrt(N * 0.618)) + 1,
|
NParts = trunc(math:sqrt(N * 0.618)) + 1,
|
||||||
|
@ -397,7 +397,7 @@ get_user_resources(JID) ->
|
|||||||
lists:map(fun(R) ->
|
lists:map(fun(R) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
|
||||||
?XMLATTR('jid',
|
?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))
|
?XMLATTR('name', exmpp_jid:prep_node(JID))
|
||||||
]}
|
]}
|
||||||
end, lists:sort(Rs)).
|
end, lists:sort(Rs)).
|
||||||
|
@ -199,5 +199,5 @@ do_client_version(enabled, From, To) ->
|
|||||||
%% Print in log
|
%% Print in log
|
||||||
Values_string1 = [io_lib:format("~n~s: ~p", [N, V]) || {N, V} <- Values],
|
Values_string1 = [io_lib:format("~n~s: ~p", [N, V]) || {N, V} <- Values],
|
||||||
Values_string2 = lists:concat(Values_string1),
|
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]).
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ iq_disco_items(Host, From, Lang, none) when is_binary(Host) ->
|
|||||||
{true,
|
{true,
|
||||||
#xmlel{name = 'item',
|
#xmlel{name = 'item',
|
||||||
attrs = [?XMLATTR('jid',
|
attrs = [?XMLATTR('jid',
|
||||||
exmpp_jid:jid_to_binary(Name,
|
exmpp_jid:to_binary(Name,
|
||||||
Host)),
|
Host)),
|
||||||
?XMLATTR('name',
|
?XMLATTR('name',
|
||||||
Desc)]}};
|
Desc)]}};
|
||||||
|
@ -132,7 +132,7 @@ init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Creator, _Nick, D
|
|||||||
room_shaper = Shaper}),
|
room_shaper = Shaper}),
|
||||||
State1 = set_opts(DefRoomOpts, State),
|
State1 = set_opts(DefRoomOpts, State),
|
||||||
?INFO_MSG("Created MUC room ~s@~s by ~s",
|
?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};
|
{ok, normal_state, State1};
|
||||||
init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Opts]) ->
|
init([Host, ServerHost, Access, Room, HistorySize, RoomShaper, Opts]) ->
|
||||||
process_flag(trap_exit, true),
|
process_flag(trap_exit, true),
|
||||||
@ -585,11 +585,11 @@ handle_event({destroy, Reason}, _StateName, StateData) ->
|
|||||||
end}, StateData),
|
end}, StateData),
|
||||||
|
|
||||||
?INFO_MSG("Destroyed MUC room ~s with reason: ~p",
|
?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};
|
{stop, normal, StateData};
|
||||||
handle_event(destroy, StateName, StateData) ->
|
handle_event(destroy, StateName, StateData) ->
|
||||||
?INFO_MSG("Destroyed MUC room ~s",
|
?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({destroy, none}, StateName, StateData);
|
||||||
|
|
||||||
handle_event({set_affiliations, Affiliations}, 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
|
(?DICT:to_list(StateData1#state.users) == []) of
|
||||||
true ->
|
true ->
|
||||||
?INFO_MSG("Destroyed MUC room ~s because it's temporary and empty",
|
?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};
|
{stop, normal, StateData1};
|
||||||
_ ->
|
_ ->
|
||||||
{next_state, normal_state, 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
|
%% If this is an error stanza and its condition matches a criteria
|
||||||
true ->
|
true ->
|
||||||
Reason = io_lib:format("This participant is considered a ghost and is expulsed: ~s",
|
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};
|
{expulse_sender, Reason};
|
||||||
false ->
|
false ->
|
||||||
continue_delivery
|
continue_delivery
|
||||||
@ -1833,7 +1833,7 @@ send_new_presence(NJID, Reason, StateData) ->
|
|||||||
case (Info#user.role == moderator) orelse
|
case (Info#user.role == moderator) orelse
|
||||||
((StateData#state.config)#config.anonymous == false) of
|
((StateData#state.config)#config.anonymous == false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(RealJID)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
|
||||||
?XMLATTR('affiliation', SAffiliation),
|
?XMLATTR('affiliation', SAffiliation),
|
||||||
?XMLATTR('role', SRole)];
|
?XMLATTR('role', SRole)];
|
||||||
_ ->
|
_ ->
|
||||||
@ -1889,7 +1889,7 @@ send_existing_presences(ToJID, StateData) ->
|
|||||||
((StateData#state.config)#config.anonymous ==
|
((StateData#state.config)#config.anonymous ==
|
||||||
false) of
|
false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(FromJID)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(FromJID)),
|
||||||
?XMLATTR('affiliation',
|
?XMLATTR('affiliation',
|
||||||
affiliation_to_binary(FromAffiliation)),
|
affiliation_to_binary(FromAffiliation)),
|
||||||
?XMLATTR('role', role_to_binary(FromRole))];
|
?XMLATTR('role', role_to_binary(FromRole))];
|
||||||
@ -1946,7 +1946,7 @@ send_nick_changing(JID, OldNick, StateData) ->
|
|||||||
case (Info#user.role == moderator) orelse
|
case (Info#user.role == moderator) orelse
|
||||||
((StateData#state.config)#config.anonymous == false) of
|
((StateData#state.config)#config.anonymous == false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(RealJID)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
|
||||||
?XMLATTR('affiliation', SAffiliation),
|
?XMLATTR('affiliation', SAffiliation),
|
||||||
?XMLATTR('role', SRole),
|
?XMLATTR('role', SRole),
|
||||||
?XMLATTR('nick', Nick)];
|
?XMLATTR('nick', Nick)];
|
||||||
@ -1959,7 +1959,7 @@ send_nick_changing(JID, OldNick, StateData) ->
|
|||||||
case (Info#user.role == moderator) orelse
|
case (Info#user.role == moderator) orelse
|
||||||
((StateData#state.config)#config.anonymous == false) of
|
((StateData#state.config)#config.anonymous == false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:jid_to_binary(RealJID)),
|
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
|
||||||
?XMLATTR('affiliation', SAffiliation),
|
?XMLATTR('affiliation', SAffiliation),
|
||||||
?XMLATTR('role', SRole)];
|
?XMLATTR('role', SRole)];
|
||||||
_ ->
|
_ ->
|
||||||
@ -2151,7 +2151,7 @@ items_with_affiliation(SAffiliation, StateData) ->
|
|||||||
attrs = [?XMLATTR('affiliation',
|
attrs = [?XMLATTR('affiliation',
|
||||||
affiliation_to_binary(Affiliation)),
|
affiliation_to_binary(Affiliation)),
|
||||||
?XMLATTR('jid',
|
?XMLATTR('jid',
|
||||||
exmpp_jid:jid_to_binary(N, D, R))],
|
exmpp_jid:to_binary(N, D, R))],
|
||||||
children = [ #xmlel{name = 'reason',
|
children = [ #xmlel{name = 'reason',
|
||||||
children = [#xmlcdata{cdata = Reason}]}]};
|
children = [#xmlcdata{cdata = Reason}]}]};
|
||||||
|
|
||||||
@ -2161,7 +2161,7 @@ items_with_affiliation(SAffiliation, StateData) ->
|
|||||||
attrs = [?XMLATTR('affiliation',
|
attrs = [?XMLATTR('affiliation',
|
||||||
affiliation_to_binary(Affiliation)),
|
affiliation_to_binary(Affiliation)),
|
||||||
?XMLATTR('jid',
|
?XMLATTR('jid',
|
||||||
exmpp_jid:jid_to_binary(N, D, R))]}
|
exmpp_jid:to_binary(N, D, R))]}
|
||||||
end, search_affiliation(SAffiliation, StateData)).
|
end, search_affiliation(SAffiliation, StateData)).
|
||||||
|
|
||||||
user_to_item(#user{role = Role,
|
user_to_item(#user{role = Role,
|
||||||
@ -2174,7 +2174,7 @@ user_to_item(#user{role = Role,
|
|||||||
?XMLATTR('role', role_to_binary(Role)),
|
?XMLATTR('role', role_to_binary(Role)),
|
||||||
?XMLATTR('affiliation', affiliation_to_binary(Affiliation)),
|
?XMLATTR('affiliation', affiliation_to_binary(Affiliation)),
|
||||||
?XMLATTR('nick', Nick),
|
?XMLATTR('nick', Nick),
|
||||||
?XMLATTR('jid', exmpp_jid:jid_to_binary(JID))]
|
?XMLATTR('jid', exmpp_jid:to_binary(JID))]
|
||||||
}.
|
}.
|
||||||
|
|
||||||
search_role(Role, StateData) ->
|
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
|
case find_changed_items(UJID, UAffiliation, URole, Items, Lang, StateData, []) of
|
||||||
{result, Res} ->
|
{result, Res} ->
|
||||||
?INFO_MSG("Processing MUC admin query from ~s in room ~s:~n ~p",
|
?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 =
|
NSD =
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(E, SD) ->
|
fun(E, SD) ->
|
||||||
@ -2693,7 +2693,7 @@ process_iq_owner(From, set, Lang, SubEl, StateData) ->
|
|||||||
end;
|
end;
|
||||||
[#xmlel{name = 'destroy'} = SubEl1] ->
|
[#xmlel{name = 'destroy'} = SubEl1] ->
|
||||||
?INFO_MSG("Destroyed MUC room ~s by the owner ~s",
|
?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);
|
destroy_room(SubEl1, StateData);
|
||||||
Items ->
|
Items ->
|
||||||
process_admin_items_set(From, Items, Lang, StateData)
|
process_admin_items_set(From, Items, Lang, StateData)
|
||||||
@ -3289,7 +3289,7 @@ process_iq_disco_items(From, get, _Lang, StateData) ->
|
|||||||
fun({_LJID, Info}) ->
|
fun({_LJID, Info}) ->
|
||||||
Nick = Info#user.nick,
|
Nick = Info#user.nick,
|
||||||
#xmlel{name = 'item', attrs = [?XMLATTR('jid',
|
#xmlel{name = 'item', attrs = [?XMLATTR('jid',
|
||||||
exmpp_jid:jid_to_binary(
|
exmpp_jid:to_binary(
|
||||||
StateData#state.room,
|
StateData#state.room,
|
||||||
StateData#state.host,
|
StateData#state.host,
|
||||||
Nick)),
|
Nick)),
|
||||||
@ -3371,7 +3371,7 @@ check_invitation(From, Els, Lang, StateData) ->
|
|||||||
[#xmlel{ns = ?NS_MUC_USER,
|
[#xmlel{ns = ?NS_MUC_USER,
|
||||||
name = 'invite',
|
name = 'invite',
|
||||||
attrs = [?XMLATTR('from',
|
attrs = [?XMLATTR('from',
|
||||||
exmpp_jid:jid_to_binary(From))],
|
exmpp_jid:to_binary(From))],
|
||||||
children = [#xmlel{ns =?NS_MUC_USER, name = 'reason',
|
children = [#xmlel{ns =?NS_MUC_USER, name = 'reason',
|
||||||
children = [#xmlcdata{cdata = Reason} ]}]
|
children = [#xmlcdata{cdata = Reason} ]}]
|
||||||
++ ContinueEl}],
|
++ ContinueEl}],
|
||||||
@ -3391,8 +3391,8 @@ check_invitation(From, Els, Lang, StateData) ->
|
|||||||
io_lib:format(
|
io_lib:format(
|
||||||
translate:translate(Lang,
|
translate:translate(Lang,
|
||||||
"~s invites you to the room ~s"),
|
"~s invites you to the room ~s"),
|
||||||
[exmpp_jid:jid_to_binary(From),
|
[exmpp_jid:to_binary(From),
|
||||||
exmpp_jid:jid_to_binary(StateData#state.room,
|
exmpp_jid:to_binary(StateData#state.room,
|
||||||
StateData#state.host)
|
StateData#state.host)
|
||||||
]),
|
]),
|
||||||
case (StateData#state.config)#config.password_protected of
|
case (StateData#state.config)#config.password_protected of
|
||||||
@ -3417,7 +3417,7 @@ check_invitation(From, Els, Lang, StateData) ->
|
|||||||
children = IEl ++ PasswdEl},
|
children = IEl ++ PasswdEl},
|
||||||
#xmlel{ns = 'jabber:x:conference', name = 'x',
|
#xmlel{ns = 'jabber:x:conference', name = 'x',
|
||||||
attrs = [?XMLATTR('jid',
|
attrs = [?XMLATTR('jid',
|
||||||
exmpp_jid:jid_to_binary(
|
exmpp_jid:to_binary(
|
||||||
StateData#state.room,
|
StateData#state.room,
|
||||||
StateData#state.host)
|
StateData#state.host)
|
||||||
)],
|
)],
|
||||||
@ -3454,7 +3454,7 @@ check_decline_invitation(Packet) ->
|
|||||||
%% The original stanza must be slightly modified.
|
%% The original stanza must be slightly modified.
|
||||||
send_decline_invitation({Packet, XEl, DEl = #xmlel{name='decline'}, ToJID},
|
send_decline_invitation({Packet, XEl, DEl = #xmlel{name='decline'}, ToJID},
|
||||||
RoomJID, FromJID) ->
|
RoomJID, FromJID) ->
|
||||||
FromString = exmpp_jid:jid_to_binary(FromJID),
|
FromString = exmpp_jid:to_binary(FromJID),
|
||||||
|
|
||||||
DEl1 = exmpp_xml:remove_attribute(DEl, 'to'),
|
DEl1 = exmpp_xml:remove_attribute(DEl, 'to'),
|
||||||
DEl2 = exmpp_xml:set_attribute(DEl1, 'from',FromString),
|
DEl2 = exmpp_xml:set_attribute(DEl1, 'from',FromString),
|
||||||
|
@ -224,7 +224,7 @@ value_to_binary(Type, Val) ->
|
|||||||
case Type of
|
case Type of
|
||||||
jid ->
|
jid ->
|
||||||
{N, D, R} = Val,
|
{N, D, R} = Val,
|
||||||
exmpp_jid:jid_to_binary(N, D, R);
|
exmpp_jid:to_binary(N, D, R);
|
||||||
group -> Val;
|
group -> Val;
|
||||||
subscription ->
|
subscription ->
|
||||||
case Val of
|
case Val of
|
||||||
|
@ -230,7 +230,7 @@ value_to_binary(Type, Val) ->
|
|||||||
case Type of
|
case Type of
|
||||||
jid ->
|
jid ->
|
||||||
{N, D, R} = Val,
|
{N, D, R} = Val,
|
||||||
exmpp_jid:jid_to_binary(N, D, R);
|
exmpp_jid:to_binary(N, D, R);
|
||||||
group -> Val;
|
group -> Val;
|
||||||
subscription ->
|
subscription ->
|
||||||
case Val of
|
case Val of
|
||||||
|
@ -580,7 +580,7 @@ disco_sm_items(Acc, From, To, <<>>, _Lang) ->
|
|||||||
NodeItems = lists:map(
|
NodeItems = lists:map(
|
||||||
fun(#pubsub_node{nodeid = {_, Node}}) ->
|
fun(#pubsub_node{nodeid = {_, Node}}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#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))]}
|
?XMLATTR('node', node_to_string(Node))]}
|
||||||
end, Nodes),
|
end, Nodes),
|
||||||
{result, NodeItems ++ Items}
|
{result, NodeItems ++ Items}
|
||||||
@ -606,7 +606,7 @@ disco_sm_items(Acc, From, To, NodeB, _Lang) ->
|
|||||||
%% "node" is forbidden by XEP-0060.
|
%% "node" is forbidden by XEP-0060.
|
||||||
{result, Name} = node_action(Host, Node, get_item_name, [NodeId, Id]),
|
{result, Name} = node_action(Host, Node, get_item_name, [NodeId, Id]),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#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)]}
|
?XMLATTR('name', Name)]}
|
||||||
end, AllItems),
|
end, AllItems),
|
||||||
{result, NodeItems ++ Items};
|
{result, NodeItems ++ Items};
|
||||||
@ -1250,7 +1250,7 @@ send_authorization_request(#pubsub_node{owners = Owners, nodeid = {Host, Node}},
|
|||||||
?XMLATTR('type', <<"jid-single">>),
|
?XMLATTR('type', <<"jid-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Subscriber Address"))], children =
|
?XMLATTR('label', translate:translate(Lang, "Subscriber Address"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', 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 =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"pubsub#allow">>),
|
[?XMLATTR('var', <<"pubsub#allow">>),
|
||||||
?XMLATTR('type', <<"boolean">>),
|
?XMLATTR('type', <<"boolean">>),
|
||||||
@ -1296,7 +1296,7 @@ send_authorization_approval(Host, JID, SNode, Subscription) ->
|
|||||||
Stanza = event_stanza(
|
Stanza = event_stanza(
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
||||||
[?XMLATTR('node', SNode),
|
[?XMLATTR('node', SNode),
|
||||||
?XMLATTR('jid', exmpp_jid:jid_to_binary(JID)),
|
?XMLATTR('jid', exmpp_jid:to_binary(JID)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}]),
|
?XMLATTR('subscription', subscription_to_string(Subscription))]}]),
|
||||||
ejabberd_router ! {route, service_jid(Host), JID, Stanza}.
|
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
|
%% TODO, this is subscription-notification, should depends on node features
|
||||||
Fields =
|
Fields =
|
||||||
[?XMLATTR('node', node_to_string(Node)),
|
[?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))],
|
?XMLATTR('subscription', subscription_to_string(Subscription))],
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
@ -2104,7 +2104,7 @@ get_affiliations(Host, Node, JID) ->
|
|||||||
fun({_, none}) -> [];
|
fun({_, none}) -> [];
|
||||||
({{AU, AS, AR}, Affiliation}) ->
|
({{AU, AS, AR}, Affiliation}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliation', attrs =
|
[#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))]}]
|
?XMLATTR('affiliation', affiliation_to_string(Affiliation))]}]
|
||||||
end, Affiliations),
|
end, Affiliations),
|
||||||
{result, [#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
{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 =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('node', node_to_string(SubsNode)),
|
[?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))]}];
|
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
||||||
SubsNode ->
|
SubsNode ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#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))]}];
|
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
@ -2270,11 +2270,11 @@ get_subscriptions(Host, Node, JID) ->
|
|||||||
fun({_, none}) -> [];
|
fun({_, none}) -> [];
|
||||||
({{AU, AS, AR}, Subscription}) ->
|
({{AU, AS, AR}, Subscription}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
[#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('subscription', subscription_to_string(Subscription))]}];
|
||||||
({{AU, AS, AR}, Subscription, SubId}) ->
|
({{AU, AS, AR}, Subscription, SubId}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
[#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('subscription', subscription_to_string(Subscription)),
|
||||||
?XMLATTR('subid', SubId)]}]
|
?XMLATTR('subid', SubId)]}]
|
||||||
end, Subscriptions),
|
end, Subscriptions),
|
||||||
|
@ -200,7 +200,7 @@ get_user_roster(Acc, {U, S} = US) when is_binary(U), is_binary(S) ->
|
|||||||
item_to_xml(Item) ->
|
item_to_xml(Item) ->
|
||||||
{U, S, R} = Item#roster.jid,
|
{U, S, R} = Item#roster.jid,
|
||||||
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
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
|
Attrs2 = case Item#roster.name of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
Attrs1;
|
Attrs1;
|
||||||
@ -853,8 +853,8 @@ get_in_pending_subscriptions(Ls, User, Server)
|
|||||||
{U0, S0, R0} = R#roster.jid,
|
{U0, S0, R0} = R#roster.jid,
|
||||||
Pres1 = exmpp_presence:subscribe(),
|
Pres1 = exmpp_presence:subscribe(),
|
||||||
Pres2 = exmpp_stanza:set_jids(Pres1,
|
Pres2 = exmpp_stanza:set_jids(Pres1,
|
||||||
exmpp_jid:jid_to_binary(U0, S0, R0),
|
exmpp_jid:to_binary(U0, S0, R0),
|
||||||
exmpp_jid:jid_to_binary(JID)),
|
exmpp_jid:to_binary(JID)),
|
||||||
exmpp_presence:set_status(Pres2, Message)
|
exmpp_presence:set_status(Pres2, Message)
|
||||||
end,
|
end,
|
||||||
lists:filter(
|
lists:filter(
|
||||||
|
@ -160,7 +160,7 @@ get_roster(LUser, LServer) when is_binary(LUser), is_binary(LServer)->
|
|||||||
[];
|
[];
|
||||||
R ->
|
R ->
|
||||||
{U2, S2, R2} = R#roster.jid,
|
{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(
|
Groups = lists:flatmap(
|
||||||
fun({S, G}) when S == SJID ->
|
fun({S, G}) when S == SJID ->
|
||||||
[G];
|
[G];
|
||||||
@ -179,7 +179,7 @@ get_roster(LUser, LServer) when is_binary(LUser), is_binary(LServer)->
|
|||||||
item_to_xml(Item) ->
|
item_to_xml(Item) ->
|
||||||
{U, S, R} = Item#roster.jid,
|
{U, S, R} = Item#roster.jid,
|
||||||
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
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
|
Attrs2 = case Item#roster.name of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
Attrs1;
|
Attrs1;
|
||||||
@ -222,7 +222,7 @@ process_item_set(From, To, #xmlel{} = El) ->
|
|||||||
LServer = binary_to_list(Server),
|
LServer = binary_to_list(Server),
|
||||||
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
|
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
|
||||||
Username = ejabberd_odbc:escape(User),
|
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() ->
|
F = fun() ->
|
||||||
{selected,
|
{selected,
|
||||||
["username", "jid", "nick", "subscription",
|
["username", "jid", "nick", "subscription",
|
||||||
@ -426,7 +426,7 @@ process_subscription(Direction, User, Server, JID1, Type, Reason)
|
|||||||
LServer = binary_to_list(Server),
|
LServer = binary_to_list(Server),
|
||||||
{N0,D0,R0} = LJID = jlib:short_prepd_jid(JID1),
|
{N0,D0,R0} = LJID = jlib:short_prepd_jid(JID1),
|
||||||
Username = ejabberd_odbc:escape(User),
|
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() ->
|
F = fun() ->
|
||||||
Item =
|
Item =
|
||||||
case odbc_queries:get_roster_by_jid(LServer, Username, SJID) of
|
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', <<>>)),
|
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, 'jid', <<>>)),
|
||||||
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
|
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
|
||||||
Username = ejabberd_odbc:escape(LUser),
|
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},
|
Item = #roster{usj = {LUser, LServer, LJID},
|
||||||
us = {LUser, LServer},
|
us = {LUser, LServer},
|
||||||
jid = LJID},
|
jid = LJID},
|
||||||
@ -768,8 +768,8 @@ get_in_pending_subscriptions(Ls, User, Server)
|
|||||||
{U0, S0, R0} = R#roster.jid,
|
{U0, S0, R0} = R#roster.jid,
|
||||||
Pres1 = exmpp_presence:subscribe(),
|
Pres1 = exmpp_presence:subscribe(),
|
||||||
Pres2 = exmpp_stanza:set_jids(Pres1,
|
Pres2 = exmpp_stanza:set_jids(Pres1,
|
||||||
exmpp_jid:jid_to_binary(U0, S0, R0),
|
exmpp_jid:to_binary(U0, S0, R0),
|
||||||
exmpp_jid:jid_to_binary(JID)),
|
exmpp_jid:to_binary(JID)),
|
||||||
exmpp_presence:set_status(Pres2, Message)
|
exmpp_presence:set_status(Pres2, Message)
|
||||||
end,
|
end,
|
||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
@ -800,7 +800,7 @@ get_jid_info(_, User, Server, JID) when is_binary(User), is_binary(Server) ->
|
|||||||
LServer = binary_to_list(Server),
|
LServer = binary_to_list(Server),
|
||||||
LJID = {N, D, R} = jlib:short_prepd_jid(JID),
|
LJID = {N, D, R} = jlib:short_prepd_jid(JID),
|
||||||
Username = ejabberd_odbc:escape(User),
|
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
|
case catch odbc_queries:get_subscription(LServer, Username, SJID) of
|
||||||
{selected, ["subscription"], [{SSubscription}]} ->
|
{selected, ["subscription"], [{SSubscription}]} ->
|
||||||
Subscription = case SSubscription of
|
Subscription = case SSubscription of
|
||||||
@ -823,7 +823,7 @@ get_jid_info(_, User, Server, JID) when is_binary(User), is_binary(Server) ->
|
|||||||
{none, []};
|
{none, []};
|
||||||
true ->
|
true ->
|
||||||
{LR_N, LR_D, LR_R} = LRJID,
|
{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
|
case catch odbc_queries:get_subscription(LServer, Username, SRJID) of
|
||||||
{selected, ["subscription"], [{SSubscription}]} ->
|
{selected, ["subscription"], [{SSubscription}]} ->
|
||||||
Subscription = case SSubscription of
|
Subscription = case SSubscription of
|
||||||
@ -891,7 +891,7 @@ record_to_string(#roster{us = {User, _Server},
|
|||||||
askmessage = AskMessage}) ->
|
askmessage = AskMessage}) ->
|
||||||
Username = ejabberd_odbc:escape(User),
|
Username = ejabberd_odbc:escape(User),
|
||||||
{U, S, R} = JID,
|
{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),
|
Nick = ejabberd_odbc:escape(Name),
|
||||||
SSubscription = case Subscription of
|
SSubscription = case Subscription of
|
||||||
both -> "B";
|
both -> "B";
|
||||||
@ -915,7 +915,7 @@ groups_to_string(#roster{us = {User, _Server},
|
|||||||
groups = Groups}) ->
|
groups = Groups}) ->
|
||||||
Username = ejabberd_odbc:escape(User),
|
Username = ejabberd_odbc:escape(User),
|
||||||
{U, S, R} = JID,
|
{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
|
%% Empty groups do not need to be converted to string to be inserted in
|
||||||
%% the database
|
%% the database
|
||||||
|
Loading…
Reference in New Issue
Block a user