lib/vines/stanza/presence/unsubscribed.rb in vines-0.1.1 vs lib/vines/stanza/presence/unsubscribed.rb in vines-0.2.0
- old
+ new
@@ -11,23 +11,23 @@
end
def process_outbound
self['from'] = stream.user.jid.bare.to_s
to = stamp_to
- route unless local?
+ return unless stream.user.subscribed_from?(to)
+ send_unavailable(stream.user.jid, to)
+ local? ? process_inbound : route
+
stream.user.remove_subscription_from(to)
storage.save_user(stream.user)
stream.update_user_streams(stream.user)
- if contact = stream.user.contact(to)
- router.interested_resources(stream.user.jid).each do |recipient|
- send_subscribed_roster_push(recipient, to, contact.subscription)
- end
+ contact = stream.user.contact(to)
+ router.interested_resources(stream.user.jid).each do |recipient|
+ contact.send_roster_push(recipient)
end
-
- process_inbound if local?
end
def process_inbound
self['from'] = stream.user.jid.bare.to_s
to = stamp_to
@@ -39,10 +39,10 @@
storage(to.domain).save_user(user)
stream.update_user_streams(user)
router.interested_resources(to).each do |recipient|
recipient.write(@node)
- send_subscribed_roster_push(recipient, stream.user.jid.bare, contact.subscription)
+ contact.send_roster_push(recipient)
end
end
end
end
end