diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2017-11-16 01:39:23 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2017-11-16 01:45:23 +0300 |
commit | 2fc2a88bbb1bc2e782de62c770b5a2fb5836305b (patch) | |
tree | 2b371c599a61c2dbade288795c2809876ced0bf7 | |
parent | c89982708f315043d1a5ec8c0eeb4ad84a60c665 (diff) |
[whiteboard] Use extension point to add caps
-rw-r--r-- | whiteboard/plugin.py | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/whiteboard/plugin.py b/whiteboard/plugin.py index 38199c4..c345fa4 100644 --- a/whiteboard/plugin.py +++ b/whiteboard/plugin.py @@ -68,36 +68,30 @@ class WhiteboardPlugin(GajimPlugin): } self.controls = [] self.sid = None + self.announce_caps = True @log_calls('WhiteboardPlugin') - def _compute_caps_hash(self): - for a in app.connections: - app.caps_hash[a] = caps_cache.compute_caps_hash([ - app.gajim_identity], app.gajim_common_features + \ - app.gajim_optional_features[a]) - # re-send presence with new hash - connected = app.connections[a].connected - if connected > 1 and app.SHOW_LIST[connected] != 'invisible': - app.connections[a].change_status(app.SHOW_LIST[connected], - app.connections[a].status) + def _update_caps(self, account): + if not self.announce_caps: + return + if NS_JINGLE_SXE not in app.gajim_optional_features[account]: + app.gajim_optional_features[account].append(NS_JINGLE_SXE) + if NS_SXE not in app.gajim_optional_features[account]: + app.gajim_optional_features[account].append(NS_SXE) @log_calls('WhiteboardPlugin') def activate(self): if not HAS_GOOCANVAS: raise GajimPluginException('python-pygoocanvas is missing!') - if NS_JINGLE_SXE not in app.gajim_common_features: - app.gajim_common_features.append(NS_JINGLE_SXE) - if NS_SXE not in app.gajim_common_features: - app.gajim_common_features.append(NS_SXE) - self._compute_caps_hash() + for account in app.caps_hash: + if app.caps_hash[account] != '': + self.announce_caps = True + helpers.update_optional_features(account) @log_calls('WhiteboardPlugin') def deactivate(self): - if NS_JINGLE_SXE in app.gajim_common_features: - app.gajim_common_features.remove(NS_JINGLE_SXE) - if NS_SXE in app.gajim_common_features: - app.gajim_common_features.remove(NS_SXE) - self._compute_caps_hash() + self.announce_caps = False + helpers.update_optional_features() @log_calls('WhiteboardPlugin') def connect_with_chat_control(self, control): |