home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 October / maximum-cd-2011-10.iso / DiscContents / digsby_setup.exe / lib / common / message.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-06-22  |  2.1 KB  |  55 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from datetime import datetime
  5. from util.primitives import Storage, curly
  6.  
  7. class Message(Storage):
  8.     
  9.     def __init__(self, buddy = None, message = None, conversation = None, type = 'incoming', timestamp = None, **other):
  10.         self.buddy = buddy
  11.         self.message = message
  12.         self.type = type
  13.         self.conversation = conversation
  14.         self.timestamp = None if timestamp is not None else datetime.utcnow()
  15.         self.update(other)
  16.  
  17.     
  18.     def copy(self):
  19.         m = Message()
  20.         m.update(self)
  21.         return m
  22.  
  23.     
  24.     def __hash__(self):
  25.         return hash(self._attrs)
  26.  
  27.     
  28.     def __eq__(self, other):
  29.         if not self is other:
  30.             pass
  31.         return self._attrs == getattr(other, '_attrs', None)
  32.  
  33.     
  34.     def __ne__(self, other):
  35.         return not self.__eq__(other)
  36.  
  37.     
  38.     def _attrs(self):
  39.         logger = logger
  40.         import common
  41.         datetime = logger.message_timestamp_id(self.timestamp)
  42.         return hash((self.message, self.type, datetime))
  43.  
  44.     _attrs = property(_attrs)
  45.  
  46.  
  47. class StatusUpdateMessage(Message):
  48.     
  49.     def __init__(self, **info):
  50.         buddy = info['buddy']
  51.         message = curly(info['header'], source = info)
  52.         Message.__init__(self, buddy = buddy, message = message, type = 'status')
  53.  
  54.  
  55.