Esempio n. 1
0
    def add_or_update_user(self, uid, updatelist, profileversion, ip, port, profile=None):
        user = get_user(uid)
        newuser = (user == None)
        if newuser:
            user = create_user(uid)
            if not user:
                warning('community: Unable to create a new user %s\n' % uid)
                return

        if ip != None:
            user.set('ip', ip)
            user.set('port', port)

        if newuser or user.get('v') != profileversion:
            user.update_attributes(updatelist, user.get('v'))

            if profile != None:
                self.got_user_profile(user, profile, None)
            elif not user.inprogress:
                debug('Fetching new profile from user %s\n' % user.tag())
                request = {'t': 'uprofile'}
                if self.fetcher.fetch(user, PLUGIN_TYPE_COMMUNITY, request, self.got_user_profile):
                    user.inprogress = True

        elif not user.present and not user.inprogress:
            # User appears and user profile is already up-to-date
            self.request_user_icon(user)
            self.fetch_community_profiles(user)

        if user.update_presence(True):
            self.announce_user(user)
Esempio n. 2
0
 def get_user(self, uid):
     return get_user(uid)