if 0 {[Richard Suchenwirth] 2005-02-14 - After AOL told me they were'nt supporting their bad [NNTP] news reader any more, I couldn't help but look around, read the [nntp] man page, and hack together this ultra- simple news reader, only for [the comp.lang.tcl newsgroup]. [http://mini.net/files/nntp.jpg] In the [listbox] on top, you see the last 64 messages (descending, by number). Click on one to have it rendered in the [text] below. This is very minimal, but feel free to add your own bells and whistles :D } package require Tk package require nntp proc main argv { global n set host aioe.cjb.net pack [panedwindow .p -ori vert] -fill both -expand 1 .p add [frame .x] pack [scrollbar .x.y -command ".x.l yview"] -fill y -side right pack [listbox .x.l -yscrollc ".x.y set"] -fill both -expand 1 -side right set n [nntp::nntp $host] #$n authinfo $user $password ;#-- not needed for aioe.cjb.net foreach {num from to group} [$n group comp.lang.tcl] break for {set i $to} {$i>$to-64} {incr i -1} { set head [$n head $i] .x.l insert end [list $i [get Subject: $head] [get From: $head]] } bind .x.l {fetch .f.t [selection get]} .p add [frame .f] pack [scrollbar .f.y -command ".f.t yview"] -fill y -side right pack [text .f.t -wrap word -yscrollc ".f.y set"\ -padx 5 -pady 3 -height 12 -font {Helvetica 9}] \ -fill both -expand 1 -side right foreach color {red blue} {.f.t tag configure $color -foreground $color} display .f.t [$n article $to] } proc fetch {w what} { display $w [$::n article [lindex $what 0]] } #-- Extract a field from an article proc get {what where} { foreach line $where { if [string match $what* $line] { return [string map [list $what ""] $line] } } } proc display {w article} { $w delete 1.0 end $w insert end [get Subject: $article]\n red $w insert end [get From: $article]\n blue set inbody 0 foreach line $article { if $inbody {$w insert end $line\n} if {$line eq ""} {set inbody 1} } } main $argv bind . {exec wish $argv0 &; exit} bind . {console show} if 0 { 2005-04-01: [RS], updated to use a free server that provides comp.lang.tcl - thanks [miguel] for the hint! ---- [Category Internet] | [Arts and crafts of Tcl-Tk programming] }