Created
October 8, 2009 23:08
-
-
Save aconbere/205507 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#+++ pubsub_presence_controller.rb | |
class Pubsub_presenceController < Babylon::Base::Controller | |
@@nodes = [] | |
def nodes | |
Babylon.logger.debug { "NODES" } | |
@from = Babylon.config["jid"] | |
@to = Babylon.config["pubsub_jid"] | |
@id = "nodereq" | |
@@nodes = @stanza.nodes.map {|i| i.node} | |
# collects the node request response, and for each node, asks for a list of subscribers | |
@@nodes.each do |n| | |
render_evaluate_and_send(:file => "subscription_request.xml.builder", :locals => {:node => n}) | |
end | |
end | |
#+++ subscription_request.xml.builder | |
xml.iq(:type => 'get', :from => @from, :to => @to, :id => @id) do | |
xml.pubsub(:xmlns => 'http://jabber.org/protocol/pubsub#owner') do | |
xml.subscriptions(:node => @node) | |
end | |
end | |
#+++ renders | |
# | |
#<iq type="get" from="presence.pubsub.localhost" to="pubsub.localhost" id="nodereq"> | |
# <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> | |
# <subscriptions node=""/> | |
# </pubsub> | |
#</iq> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment