예제 #1
0
파일: ftnlocal.py 프로젝트: askovpen/PyFTN
#for s in ftnexport.get_node_subscriptions(db, "2:5020/4441", "echo"):
#  print(db.prepare("select a.domain, a.text from addresses a, subscriptions s where s.id=$1 and a.id=s.target")(s)[0])
#exit()

db = connectdb()
me = db.prepare("select id from addresses where domain=$1 and text=$2").first(db.FTN_domains["node"], ADDRESS)

print(time.asctime(), "start ftnlocal")

fixes_e = []
fixes_f = []
#my = []


for id_msg, src, dest, msgid, header, body, origcharset, recvfrom in ftnexport.get_subscriber_messages_n(db, me, db.FTN_domains["node"]):

  is_local = src==recvfrom

  if header.find("recipientname").text.lower() == "areafix":
    fixes_e.append((id_msg, src, time.mktime(time.strptime(header.find("date").text, "%d %b %y  %H:%M:%S")), 
        header.find("sendername").text, header.find("subject").text, msgid, body, is_local))

  elif header.find("recipientname").text.lower() in ("filefix", "allfix"):
    fixes_f.append((id_msg, src, time.mktime(time.strptime(header.find("date").text, "%d %b %y  %H:%M:%S")), 
        header.find("sendername").text, header.find("subject").text, msgid, body, is_local))

  else:
    continue

    # leave all other in database for sysop
예제 #2
0
파일: read.py 프로젝트: askovpen/PyFTN
      else:
        submit(editedmsg, sendmode="direct" if "-d" in optflags else None)
      os.unlink(fname)
      exit()

elif "-b" in optflags: # bounce message #
  mid = int(optdata[0])
  srcid, dstid, msgid, header, body, origcharset, receivedfrom = \
    db.prepare("select source, destination, msgid, header, body, origcharset, receivedfrom from messages where id=$1").first(mid)
  if forward(srcid, dstid, msgid, header, body, tosrc=True, newsubj="message bounced at "+ftnconfig.ADDRESS):
    db.prepare("update messages set processed=6 where id=$1")(mid)
  exit()

committer = ftnexport.netmailcommitter()

for mid, srcid, dstid, msgid, header, body, origcharset, receivedfrom in ftnexport.get_subscriber_messages_n(db, my_id, db.FTN_domains["node"]):
    view(mid, srcid, dstid, header, body)
    cmd = None
    while not cmd:
      x = input("Commit, Reply, Quit, Forward> ")
      if x in ("c", "r", "q", "f", "s"):
        cmd = x
      elif x == "":
        cmd = "m" # more

    if cmd == "q":
      break

    elif cmd == "c":
      committer.add ((mid, False))
예제 #3
0
               body,
               tosrc=True,
               newsubj="message bounced at " + ftnconfig.ADDRESS):
        db.prepare("update messages set processed=6 where id=$1")(mid)
    exit()

elif "-v" in optflags:  # view
    mid = int(optdata[0])
    mid, srcid, dstid, msgid, header, body, origcharset, receivedfrom = \
      db.prepare("select id, source, destination, msgid, header, body, origcharset, receivedfrom from messages where id=$1").first(mid)
    view(mid, srcid, dstid, header, body)
    exit()

committer = ftnexport.netmailcommitter()

for mid, srcid, dstid, msgid, header, body, origcharset, receivedfrom in ftnexport.get_subscriber_messages_n(
        db, my_id, db.FTN_domains["node"]):
    view(mid, srcid, dstid, header, body)
    cmd = None
    while not cmd:
        x = input("Commit, Reply, Quit, Forward> ")
        if x in ("c", "r", "q", "f", "s"):
            cmd = x
        elif x == "":
            cmd = "m"  # more

    if cmd == "q":
        break

    elif cmd == "c":
        committer.add((mid, False))
예제 #4
0
파일: ftnlocal.py 프로젝트: fidoman/PyFTN
    print(reply)


#for s in ftnexport.get_node_subscriptions(db, "2:5020/4441", "echo"):
#  print(db.prepare("select a.domain, a.text from addresses a, subscriptions s where s.id=$1 and a.id=s.target")(s)[0])
#exit()

db = ftnconfig.connectdb()

fixes_e = []
fixes_f = []

for me in ftnconfig.my_addrs(db):
    print(time.asctime(), "start ftnlocal for", me)

    for id_msg, src, dest, msgid, header, body, origcharset, recvfrom in ftnexport.get_subscriber_messages_n(
            db, me, db.FTN_domains["node"]):

        is_local = src == recvfrom

        if header.find("recipientname").text.lower() == "areafix":
            fixes_e.append(
                (id_msg, src,
                 time.mktime(
                     time.strptime(
                         header.find("date").text, "%d %b %y  %H:%M:%S")),
                 header.find("sendername").text, header.find("subject").text,
                 msgid, body, is_local))

        elif header.find("recipientname").text.lower() in ("filefix",
                                                           "allfix"):
            fixes_f.append(