Sha256: ad9f7f2c98aeca0b638b7041e7ac227fdd1359a163803588bb5dead957359122

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

# =XMPP4R - XMPP Library for Ruby
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
# Website::http://home.gna.org/xmpp4r/

module Jabber
  module MUC
    class XMUCUserInvite < REXML::Element
      def initialize(to=nil, reason=nil)
        super('invite')
        set_to(to)
        set_reason(reason)
      end

      def to
        attributes['to'].nil? ? nil : JID::new(attributes['to'])
      end

      def to=(j)
        attributes['to'] = j.nil? ? nil : j.to_s
      end

      def set_to(j)
        self.to = j
        self
      end

      def from
        attributes['from'].nil? ? nil : JID::new(attributes['from'])
      end

      def from=(j)
        attributes['from'] = (j.nil? ? nil : j.to_s)
      end

      def set_from(j)
        self.from = j
        self
      end

      def reason
        first_element_text('reason')
      end

      def reason=(s)
        if s
          replace_element_text('reason', s)
        else
          delete_elements('reason')
        end
      end

      def set_reason(s)
        self.reason = s
        self
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xmpp4r-0.3 lib/xmpp4r/muc/x/mucuserinvite.rb
xmpp4r-0.3.1 lib/xmpp4r/muc/x/mucuserinvite.rb