Ejemplo n.º 1
0
    def unblock_group(self, group, contact_list):
        if not self.supported:
            return

        if group not in self.blocked_groups:
            return
        self.blocked_groups.remove(group)

        self._log.info('Unblock group: %s', group)
        new_blocked_list = []
        for rule in self.blocked_list:
            if (rule['action'] != 'deny' or rule['type'] != 'group'
                    or rule['value'] != group):
                new_blocked_list.append(rule)

        if not new_blocked_list:
            self.blocked_list = []
            self.blocked_contacts = []
            self.blocked_groups = []
            self.set_default_list('')
            self.del_privacy_list(self.default_list)
        else:
            self.set_privacy_list(self.default_list, new_blocked_list)
        if not app.interface.roster.regroup:
            show = app.SHOW_LIST[self._con.connected]
        else:  # accounts merged
            show = helpers.get_global_show()
        if show == 'invisible':
            return
        for contact in contact_list:
            self._con.get_module('Presence').send_presence(
                contact.jid, show=show, status=self._con.status)
Ejemplo n.º 2
0
    def _nec_our_show(self, obj):
        account = obj.conn.name
        roster = app.interface.roster
        status = app.connections[account].connected

        if account not in app.contacts.get_accounts():
            return
        child_iterA = roster._get_account_iter(account, roster.model)
        if not child_iterA:
            return

        hostname = app.config.get_per('accounts', account, 'hostname')
        server = self.known_servers.get(hostname, False)
        if not server:
            return

        if not roster.regroup:
            show = app.SHOW_LIST[status]
        else: # accounts merged
            show = helpers.get_global_show()

        if server not in roster.transports_state_images['16']:
            # we don't have iconset for this transport loaded yet. Let's do it
            self.make_transport_state_images(roster, server)
        if server in roster.transports_state_images['16'] and \
            show in roster.transports_state_images['16'][server]:
            roster.model[child_iterA][0] = roster.transports_state_images[
                '16'][server][show]
Ejemplo n.º 3
0
    def unblock_contacts(self, contact_list):
        if not self.supported:
            self._con.get_module('Blocking').unblock(contact_list)
            return

        new_blocked_list = []
        to_unblock = []
        for contact in contact_list:
            log.info('Unblock contacts: %s', contact.jid)
            to_unblock.append(contact.jid)
            if contact.jid in self.blocked_contacts:
                self.blocked_contacts.remove(contact.jid)
        for rule in self.blocked_list:
            if rule['action'] != 'deny' or rule['type'] != 'jid' \
            or rule['value'] not in to_unblock:
                new_blocked_list.append(rule)

        if len(new_blocked_list) == 0:
            self.blocked_list = []
            self.blocked_contacts = []
            self.blocked_groups = []
            self.set_default_list(None)
            self.del_privacy_list(self.default_list)
        else:
            self.set_privacy_list(self.default_list, new_blocked_list)
        if not app.interface.roster.regroup:
            show = app.SHOW_LIST[self._con.connected]
        else:  # accounts merged
            show = helpers.get_global_show()
        if show == 'invisible':
            return
        for contact in contact_list:
            self._con.send_custom_status(show, self._con.status, contact.jid)
            self._presence_probe(contact.jid)
Ejemplo n.º 4
0
 def get_status(self, account):
     """
     Return status (show to be exact) which is the global one unless
     account is given
     """
     if not account:
         # If user did not ask for account, returns the global status
         return helpers.get_global_show()
     # return show for the given account
     return app.connections[account].status
Ejemplo n.º 5
0
 def get_status(self, account):
     """
     Return status (show to be exact) which is the global one unless account is
     given
     """
     if not account:
         # If user did not ask for account, returns the global status
         return DBUS_STRING(helpers.get_global_show())
     # return show for the given account
     index = app.connections[account].connected
     return DBUS_STRING(app.SHOW_LIST[index])
Ejemplo n.º 6
0
    def update(self):
        if not app.connections:
            self.hide()
            return

        self.show()
        show = get_global_show()
        uf_show = get_uf_show(show)
        self._current_show_icon.set_from_icon_name(get_icon_name(show),
                                                   Gtk.IconSize.MENU)
        if statuses_unified():
            self._current_show_icon.set_tooltip_text(_('Status: %s') % uf_show)
            if not self._compact:
                self._current_show_label.set_text(uf_show)
        else:
            show_label = _('%s (desynced)') % uf_show
            self._current_show_icon.set_tooltip_text(
                _('Status: %s') % show_label)
            if not self._compact:
                self._current_show_label.set_text(show_label)

        self._change_status_message.set_sensitive(show != 'offline')
Ejemplo n.º 7
0
 def our_show(self, *args):
     if self.active:
         if helpers.get_global_show() != app.SHOW_LIST[0]:
             self.status_widget.set_text(helpers.get_global_status())
         else:
             self.status_widget.set_text('')