lib/blather/stanza/pubsub/subscriptions.rb in blather-0.4.14 vs lib/blather/stanza/pubsub/subscriptions.rb in blather-0.4.15

- old
+ new

@@ -56,22 +56,24 @@ end # Get a hash of subscriptions # # @example - # { :subscribed => [{:node => 'node1', :jid => 'francisco@denmark.lit'}, {:node => 'node2', :jid => 'francisco@denmark.lit'}], + # { :subscribed => [{:node => 'node1', :jid => 'francisco@denmark.lit', :subid => 'fd8237yr872h3f289j2'}, {:node => 'node2', :jid => 'francisco@denmark.lit', :subid => 'h8394hf8923ju'}], # :unconfigured => [{:node => 'node3', :jid => 'francisco@denmark.lit'}], # :pending => [{:node => 'node4', :jid => 'francisco@denmark.lit'}], # :none => [{:node => 'node5', :jid => 'francisco@denmark.lit'}] } # # @return [Hash] def list subscriptions.find('//ns:subscription', :ns => self.class.registered_ns).inject({}) do |hash, item| hash[item[:subscription].to_sym] ||= [] - hash[item[:subscription].to_sym] << { + sub = { :node => item[:node], :jid => item[:jid] } + sub[:subid] = item[:subid] if item[:subid] + hash[item[:subscription].to_sym] << sub hash end end end # Subscriptions