コード例 #1
0
    def _connect_to_neighborhood(self, config_file_obj):
        if self._neighborhood is not None:
            return

        params = {}
        params['nickname'] = self._collaboration_config_values.get('nick')
        params['account_id'] = self._collaboration_config_values.get(
            'account_id')
        params['server'] = self._collaboration_config_values.get('server')
        params['port'] = self._collaboration_config_values.get('port')
        params['password'] = self._collaboration_config_values.get('password')
        params['register'] = self._collaboration_config_values.get('register')
        if params['server'] == '':
            raise RuntimeError('Invalid server address')

        self._nick = self._collaboration_config_values.get('nick')
        # Tell the parent activity that the nick may have changed
        self._parent.nick_changed(self._nick)

        self._colors = self._collaboration_config_values.get('colors')
        # Tell the parent activity that the colors may have changed
        self._parent.color_changed(self._colors)

        self._activities = {}
        self._buddies = {}

        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

        self._client_handler = telepathyclient.get_instance()
        if self._client_handler is None:
            raise RuntimeError('Telepathy client unavailable')
        self._neighborhood = get_neighborhood(params)
        self._neighborhood.connect('activity-added', self._activity_added_cb)
        self._neighborhood.connect('activity-removed',
                                   self._activity_removed_cb)
        self._neighborhood.connect('buddy-added', self._buddy_added_cb)
        self._neighborhood.connect('buddy-removed', self._buddy_removed_cb)
コード例 #2
0
    def _connect_to_neighborhood(self, config_file_obj):
        if self._neighborhood is not None:
            return

        params = {}
        params['nickname'] = self._collaboration_config_values.get('nick')
        params['account_id'] = self._collaboration_config_values.get(
            'account_id')
        params['server'] = self._collaboration_config_values.get('server')
        params['port'] = self._collaboration_config_values.get('port')
        params['password'] = self._collaboration_config_values.get('password')
        params['register'] = self._collaboration_config_values.get('register')
        if params['server'] == '':
            raise RuntimeError('Invalid server address')

        self._nick = self._collaboration_config_values.get('nick')
        # Tell the parent activity that the nick may have changed
        self._parent.nick_changed(self._nick)

        self._colors = self._collaboration_config_values.get('colors')
        # Tell the parent activity that the colors may have changed
        self._parent.color_changed(self._colors)

        self._activities = {}
        self._buddies = {}

        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

        self._client_handler = telepathyclient.get_instance()
        if self._client_handler is None:
            raise RuntimeError('Telepathy client unavailable')
        self._neighborhood = get_neighborhood(params)
        self._neighborhood.connect('activity-added', self._activity_added_cb)
        self._neighborhood.connect('activity-removed',
                                   self._activity_removed_cb)
        self._neighborhood.connect('buddy-added', self._buddy_added_cb)
        self._neighborhood.connect('buddy-removed', self._buddy_removed_cb)