home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / yahoo / yahoologinsocket.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  2.5 KB  |  65 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from YahooSocket import YahooSocket
  5. from yahoologinbase import YahooLoginBase
  6. from logging import getLogger
  7. log = getLogger('YahooLoginSocket')
  8.  
  9. class YahooLoginSocket(YahooLoginBase, YahooSocket):
  10.     
  11.     def __init__(self, yahoo, server):
  12.         YahooSocket.__init__(self, yahoo, server)
  13.         YahooLoginBase.__init__(self, yahoo)
  14.         log.info('connecting to %s with user: %s', self.server, self.yahoo.username)
  15.         
  16.         def onfail(exc = (None,)):
  17.             self.yahoo.set_disconnected(self.yahoo.Reasons.CONN_FAIL)
  18.             self.close()
  19.  
  20.         self.connect(self.server, error = onfail)
  21.         if not self.readable():
  22.             onfail()
  23.         
  24.  
  25.     
  26.     def logon_err(self):
  27.         y = self.yahoo
  28.         y.set_disconnected(y.Reasons.CONN_FAIL)
  29.         self.close()
  30.  
  31.     
  32.     def handle_connect(self):
  33.         log.info('Yahoo Socket connected to %s:%d', *self.server)
  34.         self.async_proc(self.logon())
  35.  
  36.     
  37.     def handle_close(self):
  38.         log.critical('handle_close')
  39.         if self.yahoo.offline_reason == self.yahoo.Reasons.NONE:
  40.             rsn = self.yahoo.Reasons.CONN_LOST
  41.         else:
  42.             rsn = self.yahoo.offline_reason
  43.         self.yahoo.set_disconnected(rsn)
  44.         self.close()
  45.         self.yahoo = None
  46.  
  47.     
  48.     def handle_error(self, *a, **k):
  49.         import traceback
  50.         traceback.print_exc()
  51.         log.error('handle_error')
  52.         if self.yahoo:
  53.             self.yahoo.set_disconnected(self.yahoo.Reasons.CONN_LOST)
  54.         
  55.         super(YahooSocket, self).handle_error(*a, **k)
  56.  
  57.     
  58.     def handle_expt(self):
  59.         log.error('handle_expt: out-of-band data')
  60.         self.yahoo.set_disconnected(self.yahoo.Reasons.CONN_LOST)
  61.         self.close()
  62.         self.yahoo = None
  63.  
  64.  
  65.