### Home Classes Methods

### In Files

- lib/xmpp4r/iq.rb

### Parent

Jabber::XMPPStanza

### Methods

- ::new
- ::new_authset
- ::new_authset_digest
- ::new_browseget
- ::new_query
- ::new_register
- ::new_registerget
- ::new_rosterget
- ::new_rosterset
- #command
- #pubsub
- #query
- #query=
- #queryns
- #set_type
- #type
- #type=
- #vcard

### Files

- CHANGELOG
- COPYING
- LICENSE
- README.rdoc
- README_ruby19.txt

### Class/Module Index

Quicksearch

- Jabber
- Jabber::ArgumentError
- Jabber::Bytestreams
- Jabber::Bytestreams::IBB
- Jabber::Bytestreams::IBBInitiator
- Jabber::Bytestreams::IBBQueueItem
- Jabber::Bytestreams::IBBTarget
- Jabber::Bytestreams::IqQueryBytestreams
- Jabber::Bytestreams::IqSi
- Jabber::Bytestreams::IqSiFile
- Jabber::Bytestreams::IqSiFileRange
- Jabber::Bytestreams::SOCKS5Bytestreams
- Jabber::Bytestreams::SOCKS5BytestreamsInitiator
- Jabber::Bytestreams::SOCKS5BytestreamsPeer
- Jabber::Bytestreams::SOCKS5BytestreamsServer
- Jabber::Bytestreams::SOCKS5BytestreamsServerStreamHost
- Jabber::Bytestreams::SOCKS5BytestreamsTarget
- Jabber::Bytestreams::SOCKS5Socket
- Jabber::Bytestreams::StreamHost
- Jabber::Bytestreams::StreamHostUsed
- Jabber::Callback
- Jabber::CallbackList
- Jabber::Caps
- Jabber::Caps::C
- Jabber::Caps::Helper
- Jabber::Client
- Jabber::ClientAuthenticationFailure
- Jabber::Command
- Jabber::Command::IqCommand
- Jabber::Command::Responder
- Jabber::Component
- Jabber::ComponentAuthenticationFailure
- Jabber::Connection
- Jabber::Connection::SSLSocketUTF8
- Jabber::Dataforms
- Jabber::Dataforms::XData
- Jabber::Dataforms::XDataField
- Jabber::Dataforms::XDataInstructions
- Jabber::Dataforms::XDataReported
- Jabber::Dataforms::XDataTitle
- Jabber::Delay
- Jabber::Delay::XDelay
- Jabber::Discovery
- Jabber::Discovery::Feature
- Jabber::Discovery::Helper
- Jabber::Discovery::Identity
- Jabber::Discovery::IqQueryDiscoInfo
- Jabber::Discovery::IqQueryDiscoItems
- Jabber::Discovery::Item
- Jabber::Discovery::Responder
- Jabber::EntityTime
- Jabber::EntityTime::IqTime
- Jabber::EntityTime::Responder
- Jabber::ErrorResponse
- Jabber::FeatureNegotiation
- Jabber::FeatureNegotiation::IqFeature
- Jabber::FileTransfer
- Jabber::FileTransfer::FileSource
- Jabber::FileTransfer::Helper
- Jabber::FileTransfer::TransferSource
- Jabber::Framework
- Jabber::Framework::Base
- Jabber::Framework::Bot
- Jabber::HTTPBinding
- Jabber::HTTPBinding::Client
- Jabber::IdGenerator
- Jabber::InvalidChatState
- Jabber::Iq
- Jabber::IqQuery
- Jabber::JID
- Jabber::JabberError
- Jabber::LastActivity
- Jabber::LastActivity::Helper
- Jabber::LastActivity::IqQueryLastActivity
- Jabber::MUC
- Jabber::MUC::IqQueryMUCAdmin
- Jabber::MUC::IqQueryMUCAdminItem
- Jabber::MUC::IqQueryMUCOwner
- Jabber::MUC::MUCBrowser
- Jabber::MUC::MUCClient
- Jabber::MUC::SimpleMUCClient
- Jabber::MUC::UserItem
- Jabber::MUC::XMUC
- Jabber::MUC::XMUCUser
- Jabber::MUC::XMUCUserInvite
- Jabber::MUC::XMUCUserItem
- Jabber::Message
- Jabber::NoNameXmlnsRegistered
- Jabber::NotConnected
- Jabber::Observable
- Jabber::Observable::Contact
- Jabber::Observable::PubSub
- Jabber::Observable::PubSub::AlreadySet
- Jabber::Observable::PubSub::NoService
- Jabber::Observable::Subscriptions
- Jabber::Presence
- Jabber::PubSub
- Jabber::PubSub::Configuration
- Jabber::PubSub::Event
- Jabber::PubSub::EventItem
- Jabber::PubSub::EventItems
- Jabber::PubSub::IqPubSub
- Jabber::PubSub::IqPubSubOwner
- Jabber::PubSub::Item
- Jabber::PubSub::Items
- Jabber::PubSub::NodeBrowser
- Jabber::PubSub::NodeConfig
- Jabber::PubSub::NodeHelper
- Jabber::PubSub::OAuthPubSubStreamHelper
- Jabber::PubSub::OAuthServiceHelper
- Jabber::PubSub::OwnerNodeConfig
- Jabber::PubSub::Publish
- Jabber::PubSub::Retract
- Jabber::PubSub::ServiceHelper
- Jabber::PubSub::Subscription
- Jabber::PubSub::SubscriptionConfig
- Jabber::PubSub::Unsubscribe
- Jabber::RPC
- Jabber::RPC::Client
- Jabber::RPC::IqQueryRPC
- Jabber::RPC::Server
- Jabber::Reliable
- Jabber::Reliable::Connection
- Jabber::Reliable::Listener
- Jabber::Roster
- Jabber::Roster::Helper
- Jabber::Roster::Helper::RosterItem
- Jabber::Roster::IqQueryRoster
- Jabber::Roster::RosterItem
- Jabber::Roster::RosterX
- Jabber::Roster::RosterXItem
- Jabber::Roster::XRoster
- Jabber::Roster::XRosterItem
- Jabber::SASL
- Jabber::SASL::Anonymous
- Jabber::SASL::Base
- Jabber::SASL::DigestMD5
- Jabber::SASL::Plain
- Jabber::SOCKS5Error
- Jabber::Semaphore
- Jabber::ServerDisconnected
- Jabber::Stream
- Jabber::Stream::ThreadBlock
- Jabber::StreamParser
- Jabber::Test
- Jabber::Test::ListenerMocker
- Jabber::UserLocation
- Jabber::UserLocation::Helper
- Jabber::UserLocation::Location
- Jabber::UserTune
- Jabber::UserTune::Helper
- Jabber::UserTune::Tune
- Jabber::Vcard
- Jabber::Vcard::Helper
- Jabber::Vcard::IqVcard
- Jabber::Version
- Jabber::Version::IqQueryVersion
- Jabber::Version::Responder
- Jabber::Version::SimpleResponder
- Jabber::X
- Jabber::XHTML
- Jabber::XHTML::Body
- Jabber::XHTML::HTML
- Jabber::XMPPElement
- Jabber::XMPPStanza
- Jabber::XParent
- REXML
- REXML::Element
- REXML::IOSource
- XMLRPC
- XMLRPC::Create
- Base64
- ObservableThing
- QObserver
- ThreadStore

