6 |
6 |
7 local xmlns_delay = "urn:xmpp:delay"; |
7 local xmlns_delay = "urn:xmpp:delay"; |
8 |
8 |
9 function riddim.plugins.groupchat(bot) |
9 function riddim.plugins.groupchat(bot) |
10 bot.rooms = {}; |
10 bot.rooms = {}; |
|
11 |
|
12 bot:hook("started", function () |
|
13 for k, v in pairs(bot.config.autojoin or {}) do |
|
14 if type(k) == "number" then |
|
15 bot:join_room(v); |
|
16 elseif type(k) == "string" then |
|
17 if type(v) == "string" then |
|
18 bot:join_room(k, v); |
|
19 end |
|
20 end |
|
21 end |
|
22 end); |
11 |
23 |
12 bot.stream:hook("stanza", function (stanza) |
24 bot.stream:hook("stanza", function (stanza) |
13 local room_jid = jid.bare(stanza.attr.from); |
25 local room_jid = jid.bare(stanza.attr.from); |
14 local room = bot.rooms[room_jid] |
26 local room = bot.rooms[room_jid] |
15 if room then |
27 if room then |