diff options
author | Denis Fomin <fominde@gmail.com> | 2013-09-04 22:05:43 +0400 |
---|---|---|
committer | Denis Fomin <fominde@gmail.com> | 2013-09-04 22:05:43 +0400 |
commit | b0fc66bda9f476b712af187bb0b423cc102c3a8e (patch) | |
tree | e4ac8e58f5149dcbe63898adb7402642c374110f /url_shortener/url_shortener.py | |
parent | 206a3634b25d9df68e49e47b125338e44a3cd0f8 (diff) |
UrlShortenerPlugin. gc support
Diffstat (limited to 'url_shortener/url_shortener.py')
-rw-r--r-- | url_shortener/url_shortener.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/url_shortener/url_shortener.py b/url_shortener/url_shortener.py index bc7a1f3..c4019ec 100644 --- a/url_shortener/url_shortener.py +++ b/url_shortener/url_shortener.py @@ -34,10 +34,15 @@ class UrlShortenerPlugin(GajimPlugin): 'SHORTEN_OUTGOING': (False, ''),} self.events_handlers['message-outgoing'] = (ged.OUT_PRECORE, self.handle_outgoing_msg) + self.events_handlers['gc-message-outgoing'] = (ged.OUT_PRECORE, + self.handle_outgoing_msg) self.chat_control = None self.controls = [] + self.is_active = None def handle_outgoing_msg(self, event): + if not self.active: + return if not event.message: return if not self.config['SHORTEN_OUTGOING']: @@ -94,6 +99,13 @@ class UrlShortenerPlugin(GajimPlugin): control.disconnect_from_chat_control() self.controls.remove(control) + def activate(self): + self.active = True + + def deactivate(self): + self.active = False + + class Base(object): def __init__(self, plugin, chat_control): self.plugin = plugin |