home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Python 1.4 / Python 1.4 source / Mac / Demo / scripting / Eudora_Suite.py next >
Encoding:
Python Source  |  1996-09-20  |  12.8 KB  |  359 lines  |  [TEXT/Pyth]

  1. """Suite Eudora Suite: Terms specific to Eudora
  2. Level 1, version 1
  3.  
  4. Generated from flap:Programma's:Eudora Light
  5. AETE/AEUT resource version 2/16, language 0, script 0
  6. """
  7.  
  8. import aetools
  9. import MacOS
  10.  
  11. _code = 'CSOm'
  12.  
  13. _Enum_eSta = {
  14.     'unread' : 'euS\001',    # has not been read
  15.     'already_read' : 'euS\002',    # has been read
  16.     'replied' : 'euS\003',    # has been replied to
  17.     'forwarded' : 'euS\010',    # has been forwarded
  18.     'redirected' : 'euS\004',    # has been redirected
  19.     'not_sendable' : 'euS\005',    # cannot be sent
  20.     'sendable' : 'euS\006',    # can be sent
  21.     'queued' : 'euS\007',    # queued for delivery
  22.     'sent' : 'euS\011',    # has been sent
  23.     'never_sent' : 'euS\012',    # never was sent
  24. }
  25.  
  26. _Enum_eSig = {
  27.     'none' : 'sig\000',    # no signature
  28.     'standard' : 'sig\001',    # standard signature file
  29.     'alternate' : 'sig\002',    # alternate signature file
  30. }
  31.  
  32. _Enum_eAty = {
  33.     'AppleDouble' : 'atc\000',    # AppleDouble format
  34.     'AppleSingle' : 'atc\001',    # AppleSingle format
  35.     'BinHex' : 'atc\002',    # BinHex format
  36.     'uuencode' : 'atc\003',    # uuencode format
  37. }
  38.  
  39. _Enum_eNot = {
  40.     'mail_arrives' : 'wArv',    # mail arrival
  41.     'mail_sent' : 'wSnt',    # mail has been sent
  42.     'will_connect' : 'wWCn',    # eudora is about to connect to a mail server
  43.     'has_connected' : 'wHCn',    # eudora has finished talking to a mail server
  44.     'has_manually_filtered' : 'mFil',    # eudora has finished manually filtering messages
  45.     'opens_filters' : 'wFil',    # user has requested Eudora open the filter window
  46. }
  47.  
  48. class Eudora_Suite:
  49.  
  50.     _argmap_connect = {
  51.         'sending' : 'eSen',
  52.         'checking' : 'eChk',
  53.         'waiting' : 'eIdl',
  54.     }
  55.  
  56.     def connect(self, _no_object=None, _attributes={}, **_arguments):
  57.         """connect: Connect to the mail server and transfer mail
  58.         Keyword argument sending: true to make eudora send queued messages
  59.         Keyword argument checking: true to make eudora check for mail
  60.         Keyword argument waiting: true to make eudora wait for idle time before checking
  61.         Keyword argument _attributes: AppleEvent attribute dictionary
  62.         """
  63.         _code = 'CSOm'
  64.         _subcode = 'eCon'
  65.  
  66.         aetools.keysubst(_arguments, self._argmap_connect)
  67.         if _no_object != None: raise TypeError, 'No direct arg expected'
  68.  
  69.  
  70.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  71.                 _arguments, _attributes)
  72.         if _arguments.has_key('errn'):
  73.             raise aetools.Error, aetools.decodeerror(_arguments)
  74.         # XXXX Optionally decode result
  75.         if _arguments.has_key('----'):
  76.             return _arguments['----']
  77.  
  78.     _argmap_reply = {
  79.         'quoting' : 'eQTx',
  80.         'everyone' : 'eRAl',
  81.         'self' : 'eSlf',
  82.     }
  83.  
  84.     def reply(self, _object, _attributes={}, **_arguments):
  85.         """reply: Reply to a message
  86.         Required argument: the message to reply to
  87.         Keyword argument quoting: true if you want to quote the original text in the reply
  88.         Keyword argument everyone: true if you want the reply to go to everyone who got the original
  89.         Keyword argument self: true if you want the reply to go to yourself, too
  90.         Keyword argument _attributes: AppleEvent attribute dictionary
  91.         Returns: to the reply message
  92.         """
  93.         _code = 'CSOm'
  94.         _subcode = 'eRep'
  95.  
  96.         aetools.keysubst(_arguments, self._argmap_reply)
  97.         _arguments['----'] = _object
  98.  
  99.  
  100.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  101.                 _arguments, _attributes)
  102.         if _arguments.has_key('errn'):
  103.             raise aetools.Error, aetools.decodeerror(_arguments)
  104.         # XXXX Optionally decode result
  105.         if _arguments.has_key('----'):
  106.             return _arguments['----']
  107.  
  108.     def forward(self, _object, _attributes={}, **_arguments):
  109.         """forward: Forward a message
  110.         Required argument: the message to forward
  111.         Keyword argument _attributes: AppleEvent attribute dictionary
  112.         Returns: to the forwarded message
  113.         """
  114.         _code = 'CSOm'
  115.         _subcode = 'eFwd'
  116.  
  117.         if _arguments: raise TypeError, 'No optional args expected'
  118.         _arguments['----'] = _object
  119.  
  120.  
  121.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  122.                 _arguments, _attributes)
  123.         if _arguments.has_key('errn'):
  124.             raise aetools.Error, aetools.decodeerror(_arguments)
  125.         # XXXX Optionally decode result
  126.         if _arguments.has_key('----'):
  127.             return _arguments['----']
  128.  
  129.     def redirect(self, _object, _attributes={}, **_arguments):
  130.         """redirect: Redirect a message
  131.         Required argument: the message to redirect
  132.         Keyword argument _attributes: AppleEvent attribute dictionary
  133.         Returns: to the redirected message
  134.         """
  135.         _code = 'CSOm'
  136.         _subcode = 'eRdr'
  137.  
  138.         if _arguments: raise TypeError, 'No optional args expected'
  139.         _arguments['----'] = _object
  140.  
  141.  
  142.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  143.                 _arguments, _attributes)
  144.         if _arguments.has_key('errn'):
  145.             raise aetools.Error, aetools.decodeerror(_arguments)
  146.         # XXXX Optionally decode result
  147.         if _arguments.has_key('----'):
  148.             return _arguments['----']
  149.  
  150.     def send_again(self, _object, _attributes={}, **_arguments):
  151.         """send again: Send a message again
  152.         Required argument: the message to send again
  153.         Keyword argument _attributes: AppleEvent attribute dictionary
  154.         Returns: to the message sent again
  155.         """
  156.         _code = 'CSOm'
  157.         _subcode = 'eSav'
  158.  
  159.         if _arguments: raise TypeError, 'No optional args expected'
  160.         _arguments['----'] = _object
  161.  
  162.  
  163.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  164.                 _arguments, _attributes)
  165.         if _arguments.has_key('errn'):
  166.             raise aetools.Error, aetools.decodeerror(_arguments)
  167.         # XXXX Optionally decode result
  168.         if _arguments.has_key('----'):
  169.             return _arguments['----']
  170.  
  171.     _argmap_queue = {
  172.         '_for' : 'eWhn',
  173.     }
  174.  
  175.     def queue(self, _object, _attributes={}, **_arguments):
  176.         """queue: Queue a message to be sent
  177.         Required argument: the message to queue
  178.         Keyword argument _for: date to send the message, in seconds since 1904, UTC
  179.         Keyword argument _attributes: AppleEvent attribute dictionary
  180.         """
  181.         _code = 'CSOm'
  182.         _subcode = 'eQue'
  183.  
  184.         aetools.keysubst(_arguments, self._argmap_queue)
  185.         _arguments['----'] = _object
  186.  
  187.  
  188.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  189.                 _arguments, _attributes)
  190.         if _arguments.has_key('errn'):
  191.             raise aetools.Error, aetools.decodeerror(_arguments)
  192.         # XXXX Optionally decode result
  193.         if _arguments.has_key('----'):
  194.             return _arguments['----']
  195.  
  196.     def unqueue(self, _object, _attributes={}, **_arguments):
  197.         """unqueue: Remove a message from the queue, so it won’t be sent
  198.         Required argument: the message to unqueue
  199.         Keyword argument _attributes: AppleEvent attribute dictionary
  200.         """
  201.         _code = 'CSOm'
  202.         _subcode = 'eUnQ'
  203.  
  204.         if _arguments: raise TypeError, 'No optional args expected'
  205.         _arguments['----'] = _object
  206.  
  207.  
  208.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  209.                 _arguments, _attributes)
  210.         if _arguments.has_key('errn'):
  211.             raise aetools.Error, aetools.decodeerror(_arguments)
  212.         # XXXX Optionally decode result
  213.         if _arguments.has_key('----'):
  214.             return _arguments['----']
  215.  
  216.     _argmap_attach_to = {
  217.         'documents' : 'eDcl',
  218.     }
  219.  
  220.     def attach_to(self, _object, _attributes={}, **_arguments):
  221.         """attach to: Attach documents to a message
  222.         Required argument: the message to attach the documents to
  223.         Keyword argument documents: list of documents to attach
  224.         Keyword argument _attributes: AppleEvent attribute dictionary
  225.         """
  226.         _code = 'CSOm'
  227.         _subcode = 'eAtc'
  228.  
  229.         aetools.keysubst(_arguments, self._argmap_attach_to)
  230.         _arguments['----'] = _object
  231.  
  232.  
  233.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  234.                 _arguments, _attributes)
  235.         if _arguments.has_key('errn'):
  236.             raise aetools.Error, aetools.decodeerror(_arguments)
  237.         # XXXX Optionally decode result
  238.         if _arguments.has_key('----'):
  239.             return _arguments['----']
  240.  
  241.     _argmap_start_notifying = {
  242.         'when' : 'eWHp',
  243.     }
  244.  
  245.     def start_notifying(self, _object, _attributes={}, **_arguments):
  246.         """start notifying: Notify an application of things that happen
  247.         Required argument: an application to notify
  248.         Keyword argument when: what to notify the application of
  249.         Keyword argument _attributes: AppleEvent attribute dictionary
  250.         """
  251.         _code = 'CSOm'
  252.         _subcode = 'nIns'
  253.  
  254.         aetools.keysubst(_arguments, self._argmap_start_notifying)
  255.         _arguments['----'] = _object
  256.  
  257.  
  258.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  259.                 _arguments, _attributes)
  260.         if _arguments.has_key('errn'):
  261.             raise aetools.Error, aetools.decodeerror(_arguments)
  262.         # XXXX Optionally decode result
  263.         if _arguments.has_key('----'):
  264.             return _arguments['----']
  265.  
  266.     _argmap_stop_notifying = {
  267.         'when' : 'eWHp',
  268.     }
  269.  
  270.     def stop_notifying(self, _object, _attributes={}, **_arguments):
  271.         """stop notifying: Stop notifying applications of things that are happening
  272.         Required argument: an application currently being notified
  273.         Keyword argument when: the things no longer to notify it of
  274.         Keyword argument _attributes: AppleEvent attribute dictionary
  275.         """
  276.         _code = 'CSOm'
  277.         _subcode = 'nRem'
  278.  
  279.         aetools.keysubst(_arguments, self._argmap_stop_notifying)
  280.         _arguments['----'] = _object
  281.  
  282.  
  283.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  284.                 _arguments, _attributes)
  285.         if _arguments.has_key('errn'):
  286.             raise aetools.Error, aetools.decodeerror(_arguments)
  287.         # XXXX Optionally decode result
  288.         if _arguments.has_key('----'):
  289.             return _arguments['----']
  290.  
  291.     _argmap_notice = {
  292.         'occurrence' : 'eWHp',
  293.         'messages' : 'eMLs',
  294.     }
  295.  
  296.     def notice(self, _no_object=None, _attributes={}, **_arguments):
  297.         """notice: Eudora sends this event to notify an application that something happened
  298.         Keyword argument occurrence: what happened
  299.         Keyword argument messages: of the messages involved
  300.         Keyword argument _attributes: AppleEvent attribute dictionary
  301.         """
  302.         _code = 'CSOm'
  303.         _subcode = 'eNot'
  304.  
  305.         aetools.keysubst(_arguments, self._argmap_notice)
  306.         if _no_object != None: raise TypeError, 'No direct arg expected'
  307.  
  308.         aetools.enumsubst(_arguments, 'eWHp', _Enum_eNot)
  309.  
  310.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  311.                 _arguments, _attributes)
  312.         if _arguments.has_key('errn'):
  313.             raise aetools.Error, aetools.decodeerror(_arguments)
  314.         # XXXX Optionally decode result
  315.         if _arguments.has_key('----'):
  316.             return _arguments['----']
  317.  
  318.  
  319. #    Class 'mail folder' ('euMF') -- 'A folder containing mailboxes or other mail folders.'
  320. #        property 'name' ('pnam') 'itxt' -- 'the name' []
  321. #        element 'euMB' as ['indx', 'name']
  322. #        element 'euMF' as ['indx', 'name']
  323.  
  324. #    Class 'mailbox' ('euMB') -- 'A mailbox.'
  325. #        property 'name' ('pnam') 'itxt' -- 'the name of the mail folder' []
  326. #        property 'space wasted' ('euWS') 'long' -- 'the amount of waste space in the mailbox' []
  327. #        property 'space required' ('euNS') 'long' -- 'the minimum amount of space required to hold the mailbox' []
  328. #        property 'location' ('euFS') 'fss ' -- 'the file the mailbox is stored in' []
  329. #        property 'toc location' ('eTFS') 'fss ' -- 'the file the table of contents is stored in' []
  330. #        element 'euMS' as ['indx']
  331.  
  332. #    Class 'message' ('euMS') -- 'A message'
  333. #        property 'body' ('eBod') 'TEXT' -- 'the body of the message' [mutable]
  334. #        property 'priority' ('euPY') 'long' -- 'the priority' [mutable]
  335. #        property 'label' ('eLbl') 'long' -- 'the index of the label' [mutable]
  336. #        property 'status' ('euST') 'eSta' -- 'the message status' [mutable enum]
  337. #        property 'sender' ('euSe') 'itxt' -- 'the sender as appearing in the message summary' [mutable]
  338. #        property 'date' ('euDa') 'itxt' -- 'the date as appearing in the message summary' []
  339. #        property 'subject' ('euSu') 'itxt' -- 'the subject as appearing in the message summary' [mutable]
  340. #        property 'size' ('euSi') 'long' -- 'the size of the message' []
  341. #        property 'outgoing' ('euOu') 'bool' -- 'is the message is outgoing?' []
  342. #        property 'signature' ('eSig') 'eSig' -- 'which signature the message should have' [mutable enum]
  343. #        property 'QP' ('eMQP') 'bool' -- 'is Eudora allowed to encode text?' [mutable]
  344. #        property 'return receipt' ('eRRR') 'bool' -- 'is a return receipt is requested?' [mutable]
  345. #        property 'wrap' ('eWrp') 'bool' -- 'should the text be wrapped when sent?' [mutable]
  346. #        property 'tab expansion' ('eTab') 'bool' -- 'should tabs get expanded to spaces?' [mutable]
  347. #        property 'keep copy' ('eCpy') 'bool' -- 'should a copy should be kept after message is sent?' [mutable]
  348. #        property 'preserve macintosh info' ('eXTX') 'bool' -- 'should Macintosh information always be sent with attachments?' [mutable]
  349. #        property 'attachment encoding' ('eATy') 'eAty' -- 'the type of encoding to use for attachments' [mutable enum]
  350. #        property 'show all headers' ('eBla') 'bool' -- 'should all headers be visible?' [mutable]
  351. #        property 'transliteration table' ('eTbl') 'long' -- 'the resource id of the transliteration table' [mutable]
  352. #        property 'will be fetched' ('eWFh') 'bool' -- 'will the message be [re]fetched on next check?' [mutable]
  353. #        property 'will be deleted' ('eWDl') 'bool' -- 'will the message be deleted from server on next check?' [mutable]
  354. #        element 'euFd' as ['name']
  355.  
  356. #    Class 'field' ('euFd') -- 'An RFC 822 header field in a message (field named "" is the body)'
  357.  
  358. #    Class 'setting' ('ePrf') -- "Eudora's settings"
  359.