No matching classes.

# Jabber::Iq

IQ: Information/Query (see RFC3920 - 9.2.3

A class used to build/parse IQ requests/responses

### Public Class Methods

new(type = nil, to = nil) click to toggle source

Build a new <iq/> stanza

type

Symbol

  or nil, see Iq#type

to

JID

  Recipient

    # File lib/xmpp4r/iq.rb, line 28
    def initialize(type = nil, to = nil)
      super()

      if not to.nil?
        set_to(to)
      end
      if not type.nil?
        set_type(type)
      end
    end

new_authset(jid, password) click to toggle source

Create a new jabber:iq:auth set Stanza.

    # File lib/xmpp4r/iq.rb, line 140
    def Iq.new_authset(jid, password)
      iq = Iq.new(:set)
      query = IqQuery.new
      query.add_namespace('jabber:iq:auth')
      query.add(REXML::Element.new('username').add_text(jid.node))
      query.add(REXML::Element.new('password').add_text(password))
      query.add(REXML::Element.new('resource').add_text(jid.resource)) if not jid.resource.nil?
      iq.add(query)
      iq
    end

new_authset_digest(jid, session_id, password) click to toggle source

Create a new jabber:iq:auth set Stanza for Digest authentication

    # File lib/xmpp4r/iq.rb, line 153
    def Iq.new_authset_digest(jid, session_id, password)
      iq = Iq.new(:set)
      query = IqQuery.new
      query.add_namespace('jabber:iq:auth')
      query.add(REXML::Element.new('username').add_text(jid.node))
      query.add(REXML::Element.new('digest').add_text(Digest::SHA1.hexdigest(session_id + password)))
      query.add(REXML::Element.new('resource').add_text(jid.resource)) if not jid.resource.nil?
      iq.add(query)
      iq
    end

new_browseget() click to toggle source

Create a new jabber:iq:roster get Stanza.

    # File lib/xmpp4r/iq.rb, line 203
    def Iq.new_browseget
      iq = Iq.new(:get)
      query = IqQuery.new
      query.add_namespace('jabber:iq:browse')
      iq.add(query)
      iq
    end

new_query(type = nil, to = nil) click to toggle source

Create a new Iq stanza with an unspecified query child (<query/> has no namespace)

    # File lib/xmpp4r/iq.rb, line 131
    def Iq.new_query(type = nil, to = nil)
      iq = Iq.new(type, to)
      query = IqQuery.new
      iq.add(query)
      iq
    end

new_register(username=nil, password=nil) click to toggle source

Create a new jabber:iq:register set stanza for service/server registration

username

String

  (Element will be ommited if unset)

password

String

  (Element will be ommited if unset)

    # File lib/xmpp4r/iq.rb, line 168
    def Iq.new_register(username=nil, password=nil)
      iq = Iq.new(:set)
      query = IqQuery.new
      query.add_namespace('jabber:iq:register')
      query.add(REXML::Element.new('username').add_text(username)) if username
      query.add(REXML::Element.new('password').add_text(password)) if password
      iq.add(query)
      iq
    end

new_registerget() click to toggle source

Create a new jabber:iq:register get stanza for retrieval of accepted registration information

    # File lib/xmpp4r/iq.rb, line 181
    def Iq.new_registerget
      iq = Iq.new(:get)
      query = IqQuery.new
      query.add_namespace('jabber:iq:register')
      iq.add(query)
      iq
    end

new_rosterget() click to toggle source

Create a new jabber:iq:roster get Stanza.

IqQueryRoster is unused here because possibly not require'd

    # File lib/xmpp4r/iq.rb, line 193
    def Iq.new_rosterget
      iq = Iq.new(:get)
      query = IqQuery.new
      query.add_namespace('jabber:iq:roster')
      iq.add(query)
      iq
    end

new_rosterset() click to toggle source

Create a new jabber:iq:roster set Stanza.

    # File lib/xmpp4r/iq.rb, line 213
    def Iq.new_rosterset
      iq = Iq.new(:set)
      query = IqQuery.new
      query.add_namespace('jabber:iq:roster')
      iq.add(query)
      iq
    end

### Public Instance Methods

command() click to toggle source

Returns the iq's <command/> child, or nil

resulte

IqCommand

    # File lib/xmpp4r/iq.rb, line 124
    def command
      first_element("command")
    end

pubsub() click to toggle source

Returns the iq's <pubsub/> child, or nil

result

IqVcard

    # File lib/xmpp4r/iq.rb, line 117
    def pubsub
      first_element('pubsub')
    end

query() click to toggle source

Returns the iq's query child, or nil

result

IqQuery

    # File lib/xmpp4r/iq.rb, line 82
    def query
      first_element('query')
    end

query=(newquery) click to toggle source

Delete old elements named newquery.name

newquery

REXML::Element

  will be added

    # File lib/xmpp4r/iq.rb, line 90
    def query=(newquery)
      delete_elements(newquery.name)
      add(newquery)
    end

queryns() click to toggle source

Returns the iq's query's namespace, or nil

result

String

    # File lib/xmpp4r/iq.rb, line 98
    def queryns
      e = first_element('query')
      if e
        return e.namespace
      else
        return nil
      end
    end

set_type(v) click to toggle source

Set the type of the Iq stanza (chaining-friendly)

v

Symbol

  or nil

    # File lib/xmpp4r/iq.rb, line 74
    def set_type(v)
      self.type = v
      self
    end

type() click to toggle source

Get the type of the Iq stanza

The following values are allowed:

- :get

- :set

- :result

- :error

result

Symbol

  or nil

    # File lib/xmpp4r/iq.rb, line 48
    def type
      case super
        when 'get' then :get
        when 'set' then :set
        when 'result' then :result
        when 'error' then :error
        else nil
      end
    end

type=(v) click to toggle source

Set the type of the Iq stanza (see Iq#type)

v

Symbol

  or nil

    # File lib/xmpp4r/iq.rb, line 61
    def type=(v)
      case v
        when :get then super('get')
        when :set then super('set')
        when :result then super('result')
        when :error then super('error')
        else super(nil)
      end
    end

vcard() click to toggle source

Returns the iq's <vCard/> child, or nil

result

IqVcard

    # File lib/xmpp4r/iq.rb, line 110
    def vcard
      first_element('vCard')
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.