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

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from util import UrlQuery, threaded
  5. import common
  6. import mail
  7. import mail.smtp as mail
  8. from mail.imap import IMAPMail
  9. from common import pref
  10. import time
  11. import logging
  12. log = logging.getLogger('aolmail')
  13.  
  14. class AOLMail(IMAPMail):
  15.     protocol = 'aolmail'
  16.     default_domain = 'aol.com'
  17.     AIM_SERVER = 'imap.aol.com'
  18.     
  19.     def __init__(self, *a, **kws):
  20.         self._name = None
  21.         log.info('aolmail: %r', kws)
  22.         kws.update(dict(imapserver = self.AIM_SERVER))
  23.         IMAPMail.__init__(self, *a, **kws)
  24.  
  25.     get_email_address = common.emailaccount.EmailAccount.get_email_address
  26.     
  27.     def _get_name(self):
  28.         return self._name
  29.  
  30.     
  31.     def _set_name(self, name):
  32.         if '@aol.' in name:
  33.             name = name.split('@aol.')[0]
  34.         elif '@aim.' in name:
  35.             name = name.split('@aim.')[0]
  36.         
  37.         self._name = name
  38.  
  39.     name = property(_get_name, _set_name)
  40.     
  41.     def _get_mailclient(self):
  42.         return pref('privacy.www_auto_signin', False)
  43.  
  44.     
  45.     def _not_supported(self, val):
  46.         pass
  47.  
  48.     mailclient = property(_get_mailclient, _not_supported)
  49.     can_has_preview = True
  50.     
  51.     def reportSpam(self, msg):
  52.         IMAPMail.reportSpam(self, msg)
  53.         self.move(msg, 'Spam')
  54.  
  55.     
  56.     def delete(self, msg):
  57.         IMAPMail.delete(self, msg)
  58.         self.move(msg, 'Trash')
  59.  
  60.     
  61.     def archive(self, msg):
  62.         IMAPMail.archive(self, msg)
  63.         self.move(msg, 'Saved Mail')
  64.  
  65.     
  66.     def open(self, msg):
  67.         OpenAOLMail(self.name, self._decryptedpw(), msg.id)
  68.  
  69.     
  70.     def urlForEmail(self, msg):
  71.         return UrlQuery('http://webmail.aol.com/Lite/MsgRead.aspx?', dict(folder = 'Inbox', uid = '1.' + msg.id, seq = '1', start = '0'))
  72.  
  73.     
  74.     def compose(self, to = '', subject = '', body = '', cc = '', bcc = '', **k):
  75.         if self.mailclient:
  76.             print 'edit compose', to, subject, body, cc, bcc, k
  77.             body = body.replace('\n', '<br>')
  78.             ComposeAOLMail(self.name, self._decryptedpw(), to = to, subject = subject, body = body, **k)
  79.             print 'edit compose', 'done'
  80.         else:
  81.             print 'return url'
  82.             return self._compose(to, subject, body, cc, bcc, **k)
  83.         return self.mailclient
  84.  
  85.     
  86.     def _compose(self, to = '', subject = '', body = '', cc = '', bcc = '', **k):
  87.         return UrlQuery('http://webmail.aol.com/25045/aim/en-us/Mail/compose-message.aspx', to = to, subject = subject, body = body, cc = cc, bcc = bcc, **k)
  88.  
  89.     
  90.     def inbox_url(self):
  91.         return 'http://mail.aol.com'
  92.  
  93.     inbox_url = property(inbox_url)
  94.     
  95.     def goto_inbox(self):
  96.         if self.mailclient:
  97.             SelectAOLMail(self.name, self._decryptedpw())
  98.         
  99.  
  100.     
  101.     def start_client_email(self, email = None):
  102.         if email is not None:
  103.             self.open(email)
  104.         else:
  105.             self.goto_inbox()
  106.  
  107.     
  108.     def _get_options(self):
  109.         opts = IMAPMail._get_options(self)
  110.         opts.pop('email_address', None)
  111.         opts.pop('mailclient', None)
  112.         return opts
  113.  
  114.  
  115.  
  116. def OpenAOLMail(un, password, msgid):
  117.     login2 = login2
  118.     import oscar
  119.     login2.go_to_msg(un.encode('utf-8'), password.encode('utf-8'), msgid)
  120.  
  121.  
  122. def SelectAOLMail(un, password):
  123.     login2 = login2
  124.     import oscar
  125.     print 'opening', un
  126.     login2.go_to_mail(un.encode('utf-8'), password.encode('utf-8'))
  127.  
  128.  
  129. def ComposeAOLMail(un, password, **k):
  130.     login2 = login2
  131.     import oscar
  132.     login2.go_to_compose(un.encode('utf-8'), password.encode('utf-8'), **k)
  133.  
  134. if __name__ == '__main__':
  135.     from wx.py.PyCrust import main
  136.     main()
  137.  
  138.