From 76065758df669b684d6dbf41a35a12851811136e Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 19 Mar 2015 19:44:37 +0100 Subject: [PATCH] renamed tools.misc to tools.trigger --- frontends/src/quick_frontend/quick_app.py | 4 ++-- src/core/sat_main.py | 4 ++-- src/plugins/plugin_exp_command_export.py | 10 +++++----- src/plugins/plugin_exp_parrot.py | 4 ++-- src/plugins/plugin_xep_0033.py | 4 ++-- src/tools/{misc.py => trigger.py} | 0 6 files changed, 13 insertions(+), 13 deletions(-) rename src/tools/{misc.py => trigger.py} (100%) diff --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py index cbccd20b..50f53f10 100644 --- a/frontends/src/quick_frontend/quick_app.py +++ b/frontends/src/quick_frontend/quick_app.py @@ -22,7 +22,7 @@ log = getLogger(__name__) from sat.core.i18n import _ from sat.core import exceptions -from sat.tools.misc import TriggerManager +from sat.tools import trigger from sat_frontends.tools import jid from sat_frontends.quick_frontend import quick_widgets @@ -223,7 +223,7 @@ class QuickApp(object): self._listeners = {} # key: listener type ("avatar", "selected", etc), value: list of callbacks # triggers - self.trigger = TriggerManager() # trigger are used to change the default behaviour + self.trigger = trigger.TriggerManager() # trigger are used to change the default behaviour ## bridge ## try: diff --git a/src/core/sat_main.py b/src/core/sat_main.py index aa98ef97..07eb786d 100644 --- a/src/core/sat_main.py +++ b/src/core/sat_main.py @@ -32,7 +32,7 @@ log = getLogger(__name__) from sat.core.constants import Const as C from sat.memory.memory import Memory from sat.memory.crypto import PasswordHasher -from sat.tools.misc import TriggerManager +from sat.tools import trigger from sat.stdui import ui_contact_list, ui_profile_manager from glob import glob from uuid import uuid4 @@ -72,7 +72,7 @@ class SAT(service.Service): self.plugins = {} self.memory = Memory(self) - self.trigger = TriggerManager() # trigger are used to change SàT behaviour + self.trigger = trigger.TriggerManager() # trigger are used to change SàT behaviour try: self.bridge = DBusBridge() diff --git a/src/plugins/plugin_exp_command_export.py b/src/plugins/plugin_exp_command_export.py index 9c948a29..0c36c176 100755 --- a/src/plugins/plugin_exp_command_export.py +++ b/src/plugins/plugin_exp_command_export.py @@ -23,7 +23,7 @@ log = getLogger(__name__) from twisted.words.protocols.jabber import jid from twisted.internet import reactor, protocol -from sat.tools.misc import SkipOtherTriggers +from sat.tools import trigger from sat.tools.utils import clean_ustr PLUGIN_INFO = { @@ -57,10 +57,10 @@ class ExportCommandProtocol(protocol.ProcessProtocol): log.info("connectionMade :)") def outReceived(self, data): - self.parent.host.sendMessage(self.target, self._clean(data), no_trigger=True, profile_key=self.profile) + self.parent.host.sendMessage(self.target, self._clean(data), no_trigger=True, profile_key=self.profile) def errReceived(self, data): - self.parent.host.sendMessage(self.target, self._clean(data), no_trigger=True, profile_key=self.profile) + self.parent.host.sendMessage(self.target, self._clean(data), no_trigger=True, profile_key=self.profile) def processEnded(self, reason): log.info (u"process finished: %d" % (reason.value.exitCode,)) @@ -124,7 +124,7 @@ class CommandExport(object): _continue &= process.boolOption("continue") exclusive |= process.boolOption("exclusive") if exclusive: - raise SkipOtherTriggers + raise trigger.SkipOtherTriggers return _continue return True @@ -144,7 +144,7 @@ class CommandExport(object): if not profile: log.warning("Unknown profile [%s]" % (profile,)) return - + for target in targets: try: _jid = jid.JID(target) diff --git a/src/plugins/plugin_exp_parrot.py b/src/plugins/plugin_exp_parrot.py index 552eb735..27dfd18b 100755 --- a/src/plugins/plugin_exp_parrot.py +++ b/src/plugins/plugin_exp_parrot.py @@ -24,7 +24,7 @@ log = getLogger(__name__) from twisted.words.protocols.jabber import jid from sat.core.exceptions import UnknownEntityError -#from sat.tools.misc import SkipOtherTriggers +#from sat.tools import trigger PLUGIN_INFO = { "name": "Parrot Plugin", @@ -66,7 +66,7 @@ class Exp_Parrot(object): # # if mess_data['to'].userhostJID() in _links.values(): # log.debug("Parrot link detected, skipping other triggers") - # raise SkipOtherTriggers + # raise trigger.SkipOtherTriggers def MessageReceivedTrigger(self, message, post_treat, profile): """ Check if source is linked and repeat message, else do nothing """ diff --git a/src/plugins/plugin_xep_0033.py b/src/plugins/plugin_xep_0033.py index d456c9fe..f05b310e 100644 --- a/src/plugins/plugin_xep_0033.py +++ b/src/plugins/plugin_xep_0033.py @@ -33,7 +33,7 @@ except ImportError: from twisted.words.xish import domish from twisted.internet import defer -from sat.tools.misc import TriggerManager +from sat.tools import trigger from time import time # TODO: fix Prosody "addressing" plugin to leave the concerned bcc according to the spec: @@ -72,7 +72,7 @@ class XEP_0033(object): log.info(_("Extended Stanza Addressing plugin initialization")) self.host = host self.internal_data = {} - host.trigger.add("sendMessage", self.sendMessageTrigger, TriggerManager.MIN_PRIORITY) + host.trigger.add("sendMessage", self.sendMessageTrigger, trigger.TriggerManager.MIN_PRIORITY) host.trigger.add("MessageReceived", self.messageReceivedTrigger) def sendMessageTrigger(self, mess_data, pre_xml_treatments, post_xml_treatments, profile): diff --git a/src/tools/misc.py b/src/tools/trigger.py similarity index 100% rename from src/tools/misc.py rename to src/tools/trigger.py