plugins/groupchat.lua

changeset 14
3df63aaba9e3
parent 9
8c3bec93087b
child 16
ae69cea97598
--- a/plugins/groupchat.lua	Fri May 14 14:23:03 2010 +0100
+++ b/plugins/groupchat.lua	Thu May 20 14:32:21 2010 +0100
@@ -8,6 +8,18 @@
 
 function riddim.plugins.groupchat(bot)
 	bot.rooms = {};
+
+	bot:hook("started", function ()
+		for k, v in pairs(bot.config.autojoin or {}) do
+			if type(k) == "number" then
+				bot:join_room(v);
+			elseif type(k) == "string" then
+				if type(v) == "string" then
+					bot:join_room(k, v);
+				end
+			end
+		end
+	end);
 	
 	bot.stream:hook("stanza", function (stanza)
 		local room_jid = jid.bare(stanza.attr.from);

mercurial