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

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from yahooHTTPConnection import YahooHTTPConnection
  5. from yahoologinsocket import YahooLoginSocket
  6. ALL_PORTS = (5050, 80, 25, 23, 20)
  7. S1_PORTS = (5050, 80)
  8. S3_PORTS = (25, 23, 20)
  9.  
  10. class ServerEndpoint(object):
  11.     
  12.     def __init__(self, server_address, port):
  13.         self.address = server_address
  14.         self.port = port
  15.  
  16.     
  17.     def __repr__(self):
  18.         return '<ServerEndpoint %s:%d>' % (self.address, self.port)
  19.  
  20.     
  21.     def __cmp__(self, other):
  22.         if type(other) == HTTPEndpoint:
  23.             if self.port in S3_PORTS:
  24.                 return 1
  25.             return -1
  26.         if self.port not in ALL_PORTS:
  27.             if other.port in ALL_PORTS:
  28.                 return -1
  29.             return 0
  30.         if other.port not in ALL_PORTS:
  31.             if self.port in ALL_PORTS:
  32.                 return 1
  33.             return 0
  34.         if other.port in S1_PORTS and self.port in S1_PORTS:
  35.             return S1_PORTS.index(self.port) - S1_PORTS.index(other.port)
  36.         if other.port in S1_PORTS and self.port in S3_PORTS:
  37.             return 1
  38.         if other.port in S3_PORTS and self.port in S1_PORTS:
  39.             return -1
  40.         if other.port in S3_PORTS and self.port in S3_PORTS:
  41.             return S3_PORTS.index(self.port) - S3_PORTS.index(other.port)
  42.  
  43.     
  44.     def make_socket(self, y):
  45.         return YahooLoginSocket(y, (self.address, self.port))
  46.  
  47.  
  48.  
  49. class HTTPEndpoint(object):
  50.     
  51.     def __init__(self, server_address):
  52.         self.address = server_address
  53.  
  54.     
  55.     def __repr__(self):
  56.         return '<HTTPEndpoint %s>' % (self.address,)
  57.  
  58.     
  59.     def make_socket(self, y):
  60.         return YahooHTTPConnection(y, self.address)
  61.  
  62.  
  63.