home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 February / maximum-cd-2011-02.iso / DiscContents / digsby_setup85.exe / lib / plugins / provider_aol / aol_sp.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-11-24  |  1.8 KB  |  50 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import logging
  5. log = logging.getLogger('aol_sp')
  6. import hooks
  7. import util.net as net
  8. import mail.smtp as smtp
  9. import services.service_provider as SP
  10.  
  11. class AOLServiceProvider(SP.EmailPasswordServiceProvider):
  12.     
  13.     def update_info(self, kwds):
  14.         super(AOLServiceProvider, self).update_info(kwds)
  15.         self.updatefreq = kwds.get('updatefreq', 300)
  16.  
  17.     
  18.     def get_options(self, type):
  19.         options = super(AOLServiceProvider, self).get_options(type)
  20.         if type == 'email':
  21.             email_address = options.get('email_address', None)
  22.             if email_address is not None:
  23.                 options['username'] = email_address
  24.             
  25.             username = options.get('username', options.get('name'))
  26.             if username is not None:
  27.                 username = ''.join(username.split()).lower()
  28.                 username = str(net.EmailAddress(username, 'aol.com'))
  29.                 options['name'] = options['username'] = username
  30.             
  31.         
  32.         options['updatefreq'] = self.updatefreq
  33.         return options
  34.  
  35.     
  36.     def add_account_email(self, acct):
  37.         retval = super(AOLServiceProvider, self).add_account_email(acct = acct)
  38.         log.info("Changing %r's username from %r to %r", acct, acct.username, self.email_address)
  39.         acct.name = self.email_address
  40.         
  41.         try:
  42.             (pw, smtppw) = smtp.SMTPEmailAccount._unglue_pw(acct.password)
  43.         except ValueError:
  44.             pass
  45.  
  46.         self.password = pw
  47.         return retval
  48.  
  49.  
  50.