summaryrefslogtreecommitdiffstats
path: root/lain.rb
blob: 802d37849cfd09f2cbaa1d88bf6695f183c1aa08 (plain)
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
#!/usr/bin/env ruby


require 'xmpp4r'
require 'xmpp4r/muc/helper/simplemucclient'

require_relative 'sasl'

require_relative 'config'

include Jabber


cl = Jabber::Client.new(Jabber::JID.new(LainConfig::JID))
cl.connect
cl.auth(LainConfig::Password)
cl.send(Presence.new)

mainthread = Thread.current

m = Jabber::MUC::MUCClient.new(cl)

m.add_message_callback { |x|
  puts x
}

LainConfig::Rooms.each { |r| m.join("#{r}/#{LainConfig::Nick}") }

Thread.stop

cl.close