Changeset

349:dfcc5a0f5c79

plugins.groupchat: Use verse.eventable (room objects were missing :unhook() )
author Matthew Wild <mwild1@gmail.com>
date Wed, 27 Aug 2014 10:30:08 +0100
parents 348:34b878d58948
children 350:04049524fcd1
files plugins/groupchat.lua
diffstat 1 files changed, 1 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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