mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
o Use the new functions from jlib.
o Use the new exmpp_xml:node_to_list/3. SVN Revision: 1391
This commit is contained in:
parent
290040ad9d
commit
cc033b3b98
@ -12,6 +12,10 @@
|
|||||||
* src/jlib.erl: Add function to convert to and from old ejabberd #jid
|
* src/jlib.erl: Add function to convert to and from old ejabberd #jid
|
||||||
record. Move function short_jid/1 from ejabberd_c2s.
|
record. Move function short_jid/1 from ejabberd_c2s.
|
||||||
|
|
||||||
|
* src/ejabberd_c2s.erl, src/ejabberd_s2s.erl, src/ejabberd_s2s_in.erl,
|
||||||
|
src/ejabberd_s2s_out.erl: Use the new functions from jlib. Use the new
|
||||||
|
exmpp_xml:node_to_list/3.
|
||||||
|
|
||||||
2008-06-27 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-06-27 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
* src/ejabberd_c2s.erl, src/ejabberd_s2s_out.erl,
|
* src/ejabberd_c2s.erl, src/ejabberd_s2s_out.erl,
|
||||||
|
@ -392,7 +392,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
try
|
try
|
||||||
JID = exmpp_jid:make_jid(U, StateData#state.server, R),
|
JID = exmpp_jid:make_jid(U, StateData#state.server, R),
|
||||||
% XXX OLD FORMAT: JID.
|
% XXX OLD FORMAT: JID.
|
||||||
JIDOld = exmpp_jid:to_ejabberd_jid(JID),
|
JIDOld = jlib:to_old_jid(JID),
|
||||||
case acl:match_rule(StateData#state.server,
|
case acl:match_rule(StateData#state.server,
|
||||||
StateData#state.access, JIDOld) of
|
StateData#state.access, JIDOld) of
|
||||||
allow ->
|
allow ->
|
||||||
@ -418,7 +418,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
StateData#state.server,
|
StateData#state.server,
|
||||||
{[], []},
|
{[], []},
|
||||||
[U, StateData#state.server]),
|
[U, StateData#state.server]),
|
||||||
LJID = short_jid(
|
LJID = jlib:short_jid(
|
||||||
exmpp_jid:jid_to_bare_jid(JID)),
|
exmpp_jid:jid_to_bare_jid(JID)),
|
||||||
Fs1 = [LJID | Fs],
|
Fs1 = [LJID | Fs],
|
||||||
Ts1 = [LJID | Ts],
|
Ts1 = [LJID | Ts],
|
||||||
@ -719,7 +719,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
|
|||||||
R = StateData#state.resource,
|
R = StateData#state.resource,
|
||||||
JID = StateData#state.jid,
|
JID = StateData#state.jid,
|
||||||
% XXX OLD FORMAT: JID.
|
% XXX OLD FORMAT: JID.
|
||||||
JIDOld = exmpp_jid:to_ejabberd_jid(JID),
|
JIDOld = jlib:to_old_jid(JID),
|
||||||
true = exmpp_server_session:want_establishment(El),
|
true = exmpp_server_session:want_establishment(El),
|
||||||
case acl:match_rule(StateData#state.server,
|
case acl:match_rule(StateData#state.server,
|
||||||
StateData#state.access, JIDOld) of
|
StateData#state.access, JIDOld) of
|
||||||
@ -741,7 +741,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
|
|||||||
StateData#state.server,
|
StateData#state.server,
|
||||||
{[], []},
|
{[], []},
|
||||||
[U, StateData#state.server]),
|
[U, StateData#state.server]),
|
||||||
LJID = short_jid(exmpp_jid:jid_to_bare_jid(JID)),
|
LJID = jlib:short_jid(exmpp_jid:jid_to_bare_jid(JID)),
|
||||||
Fs1 = [LJID | Fs],
|
Fs1 = [LJID | Fs],
|
||||||
Ts1 = [LJID | Ts],
|
Ts1 = [LJID | Ts],
|
||||||
PrivList =
|
PrivList =
|
||||||
@ -823,8 +823,8 @@ session_established({xmlstreamelement, El}, StateData) ->
|
|||||||
PresenceEl = exmpp_xml:xmlelement_to_xmlel(PresenceElOld,
|
PresenceEl = exmpp_xml:xmlelement_to_xmlel(PresenceElOld,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
% XXX OLD FORMAT: PresenceElOld, *JID.
|
% XXX OLD FORMAT: PresenceElOld, *JID.
|
||||||
FromJIDOld = exmpp_jid:to_ejabberd_jid(FromJID),
|
FromJIDOld = jlib:to_old_jid(FromJID),
|
||||||
ToJIDOld = exmpp_jid:to_ejabberd_jid(ToJID),
|
ToJIDOld = jlib:to_old_jid(ToJID),
|
||||||
ejabberd_hooks:run(
|
ejabberd_hooks:run(
|
||||||
user_send_packet,
|
user_send_packet,
|
||||||
Server,
|
Server,
|
||||||
@ -843,8 +843,8 @@ session_established({xmlstreamelement, El}, StateData) ->
|
|||||||
end;
|
end;
|
||||||
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'iq'} ->
|
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'iq'} ->
|
||||||
% XXX OLD FORMAT: JIDs.
|
% XXX OLD FORMAT: JIDs.
|
||||||
FromJIDOld = exmpp_jid:to_ejabberd_jid(FromJID),
|
FromJIDOld = jlib:to_old_jid(FromJID),
|
||||||
ToJIDOld = exmpp_jid:to_ejabberd_jid(ToJID),
|
ToJIDOld = jlib:to_old_jid(ToJID),
|
||||||
case exmpp_iq:get_payload(El) of
|
case exmpp_iq:get_payload(El) of
|
||||||
#xmlel{ns = ?NS_PRIVACY} ->
|
#xmlel{ns = ?NS_PRIVACY} ->
|
||||||
process_privacy_iq(
|
process_privacy_iq(
|
||||||
@ -866,8 +866,8 @@ session_established({xmlstreamelement, El}, StateData) ->
|
|||||||
% XXX OLD FORMAT: NewElOld, JIDs.
|
% XXX OLD FORMAT: NewElOld, JIDs.
|
||||||
NewElOld = exmpp_xml:xmlel_to_xmlelement(NewEl,
|
NewElOld = exmpp_xml:xmlel_to_xmlelement(NewEl,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
FromJIDOld = exmpp_jid:to_ejabberd_jid(FromJID),
|
FromJIDOld = jlib:to_old_jid(FromJID),
|
||||||
ToJIDOld = exmpp_jid:to_ejabberd_jid(ToJID),
|
ToJIDOld = jlib:to_old_jid(ToJID),
|
||||||
ejabberd_hooks:run(user_send_packet,
|
ejabberd_hooks:run(user_send_packet,
|
||||||
Server,
|
Server,
|
||||||
[FromJIDOld, ToJIDOld, NewElOld]),
|
[FromJIDOld, ToJIDOld, NewElOld]),
|
||||||
@ -1012,16 +1012,16 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
%% XXX OLD FORMAT: From, To and Packet are in the old format.
|
%% XXX OLD FORMAT: From, To and Packet are in the old format.
|
||||||
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
From = exmpp_jid:from_ejabberd_jid(FromOld),
|
From = jlib:from_old_jid(FromOld),
|
||||||
To = exmpp_jid:from_ejabberd_jid(ToOld),
|
To = jlib:from_old_jid(ToOld),
|
||||||
{Pass, NewAttrs, NewState} =
|
{Pass, NewAttrs, NewState} =
|
||||||
case Packet of
|
case Packet of
|
||||||
#xmlel{attrs = Attrs} when ?IS_PRESENCE(Packet) ->
|
#xmlel{attrs = Attrs} when ?IS_PRESENCE(Packet) ->
|
||||||
case exmpp_presence:get_type(Packet) of
|
case exmpp_presence:get_type(Packet) of
|
||||||
'probe' ->
|
'probe' ->
|
||||||
% XXX OLD FORMAT: LFrom and LBFrom.
|
% XXX OLD FORMAT: LFrom and LBFrom.
|
||||||
LFrom = short_jid(From),
|
LFrom = jlib:short_jid(From),
|
||||||
LBFrom = short_jid(exmpp_jid:jid_to_bare_jid(From)),
|
LBFrom = jlib:short_jid(exmpp_jid:jid_to_bare_jid(From)),
|
||||||
NewStateData =
|
NewStateData =
|
||||||
case ?SETS:is_element(
|
case ?SETS:is_element(
|
||||||
LFrom, StateData#state.pres_a) orelse
|
LFrom, StateData#state.pres_a) orelse
|
||||||
@ -1058,7 +1058,7 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
{false, Attrs, NewStateData};
|
{false, Attrs, NewStateData};
|
||||||
'error' ->
|
'error' ->
|
||||||
% XXX OLD FORMAT: LFrom.
|
% XXX OLD FORMAT: LFrom.
|
||||||
LFrom = short_jid(From),
|
LFrom = jlib:short_jid(From),
|
||||||
NewA = remove_element(LFrom,
|
NewA = remove_element(LFrom,
|
||||||
StateData#state.pres_a),
|
StateData#state.pres_a),
|
||||||
{true, Attrs, StateData#state{pres_a = NewA}};
|
{true, Attrs, StateData#state{pres_a = NewA}};
|
||||||
@ -1087,8 +1087,8 @@ handle_info({route, FromOld, ToOld, PacketOld}, StateName, StateData) ->
|
|||||||
in]) of
|
in]) of
|
||||||
allow ->
|
allow ->
|
||||||
% XXX OLD FORMAT: LFrom and LBFrom.
|
% XXX OLD FORMAT: LFrom and LBFrom.
|
||||||
LFrom = short_jid(From),
|
LFrom = jlib:short_jid(From),
|
||||||
LBFrom = short_jid(
|
LBFrom = jlib:short_jid(
|
||||||
exmpp_jid:jid_to_bare_jid(From)),
|
exmpp_jid:jid_to_bare_jid(From)),
|
||||||
%% Note contact availability
|
%% Note contact availability
|
||||||
% XXX OLD FORMAT: Els are #xmlelement.
|
% XXX OLD FORMAT: Els are #xmlelement.
|
||||||
@ -1336,7 +1336,7 @@ terminate(_Reason, StateName, StateData) ->
|
|||||||
|
|
||||||
change_shaper(StateData, JID) ->
|
change_shaper(StateData, JID) ->
|
||||||
% XXX OLD FORMAT: JIDOld is an old #jid.
|
% XXX OLD FORMAT: JIDOld is an old #jid.
|
||||||
JIDOld = exmpp_jid:to_ejabberd_jid(JID),
|
JIDOld = jlib:to_old_jid(JID),
|
||||||
Shaper = acl:match_rule(StateData#state.server,
|
Shaper = acl:match_rule(StateData#state.server,
|
||||||
StateData#state.shaper, JIDOld),
|
StateData#state.shaper, JIDOld),
|
||||||
(StateData#state.sockmod):change_shaper(StateData#state.socket, Shaper).
|
(StateData#state.sockmod):change_shaper(StateData#state.socket, Shaper).
|
||||||
@ -1402,8 +1402,8 @@ get_conn_type(StateData) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
process_presence_probe(From, To, StateData) ->
|
process_presence_probe(From, To, StateData) ->
|
||||||
LFrom = short_jid(From),
|
LFrom = jlib:short_jid(From),
|
||||||
LBFrom = short_jid(exmpp_jid:jid_to_bare_jid(From)),
|
LBFrom = jlib:short_jid(exmpp_jid:jid_to_bare_jid(From)),
|
||||||
case StateData#state.pres_last of
|
case StateData#state.pres_last of
|
||||||
undefined ->
|
undefined ->
|
||||||
ok;
|
ok;
|
||||||
@ -1425,8 +1425,8 @@ process_presence_probe(From, To, StateData) ->
|
|||||||
Cond1 ->
|
Cond1 ->
|
||||||
Packet = StateData#state.pres_last,
|
Packet = StateData#state.pres_last,
|
||||||
% XXX OLD FORMAT: From, To, Packet.
|
% XXX OLD FORMAT: From, To, Packet.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
case ejabberd_hooks:run_fold(
|
case ejabberd_hooks:run_fold(
|
||||||
@ -1455,8 +1455,8 @@ process_presence_probe(From, To, StateData) ->
|
|||||||
Cond2 ->
|
Cond2 ->
|
||||||
Packet = exmpp_presence:available(),
|
Packet = exmpp_presence:available(),
|
||||||
% XXX OLD FORMAT: From, To, Packet.
|
% XXX OLD FORMAT: From, To, Packet.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
ejabberd_router:route(ToOld, FromOld, PacketOld);
|
ejabberd_router:route(ToOld, FromOld, PacketOld);
|
||||||
@ -1546,7 +1546,7 @@ presence_update(From, Packet, StateData) ->
|
|||||||
if
|
if
|
||||||
FromUnavail ->
|
FromUnavail ->
|
||||||
% XXX OLD FORMAT: JID.
|
% XXX OLD FORMAT: JID.
|
||||||
JIDOld = exmpp_jid:to_ejabberd_jid(StateData#state.jid),
|
JIDOld = jlib:to_old_jid(StateData#state.jid),
|
||||||
ejabberd_hooks:run(user_available_hook,
|
ejabberd_hooks:run(user_available_hook,
|
||||||
StateData#state.server,
|
StateData#state.server,
|
||||||
[JIDOld]),
|
[JIDOld]),
|
||||||
@ -1579,13 +1579,13 @@ presence_update(From, Packet, StateData) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
presence_track(From, To, Packet, StateData) ->
|
presence_track(From, To, Packet, StateData) ->
|
||||||
LTo = short_jid(To),
|
LTo = jlib:short_jid(To),
|
||||||
User = StateData#state.user,
|
User = StateData#state.user,
|
||||||
Server = StateData#state.server,
|
Server = StateData#state.server,
|
||||||
% XXX OLD FORMAT: From, To, Packet.
|
% XXX OLD FORMAT: From, To, Packet.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
BFromOld = exmpp_jid:to_ejabberd_jid(exmpp_jid:jid_to_bare_jid(From)),
|
BFromOld = jlib:to_old_jid(exmpp_jid:jid_to_bare_jid(From)),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
case exmpp_presence:get_type(Packet) of
|
case exmpp_presence:get_type(Packet) of
|
||||||
@ -1669,8 +1669,8 @@ presence_broadcast(StateData, From, JIDSet, Packet) ->
|
|||||||
lists:foreach(fun({U, S, R}) ->
|
lists:foreach(fun({U, S, R}) ->
|
||||||
FJID = exmpp_jid:make_jid(U, S, R),
|
FJID = exmpp_jid:make_jid(U, S, R),
|
||||||
% XXX OLD FORMAT: From, FJID, Packet.
|
% XXX OLD FORMAT: From, FJID, Packet.
|
||||||
FJIDOld = exmpp_jid:to_ejabberd_jid(FJID),
|
FJIDOld = jlib:to_old_jid(FJID),
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
case ejabberd_hooks:run_fold(
|
case ejabberd_hooks:run_fold(
|
||||||
@ -1691,7 +1691,7 @@ presence_broadcast(StateData, From, JIDSet, Packet) ->
|
|||||||
|
|
||||||
presence_broadcast_to_trusted(StateData, From, T, A, Packet) ->
|
presence_broadcast_to_trusted(StateData, From, T, A, Packet) ->
|
||||||
% XXX OLD FORMAT: From, Packet.
|
% XXX OLD FORMAT: From, Packet.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
@ -1700,7 +1700,7 @@ presence_broadcast_to_trusted(StateData, From, T, A, Packet) ->
|
|||||||
true ->
|
true ->
|
||||||
FJID = exmpp_jid:make_jid(U, S, R),
|
FJID = exmpp_jid:make_jid(U, S, R),
|
||||||
% XXX OLD FORMAT: FJID.
|
% XXX OLD FORMAT: FJID.
|
||||||
FJIDOld = exmpp_jid:to_ejabberd_jid(FJID),
|
FJIDOld = jlib:to_old_jid(FJID),
|
||||||
case ejabberd_hooks:run_fold(
|
case ejabberd_hooks:run_fold(
|
||||||
privacy_check_packet, StateData#state.server,
|
privacy_check_packet, StateData#state.server,
|
||||||
allow,
|
allow,
|
||||||
@ -1724,7 +1724,7 @@ presence_broadcast_to_trusted(StateData, From, T, A, Packet) ->
|
|||||||
presence_broadcast_first(From, StateData, Packet) ->
|
presence_broadcast_first(From, StateData, Packet) ->
|
||||||
Probe = exmpp_presence:probe(),
|
Probe = exmpp_presence:probe(),
|
||||||
% XXX OLD FORMAT: From, Packet, Probe.
|
% XXX OLD FORMAT: From, Packet, Probe.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
PacketOld = exmpp_xml:xmlel_to_xmlelement(Packet,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
ProbeOld = exmpp_xml:xmlel_to_xmlelement(Probe,
|
ProbeOld = exmpp_xml:xmlel_to_xmlelement(Probe,
|
||||||
@ -1732,7 +1732,7 @@ presence_broadcast_first(From, StateData, Packet) ->
|
|||||||
?SETS:fold(fun({U, S, R}, X) ->
|
?SETS:fold(fun({U, S, R}, X) ->
|
||||||
FJID = exmpp_jid:make_jid(U, S, R),
|
FJID = exmpp_jid:make_jid(U, S, R),
|
||||||
% XXX OLD FORMAT: FJID.
|
% XXX OLD FORMAT: FJID.
|
||||||
FJIDOld = exmpp_jid:to_ejabberd_jid(FJID),
|
FJIDOld = jlib:to_old_jid(FJID),
|
||||||
ejabberd_router:route(
|
ejabberd_router:route(
|
||||||
FromOld,
|
FromOld,
|
||||||
FJIDOld,
|
FJIDOld,
|
||||||
@ -1749,7 +1749,7 @@ presence_broadcast_first(From, StateData, Packet) ->
|
|||||||
fun({U, S, R} = JID, A) ->
|
fun({U, S, R} = JID, A) ->
|
||||||
FJID = exmpp_jid:make_jid(U, S, R),
|
FJID = exmpp_jid:make_jid(U, S, R),
|
||||||
% XXX OLD FORMAT: FJID.
|
% XXX OLD FORMAT: FJID.
|
||||||
FJIDOld = exmpp_jid:to_ejabberd_jid(FJID),
|
FJIDOld = jlib:to_old_jid(FJID),
|
||||||
case ejabberd_hooks:run_fold(
|
case ejabberd_hooks:run_fold(
|
||||||
privacy_check_packet, StateData#state.server,
|
privacy_check_packet, StateData#state.server,
|
||||||
allow,
|
allow,
|
||||||
@ -1781,7 +1781,7 @@ remove_element(E, Set) ->
|
|||||||
|
|
||||||
|
|
||||||
roster_change(IJID, ISubscription, StateData) ->
|
roster_change(IJID, ISubscription, StateData) ->
|
||||||
LIJID = short_jid(IJID),
|
LIJID = jlib:short_jid(IJID),
|
||||||
IsFrom = (ISubscription == both) or (ISubscription == from),
|
IsFrom = (ISubscription == both) or (ISubscription == from),
|
||||||
IsTo = (ISubscription == both) or (ISubscription == to),
|
IsTo = (ISubscription == both) or (ISubscription == to),
|
||||||
OldIsFrom = ?SETS:is_element(LIJID, StateData#state.pres_f),
|
OldIsFrom = ?SETS:is_element(LIJID, StateData#state.pres_f),
|
||||||
@ -1805,8 +1805,8 @@ roster_change(IJID, ISubscription, StateData) ->
|
|||||||
From = StateData#state.jid,
|
From = StateData#state.jid,
|
||||||
To = IJID,
|
To = IJID,
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
Cond1 = (not StateData#state.pres_invis) and IsFrom
|
Cond1 = (not StateData#state.pres_invis) and IsFrom
|
||||||
and (not OldIsFrom),
|
and (not OldIsFrom),
|
||||||
Cond2 = (not IsFrom) and OldIsFrom
|
Cond2 = (not IsFrom) and OldIsFrom
|
||||||
@ -1894,8 +1894,8 @@ process_privacy_iq(From, To,
|
|||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
IQOld = jlib:iq_query_info(ElOld),
|
IQOld = jlib:iq_query_info(ElOld),
|
||||||
% XXX OLD FORMAT: JIDs.
|
% XXX OLD FORMAT: JIDs.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
{Res, NewStateData} =
|
{Res, NewStateData} =
|
||||||
case exmpp_iq:get_type(El) of
|
case exmpp_iq:get_type(El) of
|
||||||
get ->
|
get ->
|
||||||
@ -1963,8 +1963,8 @@ resend_offline_messages(#state{user = User,
|
|||||||
if
|
if
|
||||||
Pass ->
|
Pass ->
|
||||||
% XXX OLD FORMAT: From, To, Packet.
|
% XXX OLD FORMAT: From, To, Packet.
|
||||||
From = exmpp_jid:from_ejabberd_jid(FromOld),
|
From = jlib:from_old_jid(FromOld),
|
||||||
To = exmpp_jid:from_ejabberd_jid(ToOld),
|
To = jlib:from_old_jid(ToOld),
|
||||||
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
Attrs1 = exmpp_stanza:set_sender_in_attrs(
|
Attrs1 = exmpp_stanza:set_sender_in_attrs(
|
||||||
@ -2053,7 +2053,3 @@ fsm_reply(Reply, StateName, StateData) ->
|
|||||||
%% Used by c2s blacklist plugins
|
%% Used by c2s blacklist plugins
|
||||||
is_ip_blacklisted({IP,_Port}) ->
|
is_ip_blacklisted({IP,_Port}) ->
|
||||||
ejabberd_hooks:run_fold(check_bl_c2s, false, [IP]).
|
ejabberd_hooks:run_fold(check_bl_c2s, false, [IP]).
|
||||||
|
|
||||||
short_jid(JID0) ->
|
|
||||||
JID = exmpp_jid:to_ejabberd_jid(JID0),
|
|
||||||
{JID#jid.lnode, JID#jid.ldomain, JID#jid.lresource}.
|
|
||||||
|
@ -76,8 +76,8 @@ start_link() ->
|
|||||||
|
|
||||||
route(FromOld, ToOld, PacketOld) ->
|
route(FromOld, ToOld, PacketOld) ->
|
||||||
% XXX OLD FORMAT: From, To, Packet.
|
% XXX OLD FORMAT: From, To, Packet.
|
||||||
From = exmpp_jid:from_ejabberd_jid(FromOld),
|
From = jlib:from_old_jid(FromOld),
|
||||||
To = exmpp_jid:from_ejabberd_jid(ToOld),
|
To = jlib:from_old_jid(ToOld),
|
||||||
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
case catch do_route(From, To, Packet) of
|
case catch do_route(From, To, Packet) of
|
||||||
@ -216,8 +216,8 @@ handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
|
|||||||
{noreply, State};
|
{noreply, State};
|
||||||
handle_info({route, FromOld, ToOld, PacketOld}, State) ->
|
handle_info({route, FromOld, ToOld, PacketOld}, State) ->
|
||||||
% XXX OLD FORMAT: From, To, Packet
|
% XXX OLD FORMAT: From, To, Packet
|
||||||
From = exmpp_jid:from_ejabberd_jid(FromOld),
|
From = jlib:from_old_jid(FromOld),
|
||||||
To = exmpp_jid:from_ejabberd_jid(ToOld),
|
To = jlib:from_old_jid(ToOld),
|
||||||
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
Packet = exmpp_xml:xmlelement_to_xmlel(PacketOld,
|
||||||
[?NS_JABBER_CLIENT], [{?NS_XMPP, ?NS_XMPP_pfx}]),
|
[?NS_JABBER_CLIENT], [{?NS_XMPP, ?NS_XMPP_pfx}]),
|
||||||
case catch do_route(From, To, Packet) of
|
case catch do_route(From, To, Packet) of
|
||||||
@ -268,8 +268,8 @@ do_route(From, To, Packet) ->
|
|||||||
?DEBUG("s2s manager~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
|
?DEBUG("s2s manager~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
|
||||||
[From, To, Packet, 8]),
|
[From, To, Packet, 8]),
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
case find_connection(From, To) of
|
case find_connection(From, To) of
|
||||||
{atomic, Pid} when pid(Pid) ->
|
{atomic, Pid} when pid(Pid) ->
|
||||||
?DEBUG("sending to process ~p~n", [Pid]),
|
?DEBUG("sending to process ~p~n", [Pid]),
|
||||||
|
@ -241,7 +241,7 @@ wait_for_feature_request({xmlstreamelement, El}, StateData) ->
|
|||||||
SockMod == gen_tcp ->
|
SockMod == gen_tcp ->
|
||||||
?DEBUG("starttls", []),
|
?DEBUG("starttls", []),
|
||||||
Socket = StateData#state.socket,
|
Socket = StateData#state.socket,
|
||||||
Proceed = exmpp_xml:document_fragment_to_list(
|
Proceed = exmpp_xml:node_to_list(
|
||||||
exmpp_server_tls:proceed(), [?DEFAULT_NS], ?PREFIXED_NS),
|
exmpp_server_tls:proceed(), [?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
TLSOpts = StateData#state.tls_options,
|
TLSOpts = StateData#state.tls_options,
|
||||||
TLSSocket = (StateData#state.sockmod):starttls(
|
TLSSocket = (StateData#state.sockmod):starttls(
|
||||||
@ -408,8 +408,8 @@ stream_established({xmlstreamelement, El}, StateData) ->
|
|||||||
(Name == 'message') or
|
(Name == 'message') or
|
||||||
(Name == 'presence')) ->
|
(Name == 'presence')) ->
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
ejabberd_hooks:run(
|
ejabberd_hooks:run(
|
||||||
s2s_receive_packet,
|
s2s_receive_packet,
|
||||||
LFrom,
|
LFrom,
|
||||||
@ -431,8 +431,8 @@ stream_established({xmlstreamelement, El}, StateData) ->
|
|||||||
(Name == 'message') or
|
(Name == 'message') or
|
||||||
(Name == 'presence')) ->
|
(Name == 'presence')) ->
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
ejabberd_hooks:run(
|
ejabberd_hooks:run(
|
||||||
s2s_receive_packet,
|
s2s_receive_packet,
|
||||||
LFrom,
|
LFrom,
|
||||||
@ -574,7 +574,7 @@ send_element(StateData, El) ->
|
|||||||
|
|
||||||
change_shaper(StateData, Host, JID) ->
|
change_shaper(StateData, Host, JID) ->
|
||||||
% XXX OLD FORMAT: JIDOld is an old #jid.
|
% XXX OLD FORMAT: JIDOld is an old #jid.
|
||||||
JIDOld = exmpp_jid:to_ejabberd_jid(JID),
|
JIDOld = jlib:to_old_jid(JID),
|
||||||
Shaper = acl:match_rule(Host, StateData#state.shaper, JIDOld),
|
Shaper = acl:match_rule(Host, StateData#state.shaper, JIDOld),
|
||||||
(StateData#state.sockmod):change_shaper(StateData#state.socket, Shaper).
|
(StateData#state.sockmod):change_shaper(StateData#state.socket, Shaper).
|
||||||
|
|
||||||
|
@ -821,8 +821,8 @@ bounce_element(El, Condition) ->
|
|||||||
% This is handled by C2S and S2S send_element functions.
|
% This is handled by C2S and S2S send_element functions.
|
||||||
ErrOld = exmpp_xml:xmlel_to_xmlelement(Err,
|
ErrOld = exmpp_xml:xmlel_to_xmlelement(Err,
|
||||||
[?NS_JABBER_CLIENT], ?PREFIXED_NS),
|
[?NS_JABBER_CLIENT], ?PREFIXED_NS),
|
||||||
FromOld = exmpp_jid:to_ejabberd_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = exmpp_jid:to_ejabberd_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
ejabberd_router:route(ToOld, FromOld, ErrOld)
|
ejabberd_router:route(ToOld, FromOld, ErrOld)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user