working file for initial connections and header reading.
authorKyle Spaans <kspaans@student.math.uwaterloo.ca>
Sat, 7 Mar 2009 20:19:43 +0000 (15:19 -0500)
committerKyle Spaans <kspaans@student.math.uwaterloo.ca>
Sat, 7 Mar 2009 20:19:43 +0000 (15:19 -0500)
Now need to figure out how to loop over all messages and an
appropriate structure to put them all in, so that dot code
can be generated.

connect.ss [new file with mode: 0644]

diff --git a/connect.ss b/connect.ss
new file mode 100644 (file)
index 0000000..88d2ae8
--- /dev/null
@@ -0,0 +1,24 @@
+#lang scheme
+
+(require net/nntp)
+
+;; A first try with connecting to the newsgroup and downloading some posts
+
+(define uwnews (connect-to-server "news.uwaterloo.ca"))
+
+(define-values (total first last) (open-news-group uwnews "uw.cs.cs136"))
+
+(printf "~a : ~a : ~a~n~n" total first last)
+
+;(for-each (lambda (x) (printf "~a~n" x)) (head-of-message uwnews 6038))
+
+(define from-regexp (make-desired-header "From"))
+(define mid-regexp (make-desired-header "Message-ID"))
+(define from-and-mid (extract-desired-headers
+                       (head-of-message uwnews 6038)
+                       (list from-regexp mid-regexp)))
+
+(printf "From:  ~a~nMID:   ~a~n~n" (car from-and-mid) (cadr from-and-mid))
+
+(disconnect-from-server uwnews)
+(display "Disconnected.\n")