示例#1
0
 def readGroup(self, memberlist, parent=None):
     for member in memberlist:
         if isinstance(member, oscar.SSIGroup):
             LogEvent(INFO, self.session.jabberID,
                      "Found group %s" % (member.name))
             self.ssigroups.append(member)
             self.readGroup(member.users, parent=member)
         elif isinstance(member, oscar.SSIBuddy):
             if member.nick:
                 unick, uenc = oscar.guess_encoding(member.nick,
                                                    config.encoding)
             else:
                 unick = None
             if parent:
                 LogEvent(
                     INFO, self.session.jabberID,
                     "Found user %r (%r) from group %r" %
                     (member.name, unick, parent.name))
             else:
                 LogEvent(
                     INFO, self.session.jabberID,
                     "Found user %r (%r) from master group" %
                     (member.name, unick))
             self.oscarcon.legacyList.updateSSIContact(member.name,
                                                       nick=unick)
             if member.name[0].isdigit() and (not member.nick or member.name
                                              == member.nick):
                 # Hrm, lets get that nick
                 self.getnicknames.append(member.name)
         else:
             LogEvent(INFO, self.session.jabberID,
                      "Found unknown SSI entity: %r" % member)
示例#2
0
文件: icqt.py 项目: fritteli/pyicqt
 def readGroup(self, memberlist, parent=None):
     for member in memberlist:
         if isinstance(member, oscar.SSIGroup):
             LogEvent(INFO, self.session.jabberID, "Found group %s" % (member.name))
             self.ssigroups.append(member)
             self.readGroup(member.users, parent=member)
         elif isinstance(member, oscar.SSIBuddy):
             if member.nick:
                 unick, uenc = oscar.guess_encoding(member.nick, config.encoding)
             else:
                 unick = None
             if parent:
                 LogEvent(
                     INFO,
                     self.session.jabberID,
                     "Found user %r (%r) from group %r" % (member.name, unick, parent.name),
                 )
             else:
                 LogEvent(INFO, self.session.jabberID, "Found user %r (%r) from master group" % (member.name, unick))
             self.oscarcon.legacyList.updateSSIContact(member.name, nick=unick)
             if member.name[0].isdigit() and (not member.nick or member.name == member.nick):
                 # Hrm, lets get that nick
                 self.getnicknames.append(member.name)
         else:
             LogEvent(INFO, self.session.jabberID, "Found unknown SSI entity: %r" % member)
示例#3
0
文件: aimt.py 项目: Ashaman-/pyaimt
	def gotUserInfo(self, id, type, userinfo):
		if userinfo:
			for i in range(len(userinfo)):
				#userinfo[i] = userinfo[i].decode(config.encoding, "replace").encode("utf-8", "replace")
				try:
					userinfo[i],uenc = oscar.guess_encoding(userinfo[i], "iso-8859-1")
				except UnicodeError:
					userinfo[i] = userinfo[i].encode('utf-8', 'replace')
		if self.oscarcon.userinfoCollection[id].gotUserInfo(id, type, userinfo):
			# True when all info packages has been received
			self.oscarcon.gotvCard(self.oscarcon.userinfoCollection[id])
			del self.oscarcon.userinfoCollection[id]
示例#4
0
 def gotUserInfo(self, id, type, userinfo):
     if userinfo:
         for i in range(len(userinfo)):
             #userinfo[i] = userinfo[i].decode(config.encoding, "replace").encode("utf-8", "replace")
             try:
                 userinfo[i], uenc = oscar.guess_encoding(
                     userinfo[i], config.encoding)
             except UnicodeError:
                 userinfo[i] = userinfo[i].encode('utf-8', 'replace')
     if self.oscarcon.userinfoCollection[id].gotUserInfo(
             id, type, userinfo):
         # True when all info packages has been received
         self.oscarcon.gotvCard(self.oscarcon.userinfoCollection[id])
         del self.oscarcon.userinfoCollection[id]
示例#5
0
        if not self.oscarcon.savedShow or self.oscarcon.savedShow == "online":
            self.oscarcon.setBack(self.oscarcon.savedFriendly)
        else:
            self.oscarcon.setAway(self.oscarcon.savedFriendly)
        if hasattr(self.oscarcon, "myavatar") and not config.disableAvatars:
            self.oscarcon.changeAvatar(self.oscarcon.myavatar)
        self.oscarcon.setICQStatus(self.oscarcon.savedShow)
        self.requestOffline()
        # Ok, lets get those nicknames.
        for n in self.getnicknames:
            self.getShortInfo(n).addCallback(self.gotNickname, n)

    def gotNickname(self, (nick, first, last, email), uin):
        LogEvent(INFO, self.session.jabberID)
        if nick:
            unick, uenc = oscar.guess_encoding(nick, config.encoding)
            LogEvent(INFO, self.session.jabberID,
                     "Found a nickname, lets update.")
            self.oscarcon.legacyList.updateNickname(uin, unick)

    def warnedUser(self, oldLevel, newLevel, username):
        LogEvent(INFO, self.session.jabberID)


#############################################################################
# Oscar Authenticator
#############################################################################
class OA(oscar.OscarAuthenticator):
    def __init__(self, username, password, oscarcon, deferred=None, icq=1):
        self.oscarcon = oscarcon
        self.BOSClass = B
示例#6
0
文件: icqt.py 项目: fritteli/pyicqt
        if not self.oscarcon.savedShow or self.oscarcon.savedShow == "online":
            self.oscarcon.setBack(self.oscarcon.savedFriendly)
        else:
            self.oscarcon.setAway(self.oscarcon.savedFriendly)
        if hasattr(self.oscarcon, "myavatar") and not config.disableAvatars:
            self.oscarcon.changeAvatar(self.oscarcon.myavatar)
        self.oscarcon.setICQStatus(self.oscarcon.savedShow)
        self.requestOffline()
        # Ok, lets get those nicknames.
        for n in self.getnicknames:
            self.getShortInfo(n).addCallback(self.gotNickname, n)

    def gotNickname(self, (nick, first, last, email), uin):
        LogEvent(INFO, self.session.jabberID)
        if nick:
            unick, uenc = oscar.guess_encoding(nick, config.encoding)
            LogEvent(INFO, self.session.jabberID, "Found a nickname, lets update.")
            self.oscarcon.legacyList.updateNickname(uin, unick)

    def warnedUser(self, oldLevel, newLevel, username):
        LogEvent(INFO, self.session.jabberID)


#############################################################################
# Oscar Authenticator
#############################################################################
class OA(oscar.OscarAuthenticator):
    def __init__(self, username, password, oscarcon, deferred=None, icq=1):
        self.oscarcon = oscarcon
        self.BOSClass = B
        oscar.OscarAuthenticator.__init__(self, username, password, deferred, icq)