From 1aa34e05dd2945b7a809c6cce90b30d92e46734f Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 8 Jul 2004 23:51:48 +0000 Subject: [PATCH] plugin now have to register the message types they want to recieve --- core/core.py | 23 ++++------------------- plugins/gtkgui/gtkgui.py | 4 ++++ plugins/logger/logger.py | 2 ++ 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/core/core.py b/core/core.py index 400a387af..0b0b2cefc 100644 --- a/core/core.py +++ b/core/core.py @@ -495,6 +495,10 @@ class GajimCore: self.hub.sendPlugin('LOG_LINE', ev[1], (ev[2][0], nb, \ lineSplited[0], lineSplited[1], lineSplited[2:])) fic.close() + #('REG_MESSAGE', module, list_message) + elif ev[0] == 'REG_MESSAGE': + for msg in ev[2]: + self.hub.register(ev[1], msg) else: log.debug(_("Unknown Command %s") % ev[0]) else: @@ -522,25 +526,6 @@ def loadPlugins(gc): for mod in mods: modObj = gc.hub.newPlugin(mod) - gc.hub.register(mod, 'ROSTER') - gc.hub.register(mod, 'WARNING') - gc.hub.register(mod, 'STATUS') - gc.hub.register(mod, 'NOTIFY') - gc.hub.register(mod, 'MSG') - gc.hub.register(mod, 'MSGERROR') - gc.hub.register(mod, 'MSGSENT') - gc.hub.register(mod, 'SUBSCRIBED') - gc.hub.register(mod, 'UNSUBSCRIBED') - gc.hub.register(mod, 'SUBSCRIBE') - gc.hub.register(mod, 'AGENTS') - gc.hub.register(mod, 'AGENT_INFO') - gc.hub.register(mod, 'QUIT') - gc.hub.register(mod, 'ACC_OK') - gc.hub.register(mod, 'CONFIG') - gc.hub.register(mod, 'MYVCARD') - gc.hub.register(mod, 'VCARD') - gc.hub.register(mod, 'LOG_NB_LINE') - gc.hub.register(mod, 'LOG_LINE') modObj.load() # END loadPLugins diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index a62155efe..42e5b56cf 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -1763,6 +1763,10 @@ class plugin: gtk.threads_enter() self.queueIN = quIN self.queueOUT = quOUT + self.send('REG_MESSAGE', 'gtkgui', ['ROSTER', 'WARNING', 'STATUS', \ + 'NOTIFY', 'MSG', 'MSGERROR', 'SUBSCRIBED', 'UNSUBSCRIBED', \ + 'SUBSCRIBE', 'AGENTS', 'AGENT_INFO', 'QUIT', 'ACC_OK', 'CONFIG', \ + 'MYVCARD', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE']) self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', {'autopopup':1,\ 'autopopupaway':1,\ 'showoffline':0,\ diff --git a/plugins/logger/logger.py b/plugins/logger/logger.py index f17d55d49..dfdfd8e17 100644 --- a/plugins/logger/logger.py +++ b/plugins/logger/logger.py @@ -86,6 +86,8 @@ class plugin: def __init__(self, quIN, quOUT): self.queueIN = quIN self.queueOUT = quOUT + quOUT.put(('REG_MESSAGE', 'logger', ['CONFIG', 'NOTIFY', 'MSG', \ + 'MSGSENT', 'QUIT'])) quOUT.put(('ASK_CONFIG', None, ('Logger', 'Logger', {\ 'lognotsep':1, 'lognotusr':1}))) self.config = self.wait('CONFIG')