class Jabber::PubSub::NodeHelper

Attributes

jid[R]
my_subscriptions[R]
name[R]
nodename[R]

Public Class Methods

new(stream, jid, nodename = nil, create_if_not_exist = true) click to toggle source

creates a new node new(client,service,nodename)

stream
Jabber::Stream
jid
String

(jid of the pubsub service)

nodename
String
Calls superclass method
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 27
def initialize(stream, jid, nodename = nil, create_if_not_exist = true)
  super(stream,jid)
  @nodename = nodename
  @jid = jid
  @stream = stream

  if create_if_not_exist and !node_exist?
    # if no nodename is given a instant node will created
    # (if the service supports instant nodes)
    @nodename = create_node
  else
    get_subscriptions
  end
end

Public Instance Methods

create_node(configuration = Jabber::PubSub::NodeConfig.new) click to toggle source

creates the node create(configuration=nil)

configuration
Jabber::XData
Calls superclass method
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 46
def create_node(configuration = Jabber::PubSub::NodeConfig.new)
  unless node_exist?
    super(@nodename,configuration)
  else
    false
  end
end
delete_node() click to toggle source

deletes the node delete

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 74
def delete_node
  delete(@nodename)
end
do_subscribe() click to toggle source

subscribe to this node #do_subscribe

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 125
def do_subscribe
  subscribe_to(@nodename)
  get_subscriptions
end
do_unsubscribe(subid) click to toggle source

unsubscribe from this node #do_unsubscribe(subid = nil)

subid
String
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 134
def do_unsubscribe(subid)
  unsubscribe(@nodename,subid)
end
get_affiliations() click to toggle source

get all node affiliations #get_affiliations

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 104
def get_affiliations
  affiliations
end
get_all_items() click to toggle source

gets all items from the node #get_all_items

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 89
def get_all_items
  get_items_from(@nodename)
end
get_configuration(subid = nil) click to toggle source

get the configuration of the node #get_configuration(configuration=nil)

configuration
Jabber::XData
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 58
def get_configuration(subid = nil)
  get_options(@nodename, subid)
end
get_items(count) click to toggle source

get a count of items #get_items(count)

count
Fixnum
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 97
def get_items(count)
  get_items_from(@nodename,count)
end
get_subscribers() click to toggle source

get all subscribers subscribed on this node #get_subscribers

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 118
def get_subscribers
  @subscriptions = subscribers(@nodename)
end
get_subscriptions() click to toggle source

get all subscriptions on this node #get_subscriptions

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 111
def get_subscriptions
  get_subscriptions_from(@nodename)
end
publish_content(items) click to toggle source

publishing content on this node #publish_content(items)

items
REXML::Element
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 82
def publish_content(items)
  publish_item_to(@nodename,items)
end
purge_items() click to toggle source

purge all items from this node #purge_items

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 141
def purge_items
  purge(@nodename)
end
set_configuration(configuration,subid = nil) click to toggle source

set the configuration of the node #set_configuration(configuration=nil)

configuration
Jabber::XData
subid
String

default is nil

# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 67
def set_configuration(configuration,subid = nil)
  set_options(@nodename, configuration, subid)
end

Private Instance Methods

disco_info() click to toggle source
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 151
def disco_info
end
node_exist?() click to toggle source
# File lib/xmpp4r/pubsub/helper/nodehelper.rb, line 147
def node_exist?
  nodebrowser = PubSub::NodeBrowser.new(@stream)
  nodebrowser.nodes(@jid).include?(@nodename)
end