Module: Blather::Stanza::MUC::MUCUserBase

Included in:
Blather::Stanza::Message::MUCUser, Presence::MUCUser
Defined in:
lib/blather/stanza/muc/muc_user_base.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

MUC_USER_NAMESPACE =
"http://jabber.org/protocol/muc#user"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



8
9
10
# File 'lib/blather/stanza/muc/muc_user_base.rb', line 8

def self.included(klass)
  klass.extend ClassMethods
end

Instance Method Details

#find_password_nodeObject



47
48
49
# File 'lib/blather/stanza/muc/muc_user_base.rb', line 47

def find_password_node
  muc_user.find_first 'ns:password', :ns => MUC_USER_NAMESPACE
end

#inherit(node) ⇒ Object



18
19
20
21
22
# File 'lib/blather/stanza/muc/muc_user_base.rb', line 18

def inherit(node)
  muc_user.remove
  super
  self
end

#muc_userObject



32
33
34
35
36
37
38
# File 'lib/blather/stanza/muc/muc_user_base.rb', line 32

def muc_user
  unless muc_user = find_first('ns:x', :ns => MUC_USER_NAMESPACE)
    self << (muc_user = XMPPNode.new('x', self.document))
    muc_user.namespace = self.class.registered_ns
  end
  muc_user
end

#passwordObject



24
25
26
# File 'lib/blather/stanza/muc/muc_user_base.rb', line 24

def password
  find_password_node && password_node.content
end

#password=(var) ⇒ Object



28
29
30
# File 'lib/blather/stanza/muc/muc_user_base.rb', line 28

def password=(var)
  password_node.content = var
end

#password_nodeObject



40
41
42
43
44
45
# File 'lib/blather/stanza/muc/muc_user_base.rb', line 40

def password_node
  unless pw = find_password_node
    muc_user << (pw = XMPPNode.new('password', self.document))
  end
  pw
end