diff options
author | Waqas Hussain <waqas20@gmail.com> | 2008-10-25 03:13:10 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2008-10-25 03:13:10 +0500 |
commit | 9bd8c81c916f22ffb11ce4f11f74edc87002fbb2 (patch) | |
tree | 3e16509e770e96dd4eecd3cbf9ac2c4dd7c50979 /core/stanza_router.lua | |
parent | 2ab824859d622653d405e8ea0515e3acca9180f4 (diff) | |
download | prosody-9bd8c81c916f22ffb11ce4f11f74edc87002fbb2.tar.gz prosody-9bd8c81c916f22ffb11ce4f11f74edc87002fbb2.zip |
Inbound subscription request
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r-- | core/stanza_router.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 16658f30..be4f9185 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -207,7 +207,16 @@ function core_route_stanza(origin, stanza) send(origin, st.presence({from=to_bare, to=from_bare, type="unsubscribed"})); end elseif stanza.attr.type == "subscribe" then - -- TODO + if rostermanager.is_contact_subscribed(node, host, from_bare) then + send(origin, st.presence(from=to_bare, to=from_bare, type="subscribed")); -- already subscribed + else + local pres = st.presence({from=from_bare}, type="subscribe"); + for k in pairs(user.sessions) do -- return presence for all resources + if user.sessions[k].presence then + send(user.sessions[k], pres); + end + end + end elseif stanza.attr.type == "unsubscribe" then if rostermanager.process_inbound_unsubscribe(node, host, from_bare) then rostermanager.roster_push(node, host, from_bare); |