[tictactoe] Adapt updating caps

This commit is contained in:
lovetox
2020-04-04 11:32:04 +02:00
parent 4c14c130f8
commit c1d2c8d766

View File

@@ -97,25 +97,24 @@ class TictactoePlugin(GajimPlugin):
self.announce_caps = True self.announce_caps = True
@log_calls('TictactoePlugin') @log_calls('TictactoePlugin')
def _update_caps(self, account): def _update_caps(self, account, features):
if not self.announce_caps: if not self.announce_caps:
return return
if NS_GAMES not in app.gajim_optional_features[account]:
app.gajim_optional_features[account].append(NS_GAMES) features.append(NS_GAMES)
if NS_GAMES_TICTACTOE not in app.gajim_optional_features[account]: features.append(NS_GAMES_TICTACTOE)
app.gajim_optional_features[account].append(NS_GAMES_TICTACTOE)
@log_calls('TictactoePlugin') @log_calls('TictactoePlugin')
def activate(self): def activate(self):
for account in app.caps_hash: self.announce_caps = True
if app.caps_hash[account] != '': for con in app.connections.values():
self.announce_caps = True con.get_module('Caps').update_caps()
helpers.update_optional_features(account)
@log_calls('TictactoePlugin') @log_calls('TictactoePlugin')
def deactivate(self): def deactivate(self):
self.announce_caps = False self.announce_caps = False
helpers.update_optional_features() for con in app.connections.values():
con.get_module('Caps').update_caps()
@log_calls('TictactoePlugin') @log_calls('TictactoePlugin')
def connect_with_chat_control(self, control): def connect_with_chat_control(self, control):