Class: Jabber::FeatureNegotiation::IqFeature

Inherits:
REXML::Element show all
Defined in:
lib/xmpp4r/feature_negotiation/iq/feature.rb

Overview

Feature negotiation, can appear as direct child to Iq or as child of IqSi

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from REXML::Element

#delete_elements, #first_element, #first_element_text, #import, #replace_element_text

Constructor Details

#initializeIqFeature

Returns a new instance of IqFeature.



15
16
17
18
19
# File 'lib/xmpp4r/feature_negotiation/iq/feature.rb', line 15

def initialize
  super('feature')

  add_namespace 'http://jabber.org/protocol/feature-neg'
end

Class Method Details

.import(element) ⇒ Object



21
22
23
# File 'lib/xmpp4r/feature_negotiation/iq/feature.rb', line 21

def IqFeature.import(element)
  IqFeature::new.import(element)
end

Instance Method Details

#typed_add(element) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/xmpp4r/feature_negotiation/iq/feature.rb', line 25

def typed_add(element)
  if element.name == 'x' and element.namespace == 'jabber:x:data'
    super Dataforms::XData.new.import(element)
  else
    super element
  end
end

#xObject

First <x/> child with xmlns=‘jabber:x:data’



35
36
37
38
39
40
41
# File 'lib/xmpp4r/feature_negotiation/iq/feature.rb', line 35

def x
  res = nil
  each_element('x') { |e|
    res = e if e.namespace == 'jabber:x:data'
  }
  res
end