version 1.3 | | version 1.4 |
---|
| | |
# | | # |
#Updated to use new path functions in CFPython -Todd Mitchell | | #Updated to use new path functions in CFPython -Todd Mitchell |
| | |
import CFPython | | import Crossfire |
import CFMail | | import CFMail |
import string | | import string |
from time import localtime, strftime, time | | from time import localtime, strftime, time |
| | |
mail = CFMail.CFMail() | | mail = CFMail.CFMail() |
date = strftime("%a, %d %b %Y %H:%M:%S CEST", localtime(time())) | | date = strftime("%a, %d %b %Y %H:%M:%S CEST", localtime(time())) |
activator=CFPython.WhoIsActivator() | | activator=Crossfire.WhoIsActivator() |
activatorname=CFPython.GetName(activator) | | activatorname=activator.Name |
whoami=CFPython.WhoAmI() | | whoami=Crossfire.WhoAmI() |
idlist=[] | | idlist=[] |
| | |
inv = CFPython.CheckInventory(CFPython.WhoAmI(),"mailscroll") | | inv = whoami.CheckInventory("mailscroll") |
if inv != 0: | | if inv != None: |
while inv!=0: | | while inv!=None: |
text=string.split(CFPython.GetName(inv)) | | print("INV:%s" %inv.Name) |
| | text=string.split(inv.Name) |
if text[0]=='mailscroll' and text[1]=='T:' and text[3]=='F:': | | if text[0]=='mailscroll' and text[1]=='T:' and text[3]=='F:': |
idlist.append(inv) | | idlist.append(inv) |
toname=text[2] | | toname=text[2] |
fromname=text[4] | | fromname=text[4] |
message='From: %s\nTo: %s\nDate: %s\n\n%s\n' % (fromname, toname, date, CFPython.GetMessage(inv)[:-1]) | | message='From: %s\nTo: %s\nDate: %s\n\n%s\n' % (fromname, toname, date, inv.Message[:-1]) |
CFPython.Write('mailscroll to '+toname+' sent.', activator) | | activator.Write('mailscroll to '+toname+' sent.') |
mail.send(1, toname, fromname, message) | | mail.send(1, toname, fromname, message) |
elif text[0]=='mailscroll' and text[1]=='F:' and text[3]=='T:': | | elif text[0]=='mailscroll' and text[1]=='F:' and text[3]=='T:': |
idlist.append(inv) | | idlist.append(inv) |
fromname=text[2] | | fromname=text[2] |
toname=text[4] | | toname=text[4] |
message=CFPython.GetMessage(inv)[:-1]+'\n' | | message=inv.Message[:-1]+'\n' |
mail.send(1, toname, fromname, message) | | mail.send(1, toname, fromname, message) |
else: | | else: |
print "ID: %d"%inv | | print "ID: %d"%inv |
print "Name: "+CFPython.GetName(inv) | | print "Name: "+inv.Name |
inv=CFPython.GetNextObject(inv) | | inv=inv.Below |
| | |
inv = CFPython.CheckInventory(CFPython.WhoAmI(),"mailwarning") | | inv = whoami.CheckInventory("mailwarning") |
if inv != 0: | | if inv != None: |
while inv!=0: | | while inv!=None: |
text=string.split(CFPython.GetName(inv)) | | text=string.split(inv.Name) |
if text[0]=='mailwarning' and text[1]=='T:' and text[3]=='F:': | | if text[0]=='mailwarning' and text[1]=='T:' and text[3]=='F:': |
idlist.append(inv) | | idlist.append(inv) |
toname=text[2] | | toname=text[2] |
fromname=text[4] | | fromname=text[4] |
message='From: %s\nTo: %s\nDate: %s\n\n%s\n' % (fromname, toname, date, CFPython.GetMessage(inv)[:-1]) | | message='From: %s\nTo: %s\nDate: %s\n\n%s\n' % (fromname, toname, date, inv.Message[:-1]) |
CFPython.Write('mailwarning to '+toname+' sent.', activator) | | activator.Write('mailwarning to '+toname+' sent.') |
mail.send(3, toname, fromname, message) | | mail.send(3, toname, fromname, message) |
elif text[0]=='mailwarning' and text[1]=='F:' and text[3]=='T:': | | elif text[0]=='mailwarning' and text[1]=='F:' and text[3]=='T:': |
idlist.append(inv) | | idlist.append(inv) |
fromname=text[2] | | fromname=text[2] |
toname=text[4] | | toname=text[4] |
message=CFPython.GetMessage(inv)[:-1]+'\n' | | message=inv.Message[:-1]+'\n' |
mail.send(3, toname, fromname, message) | | mail.send(3, toname, fromname, message) |
else: | | else: |
print "ID: %d"%inv | | print "ID: %d"%inv |
print "Name: "+CFPython.GetName(inv) | | print "Name: "+inv.Name |
inv=CFPython.GetNextObject(inv) | | inv=inv.Below |
| | |
for inv in idlist: | | for inv in idlist: |
CFPython.RemoveObject(inv) | | inv.Remove() |