def __cmp__(self, other): if not isinstance(other, self.__class__): return -1 a, b = oscar._lowerstrip(self.name), oscar._lowerstrip(other.name) return cmp(a,b)
def __init__(self, name, protocol): self._status = 'unknown' self._idle_time = None self._friendly_name = None # will be set by OscarContact self._avail_msg = self._away_msg = None self._user_class = \ self.create_time = \ self.signon_time = 0 common.buddy.__init__(self, oscar._lowerstrip(name), protocol) if isinstance(self.name, unicode): self.name = self.name.encode('utf8') self.account_creation_time = \ self.online_time = None self.user_status_icq = 'offline' self.external_ip_icq = 0 self._dc_info = util.Storage() self._capabilities = [] self.userinfo = {} if self._profile is False: self._profile = None self._away_updated = self._mystery_updated = 0 self._waiting_for_presence = True
def caps(self): from common import caps as digsbycaps import oscar.capabilities as oscarcaps protocaps = list(self.protocol.caps) # copy it so we don't modify the protocol's copy. mycaps = [oscarcaps.by_bytes.get(x, None) for x in self.capabilities] if 'file_xfer' not in mycaps: #protocaps.remove(digsbycaps.FILES) pass if oscar._lowerstrip(self.name) in self.protocol.bots or blast_group_re.match(oscar._lowerstrip(self.name)): protocaps.append(digsbycaps.BOT) return protocaps
def _lowerstrip(s): return oscar._lowerstrip(s)
def blocked(self): if not self.protocol.icq: return oscar._lowerstrip(self.name) in self.protocol.block_list else: return oscar._lowerstrip(self.name) in self.protocol.ignore_list
def __repr__(self): return '<OscarBuddy %r>' % oscar._lowerstrip(self.name)