| Class | Jabber::XMucUserItem |
| In: |
lib/xmpp4r/x/mucuseritem.rb
|
| Parent: | REXML::Element |
# File lib/xmpp4r/x/mucuseritem.rb, line 9
9: def initialize(affiliation=nil, role=nil, jid=nil)
10: super('item')
11: set_affiliation(affiliation)
12: set_role(role)
13: set_jid(jid)
14: end
# File lib/xmpp4r/x/mucuseritem.rb, line 126
126: def actors
127: a = []
128: each_element('actor') { |xe|
129: a.push(JID::new(xe.attributes['jid']))
130: }
131: a
132: end
# File lib/xmpp4r/x/mucuseritem.rb, line 134
134: def actors=(a)
135: delete_elements('actor')
136: a.each { |jid|
137: e = add_element('actor')
138: e.attributes['jid'] = jid.to_s
139: }
140: end
# File lib/xmpp4r/x/mucuseritem.rb, line 16
16: def affiliation
17: case attributes['affiliation']
18: when 'admin' then :admin
19: when 'member' then :member
20: when 'none' then :none
21: when 'outcast' then :outcast
22: when 'owner' then :owner
23: else nil
24: end
25: end
# File lib/xmpp4r/x/mucuseritem.rb, line 27
27: def affiliation=(v)
28: case v
29: when :admin then attributes['affiliation'] = 'admin'
30: when :member then attributes['affiliation'] = 'member'
31: when :none then attributes['affiliation'] = 'none'
32: when :outcast then attributes['affiliation'] = 'outcast'
33: when :owner then attributes['affiliation'] = 'owner'
34: else attributes['affiliation'] = nil
35: end
36: end
# File lib/xmpp4r/x/mucuseritem.rb, line 110
110: def continue
111: c = nil
112: each_element('continue') { |xe| c = xe }
113: c.nil?
114: end
# File lib/xmpp4r/x/mucuseritem.rb, line 116
116: def continue=(c)
117: delete_elements('continue')
118: add_element('continue') if c
119: end
# File lib/xmpp4r/x/mucuseritem.rb, line 43
43: def jid
44: attributes['jid'].nil ? nil : JID::new(attributes['jid'])
45: end
# File lib/xmpp4r/x/mucuseritem.rb, line 47
47: def jid=(j)
48: attributes['jid'] = j.nil? ? nil : j.to_s
49: end
# File lib/xmpp4r/x/mucuseritem.rb, line 94
94: def reason
95: text = nil
96: each_element('reason') { |xe| text = xe.text }
97: text
98: end
# File lib/xmpp4r/x/mucuseritem.rb, line 100
100: def reason=(s)
101: delete_elements('reasion')
102: add_element('reason').text = s
103: end
# File lib/xmpp4r/x/mucuseritem.rb, line 69
69: def role
70: case attributes['role']
71: when 'moderator' then :moderator
72: when 'none' then :none
73: when 'participant' then :participant
74: when 'visitor' then :visitor
75: else nil
76: end
77: end
# File lib/xmpp4r/x/mucuseritem.rb, line 79
79: def role=(r)
80: case r
81: when :moderator then attributes['role'] = 'moderator'
82: when :none then attributes['role'] = 'none'
83: when :participant then attributes['role'] = 'participant'
84: when :visitor then attributes['role'] = 'visitor'
85: else attributes['role'] = nil
86: end
87: end
# File lib/xmpp4r/x/mucuseritem.rb, line 142
142: def set_actors(a)
143: self.actors = a
144: self
145: end
# File lib/xmpp4r/x/mucuseritem.rb, line 38
38: def set_affiliation(v)
39: self.affiliation = v
40: self
41: end
# File lib/xmpp4r/x/mucuseritem.rb, line 121
121: def set_continue(c)
122: self.continue = c
123: self
124: end
# File lib/xmpp4r/x/mucuseritem.rb, line 105
105: def set_reason(s)
106: self.reason = s
107: self
108: end