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

* src/ejabberd_sm.erl: Added set_presence_hook

* src/ejabberd_c2s.erl: Likewise

SVN Revision: 761
This commit is contained in:
Alexey Shchepin 2007-05-03 15:45:24 +00:00
parent ab0d7b9151
commit 372944df6c
3 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,7 @@
2007-05-03 Alexey Shchepin <alexey@sevcom.net> 2007-05-03 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_sm.erl: Added set_presence_hook * src/ejabberd_sm.erl: Added set_presence_hook
* src/ejabberd_c2s.erl: Likewise
* src/ejabberd_sm.erl: Added check for existence of incoming * src/ejabberd_sm.erl: Added check for existence of incoming
subscription destination subscription destination

View File

@ -1362,7 +1362,7 @@ presence_update(From, Packet, StateData) ->
get_priority_from_presence(OldPresence) get_priority_from_presence(OldPresence)
end, end,
NewPriority = get_priority_from_presence(Packet), NewPriority = get_priority_from_presence(Packet),
update_priority(NewPriority, StateData), update_priority(NewPriority, Packet, StateData),
FromUnavail = (StateData#state.pres_last == undefined) or FromUnavail = (StateData#state.pres_last == undefined) or
StateData#state.pres_invis, StateData#state.pres_invis,
?DEBUG("from unavail = ~p~n", [FromUnavail]), ?DEBUG("from unavail = ~p~n", [FromUnavail]),
@ -1641,12 +1641,13 @@ roster_change(IJID, ISubscription, StateData) ->
end. end.
update_priority(Pri, StateData) -> update_priority(Priority, Packet, StateData) ->
ejabberd_sm:set_presence(StateData#state.sid, ejabberd_sm:set_presence(StateData#state.sid,
StateData#state.user, StateData#state.user,
StateData#state.server, StateData#state.server,
StateData#state.resource, StateData#state.resource,
Pri). Priority,
Packet).
get_priority_from_presence(PresencePacket) -> get_priority_from_presence(PresencePacket) ->
case xml:get_subtag(PresencePacket, "priority") of case xml:get_subtag(PresencePacket, "priority") of

View File

@ -19,7 +19,7 @@
bounce_offline_message/3, bounce_offline_message/3,
disconnect_removed_user/2, disconnect_removed_user/2,
get_user_resources/2, get_user_resources/2,
set_presence/5, set_presence/6,
unset_presence/5, unset_presence/5,
close_session_unset_presence/5, close_session_unset_presence/5,
dirty_get_sessions_list/0, dirty_get_sessions_list/0,
@ -110,10 +110,10 @@ get_user_resources(User, Server) ->
[element(3, S#session.usr) || S <- clean_session_list(Ss)] [element(3, S#session.usr) || S <- clean_session_list(Ss)]
end. end.
set_presence(SID, User, Server, Resource, Priority) -> set_presence(SID, User, Server, Resource, Priority, Presence) ->
set_session(SID, User, Server, Resource, Priority), set_session(SID, User, Server, Resource, Priority),
ejabberd_hooks:run(set_presence_hook, jlib:nameprep(Server), ejabberd_hooks:run(set_presence_hook, jlib:nameprep(Server),
[User, Server, Resource, Priority]). [User, Server, Resource, Presence]).
unset_presence(SID, User, Server, Resource, Status) -> unset_presence(SID, User, Server, Resource, Status) ->
set_session(SID, User, Server, Resource, undefined), set_session(SID, User, Server, Resource, undefined),