home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / msn / p21 / MSNP21Switchboard.pyo (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  2.0 KB  |  47 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import logging
  5. log = logging.getLogger('msn.p21.sb')
  6. import uuid
  7. import hashlib
  8. import sysident
  9. import msn
  10. from msn.p15 import Switchboard as Super
  11. defcb = dict(trid = True, callback = sentinel)
  12.  
  13. class MSNP21Switchboard(Super):
  14.     machine_guid = None
  15.     
  16.     def get_machine_guid(self):
  17.         if self.machine_guid is None:
  18.             self.generate_machine_guid()
  19.         
  20.         return self.machine_guid
  21.  
  22.     
  23.     def generate_machine_guid(self):
  24.         self.machine_guid = uuid.UUID(bytes = hashlib.md5(sysident.sysident()).digest())
  25.  
  26.     
  27.     def authenticate(self, username):
  28.         if self._session is None:
  29.             log.info('Authenticating for new session.')
  30.             self.socket.send(msn.Message('USR', '%s;%s' % (username, str(self.get_machine_guid())), self._cookie), **defcb)
  31.         else:
  32.             log.info('Authenticating for session in progress.')
  33.             self.socket.send(msn.Message('ANS', '%s;%s' % (username, str(self.get_machine_guid())), self._cookie, self._session), **defcb)
  34.  
  35.     
  36.     def recv_iro(self, msg):
  37.         (rooster, roostercount, name, nick) = msg.args[:4]
  38.         rooster = int(rooster)
  39.         roostercount = int(roostercount)
  40.         if not msn.util.url_decode(nick).decode('utf-8'):
  41.             pass
  42.         nick = None
  43.         self.event('contact_alias', name, nick)
  44.         self.on_buddy_join(name)
  45.  
  46.  
  47.