diff src/sat.tac @ 252:c09aa319712e

Core: Trigger implementation + version number update - first trigger: MessageReceived - switching to dev version 0.1.1D
author Goffi <goffi@goffi.org>
date Mon, 17 Jan 2011 00:15:28 +0100
parents e077f068ff57
children 012c38b56cdd
line wrap: on
line diff
--- a/src/sat.tac	Mon Jan 17 00:13:59 2011 +0100
+++ b/src/sat.tac	Mon Jan 17 00:15:28 2011 +0100
@@ -21,7 +21,7 @@
 
 CONST = {
     'client_name' : u'SàT (Salut à toi)',
-    'client_version' : u'0.1.1',   #Please add 'D' at the end for dev versions
+    'client_version' : u'0.1.1D',   #Please add 'D' at the end for dev versions
     'local_dir' : '~/.sat'
 }
 
@@ -50,6 +50,7 @@
 
 from sat.tools.memory import Memory
 from sat.tools.xml_tools import tupleList2dataForm
+from sat.tools.misc import TriggerManager
 from glob import glob
 
 try:
@@ -126,6 +127,8 @@
 
     def onMessage(self, message):
       debug (_(u"got message from: %s"), message["from"])
+      if not self.host.trigger.point("MessageReceived",message):
+        return
       for e in message.elements():
         if e.name == "body":
           type = message['type'] if message.hasAttribute('type') else 'chat' #FIXME: check specs
@@ -324,6 +327,7 @@
         self.__progress_cb_map = {}  #callback called when a progress is requested (key = progress id)
         self.__general_cb_map = {}  #callback called for general reasons (key = name) 
         self.__private_data = {}  #used for internal callbacks (key = id)
+        self.trigger = TriggerManager() #trigger are user to change SàT behaviour 
         self.profiles = {}
         self.plugins = {}
         self.menus = {} #used to know which new menus are wanted by plugins