def process_758(): basedir="areafix/758" UPLINK="2:5020/758" RE_subscribed=re.compile("(\S+) \.* Linked") RE_alreadysubscribed=re.compile("Area (\S+) is already linked") RE_notfound=re.compile("Area (\S+) doesn't exist") echostatus={} for mfile in os.listdir(basedir): m=ftn.msg.MSG(os.path.join(basedir,mfile)) orig, dest, msgid, header, body, charset = ftnimport.normalize_message(m) print(orig, dest, msgid) if orig!=("node", UPLINK): continue # print(repr(header.find("subject").text)) lines = body.split("\n") for l in lines: if len(l)==0 or l[0]==">": continue m=RE_subscribed.match(l) if m: set_status(echostatus, m.group(1), "ok") continue m=RE_alreadysubscribed.match(l) if m: set_status(echostatus, m.group(1), "ok") continue m=RE_notfound.match(l) if m: set_status(echostatus, m.group(1), "absent") continue #raise Exception("unrecognized: %s"%l) return echostatus
if len(sys.argv)<2: print(DUPDIR) filelist=os.listdir(DUPDIR) else: filelist=sys.argv[1:] for f in filelist: fn, fext = os.path.splitext(f) if fext==".msg" and fn.find(".db")==-1: print(f, end=' ') m=ftn.msg.MSG(os.path.join(DUPDIR,f)) (origdomname, origaddr), (destdomname, destaddr), msgid, header, body, charset = normalize_message(m) print("msgid='%s'"%msgid,end=' ') # if destdomname!="echo": # print ("not echomail") # continue # print("---") # print("From:",header.find("sendername").text, origdomname, origaddr) # print("To: ",header.find("recipientname").text, destdomname, destaddr) # print("Date:",header.find("date").text) # print("Subj:",header.find("subject").text) #print(body)
print(DUPDIR) filelist = os.listdir(DUPDIR) else: filelist = sys.argv[1:] for f in filelist: fn, fext = os.path.splitext(f) if fext == ".msg" and fn.find(".db") == -1: print(f, end=' ') m = ftn.msg.MSG(os.path.join(DUPDIR, f)) (origdomname, origaddr), ( destdomname, destaddr), msgid, header, body, charset = normalize_message(m) print("msgid='%s'" % msgid, end=' ') # if destdomname!="echo": # print ("not echomail") # continue # print("---") # print("From:",header.find("sendername").text, origdomname, origaddr) # print("To: ",header.find("recipientname").text, destdomname, destaddr) # print("Date:",header.find("date").text) # print("Subj:",header.find("subject").text) #print(body)