25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

More remove support for XEP-0018 (EJAB-810)

This commit is contained in:
Badlop 2010-06-18 11:33:22 +02:00
parent b6711e407e
commit be111b6749

View File

@ -96,7 +96,6 @@
pres_i = ?SETS:new(), pres_i = ?SETS:new(),
pres_last, pres_pri, pres_last, pres_pri,
pres_timestamp, pres_timestamp,
pres_invis = false,
privacy_list = #userlist{}, privacy_list = #userlist{},
conn = unknown, conn = unknown,
auth_module = unknown, auth_module = unknown,
@ -1416,8 +1415,7 @@ terminate(_Reason, StateName, StateData) ->
case StateData of case StateData of
#state{pres_last = undefined, #state{pres_last = undefined,
pres_a = EmptySet, pres_a = EmptySet,
pres_i = EmptySet, pres_i = EmptySet} ->
pres_invis = false} ->
ejabberd_sm:close_session(StateData#state.sid, ejabberd_sm:close_session(StateData#state.sid,
StateData#state.jid); StateData#state.jid);
_ -> _ ->
@ -1577,8 +1575,7 @@ process_presence_probe(From, To, StateData) ->
undefined -> undefined ->
ok; ok;
_ -> _ ->
Cond1 = (not StateData#state.pres_invis) Cond1 = (?SETS:is_element(LFrom, StateData#state.pres_f)
andalso (?SETS:is_element(LFrom, StateData#state.pres_f)
orelse orelse
((LFrom /= LBFrom) andalso ((LFrom /= LBFrom) andalso
?SETS:is_element(LBFrom, StateData#state.pres_f))) ?SETS:is_element(LBFrom, StateData#state.pres_f)))
@ -1587,9 +1584,6 @@ process_presence_probe(From, To, StateData) ->
orelse orelse
((LFrom /= LBFrom) andalso ((LFrom /= LBFrom) andalso
?SETS:is_element(LBFrom, StateData#state.pres_i)))), ?SETS:is_element(LBFrom, StateData#state.pres_i)))),
Cond2 = StateData#state.pres_invis
andalso ?SETS:is_element(LFrom, StateData#state.pres_f)
andalso ?SETS:is_element(LFrom, StateData#state.pres_a),
if if
Cond1 -> Cond1 ->
Timestamp = StateData#state.pres_timestamp, Timestamp = StateData#state.pres_timestamp,
@ -1620,9 +1614,6 @@ process_presence_probe(From, To, StateData) ->
ok ok
end end
end; end;
Cond2 ->
Packet = exmpp_presence:available(),
ejabberd_router:route(To, From, Packet);
true -> true ->
ok ok
end end
@ -1647,8 +1638,7 @@ presence_update(From, Packet, StateData) ->
StateData#state{pres_last = undefined, StateData#state{pres_last = undefined,
pres_timestamp = undefined, pres_timestamp = undefined,
pres_a = ?SETS:new(), pres_a = ?SETS:new(),
pres_i = ?SETS:new(), pres_i = ?SETS:new()};
pres_invis = false};
'error' -> 'error' ->
StateData; StateData;
'probe' -> 'probe' ->
@ -1679,8 +1669,7 @@ presence_update(From, Packet, StateData) ->
end, end,
Timestamp = calendar:now_to_universal_time(now()), Timestamp = calendar:now_to_universal_time(now()),
update_priority(NewPriority, Packet, StateData), update_priority(NewPriority, Packet, StateData),
FromUnavail = (StateData#state.pres_last == undefined) or FromUnavail = (StateData#state.pres_last == undefined),
StateData#state.pres_invis,
?DEBUG("from unavail = ~p~n", [FromUnavail]), ?DEBUG("from unavail = ~p~n", [FromUnavail]),
NewState = NewState =
if if
@ -1696,7 +1685,6 @@ presence_update(From, Packet, StateData) ->
end, end,
presence_broadcast_first( presence_broadcast_first(
From, StateData#state{pres_last = Packet, From, StateData#state{pres_last = Packet,
pres_invis = false,
pres_timestamp = Timestamp pres_timestamp = Timestamp
}, Packet); }, Packet);
true -> true ->
@ -1711,7 +1699,6 @@ presence_update(From, Packet, StateData) ->
ok ok
end, end,
StateData#state{pres_last = Packet, StateData#state{pres_last = Packet,
pres_invis = false,
pres_timestamp = Timestamp pres_timestamp = Timestamp
} }
end, end,
@ -1824,10 +1811,6 @@ presence_broadcast_first(From, StateData, Packet) ->
JIDs2Probe = format_and_check_privacy(From, StateData, Packet, JIDsProbe), JIDs2Probe = format_and_check_privacy(From, StateData, Packet, JIDsProbe),
Server = StateData#state.server, Server = StateData#state.server,
send_multiple(From, Server, JIDs2Probe, PacketProbe), send_multiple(From, Server, JIDs2Probe, PacketProbe),
if
StateData#state.pres_invis ->
StateData;
true ->
{As, JIDs} = {As, JIDs} =
?SETS:fold( ?SETS:fold(
fun(JID, {A, JID_list}) -> fun(JID, {A, JID_list}) ->
@ -1838,8 +1821,7 @@ presence_broadcast_first(From, StateData, Packet) ->
JIDs2 = format_and_check_privacy(From, StateData, Packet, JIDs), JIDs2 = format_and_check_privacy(From, StateData, Packet, JIDs),
Server = StateData#state.server, Server = StateData#state.server,
send_multiple(From, Server, JIDs2, Packet), send_multiple(From, Server, JIDs2, Packet),
StateData#state{pres_a = As} StateData#state{pres_a = As}.
end.
format_and_check_privacy(From, StateData, Packet, JIDs) -> format_and_check_privacy(From, StateData, Packet, JIDs) ->
FJIDs = [exmpp_jid:make(JID) || JID <- JIDs], FJIDs = [exmpp_jid:make(JID) || JID <- JIDs],
@ -1896,8 +1878,7 @@ roster_change(IJID, ISubscription, StateData) ->
?DEBUG("roster changed for ~p~n", [StateData#state.user]), ?DEBUG("roster changed for ~p~n", [StateData#state.user]),
From = StateData#state.jid, From = StateData#state.jid,
To = IJID, To = IJID,
Cond1 = (not StateData#state.pres_invis) and IsFrom Cond1 = IsFrom and (not OldIsFrom),
and (not OldIsFrom),
Cond2 = (not IsFrom) and OldIsFrom Cond2 = (not IsFrom) and OldIsFrom
and (?SETS:is_element(LIJID, StateData#state.pres_a) or and (?SETS:is_element(LIJID, StateData#state.pres_a) or
?SETS:is_element(LIJID, StateData#state.pres_i)), ?SETS:is_element(LIJID, StateData#state.pres_i)),