plugins.groupchat: Use verse.eventable (room objects were missing :unhook() )

Wed, 27 Aug 2014 10:30:08 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 27 Aug 2014 10:30:08 +0100
changeset 349
dfcc5a0f5c79
parent 348
34b878d58948
child 350
04049524fcd1

plugins.groupchat: Use verse.eventable (room objects were missing :unhook() )

plugins/groupchat.lua file | annotate | diff | comparison | revisions
--- a/plugins/groupchat.lua	Sat Jul 06 08:40:18 2013 +0200
+++ b/plugins/groupchat.lua	Wed Aug 27 10:30:08 2014 +0100
@@ -43,12 +43,11 @@
 			return false, "no nickname supplied"
 		end
 		opts = opts or {};
-		local room = setmetatable({
+		local room = setmetatable(verse.eventable{
 			stream = stream, jid = jid, nick = nick,
 			subject = nil,
 			occupants = {},
 			opts = opts,
-			events = events.new()
 		}, room_mt);
 		if opts.source then
 			self.rooms[opts.source.." "..jid] = room;
@@ -176,12 +175,3 @@
 function room_mt:ban(nick, reason)
 	self:set_affiliation(nick, "outcast", reason);
 end
-
-function room_mt:event(name, arg)
-	self.stream:debug("Firing room event: %s", name);
-	return self.events.fire_event(name, arg);
-end
-
-function room_mt:hook(name, callback, priority)
-	return self.events.add_handler(name, callback, priority);
-end

mercurial