- suites.mail.init
if double (string.mid (Frontier.version (), 1, 3)) < 4.1 |
| scriptError ("The mail suite requires Frontier 4.1 or greater.") |
if not defined (user.mail) |
| new (tabletype, @user.mail) |
if not defined (user.mail.agents) |
| new (tabletype, @user.mail.agents) |
| user.mail.agents.defaultFilter = mail.traps.defaultFilter |
if not defined (user.mail.prefs) |
| new (tabletype, @user.mail.prefs) |
if not defined (user.mail.prefs.msgcount) |
| user.mail.prefs.msgcount = 0 |
if not defined (user.mail.prefs.enabled) |
| user.mail.prefs.enabled = false |
if not defined (system.verbs.traps.CSOm) |
| new (tabletype, @system.verbs.traps.CSOm) |
if not defined (system.verbs.traps.CSOm.eNot) |
| system.verbs.traps.CSOm.eNot = mail.traps.CSOmeNot |
if not defined (system.startup.mail) |
| system.startup.mail = mail.traps.startup |
if not defined (system.shutdown.mail) |
| system.shutdown.mail = mail.traps.shutdown |
- mail.traps.defaultFilter
on defaultFilter (mailerappname, whatEvent, theList) |
| «this is the default mail filter script |
| «it just displays the message counter in Frontier's main window |
| «we'll leave it to later (and others) to provide cool mail filters |
| «whatEvent can take on the following values: |
| case whatEvent «we only handle in and out events |
| if sizeof (thelist) > 0 «for debugging, if there's a problem we can repeat it in debugger |
| scratchpad.enotlist = theList |
| for i = 1 to sizeOf (theList) |
| new (tabletype, @mailmsg) |
| mailmsg.event = whatEvent |
| mailmsg.direction = directionstring |
| mailmsg.msgnum = ++user.mail.prefs.msgcount |
| mail.drivers.[mailerappname].getmessagetable (theList [i], @mailmsg) |
| mailmsg.date = clock.now () |
| msg (mailmsg.msgnum + " messages have passed thru user.mail.agents.") |
| «defaultFilter ("Eudora", 'wArv', scratchpad.enotlist) |
- mail.traps.CSOmeNot
on eNot (whatEvent, theList) |
| for i = 1 to sizeOf (user.mail.agents) |
| local (adr = @user.mail.agents [i]) |
| if typeOf (adr^) == scriptType |
| adr^ ("Eudora", whatEvent, theList) |
- mail.traps.startup
if user.mail.prefs.enabled |
| for i = 1 to sizeof (mail.drivers) |
| try {mail.drivers [i].setNotification (true)} |
- mail.traps.shutdown
for i = 1 to sizeof (mail.drivers) |
| try {mail.drivers [i].setNotification (false)} |
- mail.enableFiltering
on enableFiltering (fl) «if true, enable filtering; if false disable |
| if user.mail.prefs.enabled == fl «nothing to do |
| user.mail.prefs.enabled = fl |
- suites.mail.drivers.Eudora.getMessageTable
on getMessageTable (cookie, adrtable) |
| with objectmodel, eudora, eventinfo |
| «toys.newtextobject (s, @scratchpad.s) «for debugging |
| local (linestring = string.nthfield (s, cr, 1)) |
| s = string.delete (s, 1, sizeof (linestring) + 1) |
| label = string.lower (string.nthfield (linestring, ":", 1)) |
| value = string.delete (linestring, 1, sizeof (label) + 2) |
| bundle «special code that finds the text of the message |
| if (sizeof (label) == 0) or (label contains cr) |
| adrtable^.[label] = value |
| adrtable^.recipient = value |
| adrtable^.sender = toys.cleanMailAddress (value) |
| adrtable^.date = clock.now () |
| «new (tabletype, @scratchpad.t) |
| «getmessagetable (scratchpad.enotlist [1], @scratchpad.t) |
| «window.zoom (@scratchpad.t) |
- suites.mail.drivers.Eudora.setNotification
on setNotification (flturnon) |
| Eudora.turnNotificationOn () |
| Eudora.turnNotificationOff () |