Method: AdventureMUC#initialize

Defined in:
lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb

#initialize(jid, secret, addr, port = 5347) ⇒ AdventureMUC

Returns a new instance of AdventureMUC.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb', line 4

def initialize(jid, secret, addr, port=5347)
  @worlds = {}

  @component = Jabber::Component.new(jid)
  @component.connect(addr, port)
  @component.auth(secret)
  @component.on_exception { |e,|
    puts "#{e.class}: #{e}\n#{e.backtrace.join("\n")}"
  }

  @component.add_iq_callback { |iq|
    handle_iq(iq)
  }
  @component.add_presence_callback { |pres|
    handle_presence(pres)
  }
  @component.add_message_callback { |msg|
    handle_message(msg)
  }

  puts "Adventure component up and running"
end