1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
# =XMPP4R - XMPP Library for Ruby
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
# Website::http://xmpp4r.github.io
module Jabber
module MUC
##
# Don't use this. It is the base class (unifying shared
# attributes) of XMUCUserItem and IqQueryMUCAdminItem
class UserItem < XMPPElement
def affiliation
case attributes['affiliation']
when 'admin' then :admin
when 'member' then :member
when 'none' then :none
when 'outcast' then :outcast
when 'owner' then :owner
else nil
end
end
def affiliation=(v)
case v
when :admin then attributes['affiliation'] = 'admin'
when :member then attributes['affiliation'] = 'member'
when :none then attributes['affiliation'] = 'none'
when :outcast then attributes['affiliation'] = 'outcast'
when :owner then attributes['affiliation'] = 'owner'
else attributes['affiliation'] = nil
end
end
def set_affiliation(v)
self.affiliation = v
self
end
def jid
attributes['jid'].nil? ? nil : JID.new(attributes['jid'])
end
def jid=(j)
attributes['jid'] = j.nil? ? nil : j.to_s
end
def set_jid(j)
self.jid = j
self
end
def nick
attributes['nick']
end
def nick=(n)
attributes['nick'] = n
end
def set_nick(n)
self.nick = n
self
end
def role
case attributes['role']
when 'moderator' then :moderator
when 'none' then :none
when 'participant' then :participant
when 'visitor' then :visitor
else nil
end
end
def role=(r)
case r
when :moderator then attributes['role'] = 'moderator'
when :none then attributes['role'] = 'none'
when :participant then attributes['role'] = 'participant'
when :visitor then attributes['role'] = 'visitor'
else attributes['role'] = nil
end
end
def set_role(r)
self.role = r
self
end
def reason
text = nil
each_element('reason') { |xe| text = xe.text }
text
end
def reason=(s)
delete_elements('reasion')
add_element('reason').text = s
end
def set_reason(s)
self.reason = s
self
end
def continue
c = nil
each_element('continue') { |xe| c = xe }
c.nil?
end
def continue=(c)
delete_elements('continue')
add_element('continue') if c
end
def set_continue(c)
self.continue = c
self
end
def actors
a = []
each_element('actor') { |xe|
a.push(JID.new(xe.attributes['jid']))
}
a
end
def actors=(a)
delete_elements('actor')
a.each { |jid|
e = add_element('actor')
e.attributes['jid'] = jid.to_s
}
end
def set_actors(a)
self.actors = a
self
end
end
end
end
|