lib/vines/stanza/presence/subscribed.rb in vines-0.2.1 vs lib/vines/stanza/presence/subscribed.rb in vines-0.3.0
- old
+ new
@@ -11,31 +11,32 @@
end
def process_outbound
self['from'] = stream.user.jid.bare.to_s
to = stamp_to
- local? ? process_inbound : route
stream.user.add_subscription_from(to)
storage.save_user(stream.user)
stream.update_user_streams(stream.user)
+ local? ? process_inbound : route
+
contact = stream.user.contact(to)
- router.interested_resources(stream.user.jid).each do |recipient|
+ stream.interested_resources(stream.user.jid).each do |recipient|
contact.send_roster_push(recipient)
end
- presences = router.available_resources(stream.user.jid).map do |c|
+ presences = stream.available_resources(stream.user.jid).map do |c|
c.last_broadcast_presence.clone.tap do |node|
node['from'] = c.user.jid.to_s
node['id'] = Kit.uuid
node['to'] = to.to_s
end
end
if local?
- router.available_resources(to).each do |recipient|
+ stream.available_resources(to).each do |recipient|
presences.each {|el| recipient.write(el) }
end
else
presences.each {|el| router.route(el) }
end
@@ -50,10 +51,10 @@
return unless contact && contact.can_subscribe?
contact.subscribe_to
storage(to.domain).save_user(user)
stream.update_user_streams(user)
- router.interested_resources(to).each do |recipient|
+ stream.interested_resources(to).each do |recipient|
recipient.write(@node)
contact.send_roster_push(recipient)
end
end
end