[whiteboard] Use extension point to add caps
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user