Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.magick    |    Meh.. another magic/spellcasting forum    |    90,437 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 90,426 of 90,437    |
|    street@shellcrash.com to All    |
|    AI Generated Usenet Client Update (2/3)    |
|    24 Dec 25 01:36:43    |
   
   [continued from previous message]   
      
    "replies": replies,   
    "msgid": msgid   
    })   
    except Exception:   
    pass   
    rel += 1   
    sys.stdout.write("   
   Search complete!    
   ")   
    return matches   
      
   # ---------- FETCH REPLIES ----------   
   def fetch_replies(nntp, group, msgid):   
    try:   
    _, _, first, last, _ = nntp.group(group)   
    first, last = int(first), int(last)   
    start = max(first, last - MAX_ARTICLES_LIST + 1)   
    _, overviews = nntp.over((start, last))   
    except Exception as e:   
    print(f"   
   Failed to fetch overviews: {e}")   
    return []   
      
    replies = []   
    rel = 1   
    for num, hdr in reversed(overviews):   
    if msgid in hdr.get("references", ""):   
    r_msgid = hdr.get("message-id", "")   
    r_replies = sum(1 for _, h in overviews if r_msgid in   
   h.get("references", "")) if SHOW_REPLY_COUNT_MAIN else 0   
    replies.append({   
    "rel_num": rel,   
    "num": int(num),   
    "from": CLEAN_RE.sub("", hdr.get("from", "?")),   
    "date": hdr.get("date", "?"),   
    "subject": CLEAN_RE.sub("", hdr.get("subject", "")),   
    "replies": r_replies,   
    "msgid": r_msgid   
    })   
    rel += 1   
    return replies   
      
   # ---------- POST NEW OR REPLY ----------   
   def post_article(nntp, group, reply_to_msgid=None, reply_subject=None):   
    name = prompt("Your name: ")   
    email = prompt("Your email: ")   
    FROM_ADDR = f"{sanitize_header(name)} <{sanitize_header(email)}>"   
      
    if reply_subject:   
    subject = f"Re: {reply_subject}" if not reply_subject.lo   
   er().startswith("re:") else reply_subject   
    else:   
    subject = prompt("Subject: ")   
    subject = sanitize_header(subject)   
      
    print("Enter message body. End with a single '.' on a line:")   
    lines = []   
    while True:   
    line = input()   
    if line.strip() == ".":   
    break   
    lines.append(line)   
    body = "   
   ".join(lines)   
      
    msg = EmailMessage()   
    msg["From"] = FROM_ADDR   
    msg["Newsgroups"] = group   
    msg["Subject"] = subject   
    if reply_to_msgid:   
    msg["References"] = reply_to_msgid   
    msg["Message-ID"] = f"<{uuid.uuid4().hex}@{NNTP_SERVER}>"   
    msg.set_content(body)   
      
    try:   
    nntp.post(msg.as_bytes())   
    print("Post successful!")   
    except Exception as e:   
    print(f"Post failed: {e}")   
      
   # ---------- SHOW REPLIES ----------   
   def show_replies_thread(nntp, group, msgid, level=0):   
    replies = fetch_replies(nntp, group, msgid)   
    if not replies:   
    print("   
   No replies found.")   
    return   
      
    while True:   
    print("   
   Replies:")   
    for idx, r in enumerate(replies, 1):   
    indent = " " * level   
    print(f"{indent}[{idx}]")   
    print(f"{indent}From: {r['from']}")   
    print(f"{indent}Date: {r['date']}")   
    print(f"{indent}Subject: {r['subject']}")   
    print(f"{indent}Replies: {r['replies']}   
   ")   
      
    sel = prompt("   
   Enter reply number to read, R=reply, ENTER=back: ").strip()   
    if not sel:   
    return   
    if sel.lower() == "r":   
    rnum = prompt("Enter reply number to respond to: ").strip()   
    if rnum.isdigit():   
    idx = int(rnum) - 1   
    if 0 <= idx < len(replies):   
    r = replies[idx]   
    post_article(nntp, group, r["msgid"], r["subject"])   
    continue   
    if not sel.isdigit():   
    continue   
    sel_idx = int(sel) - 1   
    if 0 <= sel_idx < len(replies):   
    r = replies[sel_idx]   
    print(f"   
   --- Reading Reply #{r['num']} ---")   
    print(f"Group: {group}") # <-- group under article number   
    print(f"From: {r['from']}")   
    print(f"Date: {r['date']}")   
    print(f"Subject: {r['subject']}   
   ")   
    show_article(nntp, r["num"], group)   
    if r["replies"] > 0:   
    k = prompt("Press R to view replies to this reply, ENTER to   
   continue: ").lower()   
    if k == "r":   
    show_replies_thread(nntp, group, r["msgid"], level + 1)   
      
   # ---------- JUMP FUNCTION ----------   
   def jump_post(posts):   
    val = prompt("Jump to post #: ").strip()   
    if not val:   
    return None   
    if val.startswith("#"):   
    try:   
    n = int(val[1:])   
    for idx, p in enumerate(posts):   
    if p["num"] == n:   
    return idx   
    except:   
    pass   
    else:   
    try:   
    n = int(val)   
    if 1 <= n <= len(posts):   
    return n - 1   
    except:   
    pass   
    set_status("Invalid jump number")   
    return None   
      
   # ---------- BROWSER ----------   
   def browse_group(nntp, group):   
    posts = reload_group(nntp, group)   
    index = 0   
      
    while True:   
    if not posts:   
    set_status("No posts")   
    posts = reload_group(nntp, group)   
    continue   
      
    p = posts[index]   
    print(f"   
   [{p['rel_num']}] #{p['num']}")   
    print(f"Group: {group}") # <-- group under article number   
    print(f"From: {p['from']}")   
    print(f"Date: {p['date']}")   
    print(f"Replies: {p['replies']}")   
    print(f"Subject: {p['subject']}")   
    show_status()   
      
    print(   
    "   
   ENTER=read SPACE=next BACKSPACE=prev "   
    "L=reload J=jump G=group "   
    "B=batch F=author S=subject M=body "   
    "R=replies N=new post Y=reply P=page C=reconnect Q=quit"   
    )   
      
    k = get_key().lower()   
    if k == "q":   
    try: nntp.quit()   
    except: pass   
    sys.exit(0)   
    elif k == "c":   
    set_status("Reconnecting...")   
    try:   
    nntp.quit()   
    except:   
    pass   
    try:   
    nntp = nntplib.NNTP_SSL(NNTP_SERVER, NNTP_PORT, USERNAME,   
   PASSWORD)   
    posts = reload_group(nntp, group)   
    index = 0   
    set_status("Reconnected successfully")   
    except Exception as e:   
    set_status(f"Reconnect failed: {e}")   
    continue   
    elif k == " ":   
    index = min(index + 1, len(posts) - 1)   
    elif k == "":   
    index = max(index - 1, 0)   
    elif k in ("   
   ", "   
   "):   
    show_article(nntp, p["num"], group)   
    if prompt("Press R to reply, ENTER to continue: ").lower() == "r":   
    post_article(nntp, group, p["msgid"], p["subject"])   
    elif k == "l":   
    posts = reload_group(nntp, group)   
    index = 0   
    elif k == "g":   
    group = prompt("New group: ")   
    posts = reload_group(nntp, group)   
    index = 0   
    elif k == "j":   
    idx = jump_post(posts)   
    if idx is not None:   
    index = idx   
    elif k in ("f", "s", "m"):   
    kw = prompt("Keyword: ")   
    c = prompt("Articles to scan: ")   
    if not c.isdigit():   
    continue   
    if k == "f":   
    results = header_search(nntp, group, "from", kw, int(c))   
    elif k == "s":   
    results = header_search(nntp, group, "subject", kw, int(c))   
    else:   
    results = body_search(nntp, group, kw, int(c))   
    print(f"   
   Found {len(results)} posts:   
   ")   
    for r in results:   
      
   [continued in next message]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca