示例#1
0
 def activate(self):
     if not HAS_GOOCANVAS:
         raise GajimPluginException('python-pygoocanvas is missing!')
     for account in app.caps_hash:
         if app.caps_hash[account] != '':
             self.announce_caps = True
             helpers.update_optional_features(account)
示例#2
0
    def activate(self):
        """ Method called when the Plugin is activated in the PluginManager
        """
        if app.caps_hash[self._account] != '':
            # Gajim has already a caps hash calculated, update it
            helpers.update_optional_features(self._account)

        if app.account_is_connected(self._account):
            self._log.info('Announce Support after Plugin Activation')
            self._query_for_bundles = []
            self.set_bundle()
            self.request_devicelist()
    def create_vars(self, config):
        app.config.add_per('accounts', self.account)

        if not config['savepass']:
            config['password'] = ''

        for opt in config:
            app.config.set_per('accounts', self.account, opt, config[opt])

        # update variables
        app.interface.instances[self.account] = {
            'infos': {},
            'disco': {},
            'gc_config': {},
            'search': {},
            'online_dialog': {},
            'sub_request': {}
        }
        app.interface.minimized_controls[self.account] = {}
        app.connections[self.account].connected = 0
        app.connections[self.account].keepalives = app.config.get_per(
            'accounts', self.account, 'keep_alive_every_foo_secs')
        app.groups[self.account] = {}
        app.contacts.add_account(self.account)
        app.gc_connected[self.account] = {}
        app.automatic_rooms[self.account] = {}
        app.newly_added[self.account] = []
        app.to_be_removed[self.account] = []
        app.nicks[self.account] = config['name']
        app.block_signed_in_notifications[self.account] = True
        app.sleeper_state[self.account] = 'off'
        app.encrypted_chats[self.account] = []
        app.last_message_time[self.account] = {}
        app.status_before_autoaway[self.account] = ''
        app.transport_avatar[self.account] = {}
        app.gajim_optional_features[self.account] = []
        app.caps_hash[self.account] = ''
        helpers.update_optional_features(self.account)
        # action must be added before account window is updated
        app.app.add_account_actions(self.account)
        # refresh accounts window
        window = app.get_app_window('AccountsWindow')
        if window is not None:
            window.add_account(self.account)
        # refresh roster
        if len(app.connections) >= 2:
            # Do not merge accounts if only one exists
            app.interface.roster.regroup = app.config.get('mergeaccounts')
        else:
            app.interface.roster.regroup = False
        app.interface.roster.setup_and_draw_roster()
        gui_menu_builder.build_accounts_menu()
示例#4
0
    def activate(self):
        for account in app.connections:
            if app.caps_hash[account] != '':
                # Gajim has already a caps hash calculated, update it
                helpers.update_optional_features(account)

            con = app.connections[account]
            if app.account_is_connected(account):
                if con.get_module('OpenPGP').secret_key_available:
                    log.info(
                        '%s => Publish keylist and public key '
                        'after plugin activation', account)
                    con.get_module('OpenPGP').request_keylist()
                    con.get_module('OpenPGP').set_public_key()
示例#5
0
 def on_outgoing_chat_states_combobox_changed(self, widget):
     active = widget.get_active()
     old_value = app.config.get('outgoing_chat_state_notifications')
     if active == 0:  # all
         app.config.set('outgoing_chat_state_notifications', 'all')
     elif active == 1:  # only composing
         app.config.set('outgoing_chat_state_notifications',
                        'composing_only')
     else:  # disabled
         app.config.set('outgoing_chat_state_notifications', 'disabled')
     new_value = app.config.get('outgoing_chat_state_notifications')
     if 'disabled' in (old_value, new_value):
         # we changed from disabled to sth else or vice versa
         helpers.update_optional_features()
    def enable_account(account):
        if account == app.ZEROCONF_ACC_NAME:
            app.connections[account] = ConnectionZeroconf(account)
        else:
            app.connections[account] = Connection(account)

        # update variables
        app.interface.instances[account] = {
            'infos': {},
            'disco': {},
            'gc_config': {},
            'search': {},
            'online_dialog': {},
            'sub_request': {}
        }
        app.interface.minimized_controls[account] = {}
        app.connections[account].connected = 0
        app.groups[account] = {}
        app.contacts.add_account(account)
        app.gc_connected[account] = {}
        app.automatic_rooms[account] = {}
        app.newly_added[account] = []
        app.to_be_removed[account] = []
        if account == app.ZEROCONF_ACC_NAME:
            app.nicks[account] = app.ZEROCONF_ACC_NAME
        else:
            app.nicks[account] = app.config.get_per('accounts', account,
                                                    'name')
        app.block_signed_in_notifications[account] = True
        app.sleeper_state[account] = 'off'
        app.encrypted_chats[account] = []
        app.last_message_time[account] = {}
        app.status_before_autoaway[account] = ''
        app.transport_avatar[account] = {}
        app.gajim_optional_features[account] = []
        app.caps_hash[account] = ''
        helpers.update_optional_features(account)
        # refresh roster
        if len(app.connections) >= 2:
            # Do not merge accounts if only one exists
            app.interface.roster.regroup = app.config.get('mergeaccounts')
        else:
            app.interface.roster.regroup = False
        app.interface.roster.setup_and_draw_roster()
        gui_menu_builder.build_accounts_menu()
示例#7
0
    def _account_info_received(self, result):
        if is_error_result(result):
            self._log.warning('Account disco info failed')
            self._log.warning(result)
            return

        self._log.info('Account info received: %s', result.jid)

        self._account_info = result

        self._con.get_module('MAM').pass_disco(result)
        self._con.get_module('PEP').pass_disco(result)
        self._con.get_module('PubSub').pass_disco(result)
        self._con.get_module('Bookmarks').pass_disco(result)

        if 'urn:xmpp:pep-vcard-conversion:0' in result.features:
            self._con.avatar_conversion = True

        update_optional_features()
示例#8
0
 def on_xhtml_checkbutton_toggled(self, widget):
     self.on_checkbutton_toggled(widget, 'ignore_incoming_xhtml')
     helpers.update_optional_features()
示例#9
0
 def deactivate(self):
     self.announce_caps = False
     helpers.update_optional_features()
示例#10
0
 def activate(self):
     for account in app.caps_hash:
         if app.caps_hash[account] != '':
             self.announce_caps = True
             helpers.update_optional_features(account)