Browse code
1.5
jkf authored on 26/04/2000 20:53:40
Showing 5 changed files
Showing 5 changed files
... | ... |
@@ -1,3 +1,9 @@ |
1 |
+2000-04-26 John Foderaro <jkf@tiger.franz.com> |
|
2 |
+ |
|
3 |
+ * package changed from post-office to net.post-office |
|
4 |
+ the po nickname was removed. |
|
5 |
+ |
|
6 |
+ |
|
1 | 7 |
2000-04-21 John Foderaro <jkf@tiger.franz.com> |
2 | 8 |
versio 1.4 |
3 | 9 |
* imap.cl: added pop commands unique-id and top-lines |
... | ... |
@@ -19,7 +19,7 @@ |
19 | 19 |
;; Commercial Software developed at private expense as specified in |
20 | 20 |
;; DOD FAR Supplement 52.227-7013 (c) (1) (ii), as applicable. |
21 | 21 |
;; |
22 |
-;; $Id: imap.cl,v 1.10 2000/04/21 21:52:15 jkf Exp $ |
|
22 |
+;; $Id: imap.cl,v 1.11 2000/04/26 20:53:40 jkf Exp $ |
|
23 | 23 |
|
24 | 24 |
;; Description: |
25 | 25 |
;; |
... | ... |
@@ -29,8 +29,7 @@ |
29 | 29 |
;;- |
30 | 30 |
|
31 | 31 |
|
32 |
-(defpackage :post-office |
|
33 |
- (:nicknames :po) |
|
32 |
+(defpackage :net.post-office |
|
34 | 33 |
(:use :lisp :excl) |
35 | 34 |
(:export |
36 | 35 |
#:address-name |
... | ... |
@@ -91,11 +90,11 @@ |
91 | 90 |
) |
92 | 91 |
) |
93 | 92 |
|
94 |
-(in-package :post-office) |
|
93 |
+(in-package :net.post-office) |
|
95 | 94 |
|
96 | 95 |
(provide :imap) |
97 | 96 |
|
98 |
-(defparameter *imap-version-number* '(:major 1 :minor 4)) ; major.minor |
|
97 |
+(defparameter *imap-version-number* '(:major 1 :minor 5)) ; major.minor |
|
99 | 98 |
|
100 | 99 |
;; todo |
101 | 100 |
;; have the list of tags selected done on a per connection basis to |
... | ... |
@@ -2,15 +2,15 @@ |
2 | 2 |
(load (compile-file-if-needed "smtp")) |
3 | 3 |
|
4 | 4 |
(defun test () |
5 |
- (setq *xx* (po::make-imap-connection "tiger.franz.com" |
|
5 |
+ (setq *xx* (net.post-office::make-imap-connection "tiger.franz.com" |
|
6 | 6 |
:user "jkfmail" |
7 | 7 |
:password "jkf.imap" |
8 | 8 |
)) |
9 |
- (po::select-mailbox *xx* "inbox")) |
|
9 |
+ (net.post-office::select-mailbox *xx* "inbox")) |
|
10 | 10 |
|
11 | 11 |
|
12 | 12 |
(defun testp () |
13 |
- (setq *xx* (po::make-pop-connection "tiger.franz.com" |
|
14 |
- :user "jkfmail" |
|
15 |
- :password "jkf.imap" |
|
16 |
- ))) |
|
13 |
+ (setq *xx* (net.post-office::make-pop-connection "tiger.franz.com" |
|
14 |
+ :user "jkfmail" |
|
15 |
+ :password "jkf.imap" |
|
16 |
+ ))) |
... | ... |
@@ -2,14 +2,13 @@ |
2 | 2 |
;; |
3 | 3 |
;; smtp - rfc821 |
4 | 4 |
;; |
5 |
-(defpackage :post-office |
|
6 |
- (:nicknames :po) |
|
5 |
+(defpackage :net.post-office |
|
7 | 6 |
(:use #:lisp #:excl) |
8 | 7 |
(:export |
9 | 8 |
#:send-letter |
10 | 9 |
#:send-smtp)) |
11 | 10 |
|
12 |
-(in-package :post-office) |
|
11 |
+(in-package :net.post-office) |
|
13 | 12 |
|
14 | 13 |
;; the exported functions: |
15 | 14 |
|
... | ... |
@@ -19,7 +19,7 @@ |
19 | 19 |
(defun test-connect () |
20 | 20 |
;; test connecting and disconnecting from the server |
21 | 21 |
|
22 |
- (let ((mb (po:make-imap-connection *test-machine* |
|
22 |
+ (let ((mb (net.post-office:make-imap-connection *test-machine* |
|
23 | 23 |
:user *test-account* |
24 | 24 |
:password *test-password*))) |
25 | 25 |
(unwind-protect |
... | ... |
@@ -28,19 +28,19 @@ |
28 | 28 |
(test-t (not (null mb))) ; make sure we got a mailbox object |
29 | 29 |
|
30 | 30 |
; check that we've stored resonable values in the mb object |
31 |
- (test-equal "/" (po:mailbox-separator mb)) |
|
31 |
+ (test-equal "/" (net.post-office:mailbox-separator mb)) |
|
32 | 32 |
|
33 |
- (test-t (po::select-mailbox mb "inbox")) |
|
33 |
+ (test-t (net.post-office::select-mailbox mb "inbox")) |
|
34 | 34 |
|
35 |
- (test-t (> (po:mailbox-uidvalidity mb) 0)) |
|
36 |
- (test-t (not (null (po:mailbox-flags mb))))) |
|
35 |
+ (test-t (> (net.post-office:mailbox-uidvalidity mb) 0)) |
|
36 |
+ (test-t (not (null (net.post-office:mailbox-flags mb))))) |
|
37 | 37 |
|
38 |
- (test-t (po:close-connection mb))))) |
|
38 |
+ (test-t (net.post-office:close-connection mb))))) |
|
39 | 39 |
|
40 | 40 |
|
41 | 41 |
(defun test-sends () |
42 | 42 |
;; test sending and reading mail |
43 |
- (let ((mb (po:make-imap-connection *test-machine* |
|
43 |
+ (let ((mb (net.post-office:make-imap-connection *test-machine* |
|
44 | 44 |
:user *test-account* |
45 | 45 |
:password *test-password*))) |
46 | 46 |
(unwind-protect |
... | ... |
@@ -48,41 +48,41 @@ |
48 | 48 |
(test-t (not (null mb))) ; make sure we got a mailbox object |
49 | 49 |
|
50 | 50 |
;; go through the mailboxes and delete all letters |
51 |
- (dolist (mblist (po:mailbox-list mb :pattern "*")) |
|
52 |
- (if* (not (member :\\noselect (po:mailbox-list-flags mblist))) |
|
53 |
- then (po:select-mailbox mb (po:mailbox-list-name mblist)) |
|
54 |
- (let ((count (po:mailbox-message-count mb))) |
|
51 |
+ (dolist (mblist (net.post-office:mailbox-list mb :pattern "*")) |
|
52 |
+ (if* (not (member :\\noselect (net.post-office:mailbox-list-flags mblist))) |
|
53 |
+ then (net.post-office:select-mailbox mb (net.post-office:mailbox-list-name mblist)) |
|
54 |
+ (let ((count (net.post-office:mailbox-message-count mb))) |
|
55 | 55 |
; remove all old mail |
56 | 56 |
(if* (> count 0) |
57 |
- then (po:alter-flags mb `(:seq 1 ,count) :add-flags :\\deleted) |
|
58 |
- (po:expunge-mailbox mb) |
|
59 |
- (test-eql 0 (po:mailbox-message-count mb))) |
|
57 |
+ then (net.post-office:alter-flags mb `(:seq 1 ,count) :add-flags :\\deleted) |
|
58 |
+ (net.post-office:expunge-mailbox mb) |
|
59 |
+ (test-eql 0 (net.post-office:mailbox-message-count mb))) |
|
60 | 60 |
; remove mailbox (except inbox) |
61 |
- (if* (not (equalp "inbox" (po:mailbox-list-name mblist))) |
|
61 |
+ (if* (not (equalp "inbox" (net.post-office:mailbox-list-name mblist))) |
|
62 | 62 |
then ; must not be selected if we want to del |
63 |
- (po:select-mailbox mb "inbox") |
|
64 |
- (po:delete-mailbox mb (po:mailbox-list-name mblist))) |
|
63 |
+ (net.post-office:select-mailbox mb "inbox") |
|
64 |
+ (net.post-office:delete-mailbox mb (net.post-office:mailbox-list-name mblist))) |
|
65 | 65 |
|
66 | 66 |
))) |
67 | 67 |
|
68 | 68 |
|
69 | 69 |
;; send five letters |
70 | 70 |
(dotimes (i 5) |
71 |
- (po:send-smtp *test-machine* |
|
71 |
+ (net.post-office:send-smtp *test-machine* |
|
72 | 72 |
*test-email* |
73 | 73 |
*test-email* |
74 | 74 |
(format nil "message number ~d" (1+ i)))) |
75 | 75 |
|
76 | 76 |
; test to see if imap figures out that the letters are there |
77 |
- (po:select-mailbox mb "inbox") |
|
77 |
+ (net.post-office:select-mailbox mb "inbox") |
|
78 | 78 |
|
79 | 79 |
; wait a bit for the mail to be delivered |
80 | 80 |
(dotimes (i 5) |
81 |
- (if* (not (eql 5 (po:mailbox-message-count mb))) |
|
81 |
+ (if* (not (eql 5 (net.post-office:mailbox-message-count mb))) |
|
82 | 82 |
then (sleep 1) |
83 |
- (po: noop mb))) |
|
83 |
+ (net.post-office: noop mb))) |
|
84 | 84 |
|
85 |
- (test-eql 5 (po:mailbox-message-count mb)) |
|
85 |
+ (test-eql 5 (net.post-office:mailbox-message-count mb)) |
|
86 | 86 |
|
87 | 87 |
; test the search facility |
88 | 88 |
; look for the message number we put in each message. |
... | ... |
@@ -90,23 +90,23 @@ |
90 | 90 |
(dotimes (i 5) |
91 | 91 |
(let ((mn (1+ i))) |
92 | 92 |
(test-equal (list mn) |
93 |
- (po:search-mailbox mb |
|
93 |
+ (net.post-office:search-mailbox mb |
|
94 | 94 |
`(:body ,(format nil "~d" mn)))))) |
95 | 95 |
|
96 | 96 |
; test getting data from mail message |
97 |
- (let ((fetch-info (po:fetch-parts mb |
|
97 |
+ (let ((fetch-info (net.post-office:fetch-parts mb |
|
98 | 98 |
1 |
99 | 99 |
"(envelope body[1])"))) |
100 |
- (let ((envelope (po:fetch-field 1 "envelope" fetch-info)) |
|
101 |
- (body (po:fetch-field 1 "body[1]" fetch-info))) |
|
102 |
- (test-equal "jkfmail" (po:address-mailbox |
|
103 |
- (car (po:envelope-from envelope)))) |
|
104 |
- (test-nil (po:address-mailbox |
|
105 |
- (car (po:envelope-to envelope)))) |
|
100 |
+ (let ((envelope (net.post-office:fetch-field 1 "envelope" fetch-info)) |
|
101 |
+ (body (net.post-office:fetch-field 1 "body[1]" fetch-info))) |
|
102 |
+ (test-equal "jkfmail" (net.post-office:address-mailbox |
|
103 |
+ (car (net.post-office:envelope-from envelope)))) |
|
104 |
+ (test-nil (net.post-office:address-mailbox |
|
105 |
+ (car (net.post-office:envelope-to envelope)))) |
|
106 | 106 |
|
107 | 107 |
(test-equal (format nil "message number 1~c" #\newline) |
108 | 108 |
body)))) |
109 |
- (test-t (po:close-connection mb))))) |
|
109 |
+ (test-t (net.post-office:close-connection mb))))) |
|
110 | 110 |
|
111 | 111 |
|
112 | 112 |
|
... | ... |
@@ -115,104 +115,104 @@ |
115 | 115 |
;; |
116 | 116 |
;; assume we have 5 messages in inbox at this time |
117 | 117 |
;; |
118 |
- (let ((mb (po:make-imap-connection *test-machine* |
|
118 |
+ (let ((mb (net.post-office:make-imap-connection *test-machine* |
|
119 | 119 |
:user *test-account* |
120 | 120 |
:password *test-password*))) |
121 | 121 |
(unwind-protect |
122 | 122 |
(progn |
123 |
- (po:select-mailbox mb "inbox") |
|
123 |
+ (net.post-office:select-mailbox mb "inbox") |
|
124 | 124 |
|
125 |
- (let ((flags (po:fetch-field 3 |
|
125 |
+ (let ((flags (net.post-office:fetch-field 3 |
|
126 | 126 |
"flags" |
127 |
- (po:fetch-parts |
|
127 |
+ (net.post-office:fetch-parts |
|
128 | 128 |
mb 3 "flags")))) |
129 | 129 |
(test-nil flags)) |
130 | 130 |
|
131 | 131 |
;; add flags |
132 |
- (let ((info (po:alter-flags mb 3 :add-flags :\\deleted))) |
|
132 |
+ (let ((info (net.post-office:alter-flags mb 3 :add-flags :\\deleted))) |
|
133 | 133 |
(test-equal '(:\\deleted) |
134 |
- (po:fetch-field 3 "flags" info))) |
|
134 |
+ (net.post-office:fetch-field 3 "flags" info))) |
|
135 | 135 |
|
136 | 136 |
; good bye message |
137 |
- (test-equal '(3) (po:expunge-mailbox mb)) |
|
137 |
+ (test-equal '(3) (net.post-office:expunge-mailbox mb)) |
|
138 | 138 |
|
139 |
- (po:alter-flags mb 4 :add-flags ':\\bbbb) |
|
139 |
+ (net.post-office:alter-flags mb 4 :add-flags ':\\bbbb) |
|
140 | 140 |
(test-equal '(:\\bbbb) |
141 |
- (po:fetch-field 4 "flags" |
|
142 |
- (po:fetch-parts mb 4 |
|
141 |
+ (net.post-office:fetch-field 4 "flags" |
|
142 |
+ (net.post-office:fetch-parts mb 4 |
|
143 | 143 |
"flags"))) |
144 | 144 |
|
145 | 145 |
|
146 | 146 |
) |
147 |
- (test-t (po:close-connection mb))))) |
|
147 |
+ (test-t (net.post-office:close-connection mb))))) |
|
148 | 148 |
|
149 | 149 |
(defun test-mailboxes () |
150 | 150 |
;; should be 4 messages now in inbox |
151 | 151 |
;; let's create 4 mailboxes, one for each letter |
152 |
- (let ((mb (po:make-imap-connection *test-machine* |
|
152 |
+ (let ((mb (net.post-office:make-imap-connection *test-machine* |
|
153 | 153 |
:user *test-account* |
154 | 154 |
:password *test-password*))) |
155 | 155 |
(unwind-protect |
156 | 156 |
(progn |
157 |
- (po:select-mailbox mb "inbox") |
|
157 |
+ (net.post-office:select-mailbox mb "inbox") |
|
158 | 158 |
(dotimes (i 4) |
159 | 159 |
(let ((mbname (format nil "temp/mb~d" i))) |
160 |
- (test-t (po:create-mailbox mb mbname)) |
|
161 |
- (po:copy-to-mailbox mb (1+ i) mbname))) |
|
160 |
+ (test-t (net.post-office:create-mailbox mb mbname)) |
|
161 |
+ (net.post-office:copy-to-mailbox mb (1+ i) mbname))) |
|
162 | 162 |
|
163 | 163 |
; now check that each new mailbox has one message |
164 | 164 |
(dotimes (i 4) |
165 | 165 |
(let ((mbname (format nil "temp/mb~d" i))) |
166 |
- (po:select-mailbox mb mbname) |
|
167 |
- (test-eql 1 (po:mailbox-message-count mb))))) |
|
168 |
- (test-t (po:close-connection mb))))) |
|
166 |
+ (net.post-office:select-mailbox mb mbname) |
|
167 |
+ (test-eql 1 (net.post-office:mailbox-message-count mb))))) |
|
168 |
+ (test-t (net.post-office:close-connection mb))))) |
|
169 | 169 |
|
170 | 170 |
|
171 | 171 |
(defun test-pop () |
172 | 172 |
;; test out the pop interface to the mailbox. |
173 | 173 |
|
174 |
- (let ((pb (po:make-pop-connection *test-machine* |
|
174 |
+ (let ((pb (net.post-office:make-pop-connection *test-machine* |
|
175 | 175 |
:user *test-account* |
176 | 176 |
:password *test-password*))) |
177 | 177 |
; still from before |
178 |
- (test-eql 4 (po:mailbox-message-count pb)) |
|
178 |
+ (test-eql 4 (net.post-office:mailbox-message-count pb)) |
|
179 | 179 |
|
180 |
- (test-eql 4 (length (po:unique-id pb))) |
|
180 |
+ (test-eql 4 (length (net.post-office:unique-id pb))) |
|
181 | 181 |
|
182 |
- (po:delete-letter pb '(:seq 2 3)) |
|
182 |
+ (net.post-office:delete-letter pb '(:seq 2 3)) |
|
183 | 183 |
|
184 |
- (test-eql 2 (length (po:unique-id pb))) |
|
184 |
+ (test-eql 2 (length (net.post-office:unique-id pb))) |
|
185 | 185 |
|
186 |
- (test-eql 4 (and :second (po:mailbox-message-count pb))) |
|
186 |
+ (test-eql 4 (and :second (net.post-office:mailbox-message-count pb))) |
|
187 | 187 |
|
188 |
- (po:noop pb) |
|
188 |
+ (net.post-office:noop pb) |
|
189 | 189 |
|
190 |
- (test-eql 2 (and :third (po:mailbox-message-count pb))) |
|
190 |
+ (test-eql 2 (and :third (net.post-office:mailbox-message-count pb))) |
|
191 | 191 |
|
192 |
- (po:fetch-letter pb 1) |
|
193 |
- (test-err (po:fetch-letter pb 2)) |
|
194 |
- (test-err (po:fetch-letter pb 3)) |
|
195 |
- (po:fetch-letter pb 4) |
|
192 |
+ (net.post-office:fetch-letter pb 1) |
|
193 |
+ (test-err (net.post-office:fetch-letter pb 2)) |
|
194 |
+ (test-err (net.post-office:fetch-letter pb 3)) |
|
195 |
+ (net.post-office:fetch-letter pb 4) |
|
196 | 196 |
|
197 |
- (po:close-connection pb) |
|
197 |
+ (net.post-office:close-connection pb) |
|
198 | 198 |
|
199 |
- (setq pb (po:make-pop-connection *test-machine* |
|
199 |
+ (setq pb (net.post-office:make-pop-connection *test-machine* |
|
200 | 200 |
:user *test-account* |
201 | 201 |
:password *test-password*)) |
202 | 202 |
|
203 |
- (test-eql 2 (and :fourth (po:mailbox-message-count pb))) |
|
203 |
+ (test-eql 2 (and :fourth (net.post-office:mailbox-message-count pb))) |
|
204 | 204 |
|
205 |
- (po:fetch-letter pb 1) ; just make sure there's no error |
|
205 |
+ (net.post-office:fetch-letter pb 1) ; just make sure there's no error |
|
206 | 206 |
|
207 |
- (po:top-lines pb 1 1) ; just make sure there's no error |
|
208 |
- (po:make-envelope-from-text (po:top-lines pb 1 0)) |
|
207 |
+ (net.post-office:top-lines pb 1 1) ; just make sure there's no error |
|
208 |
+ (net.post-office:make-envelope-from-text (net.post-office:top-lines pb 1 0)) |
|
209 | 209 |
|
210 |
- (po:close-connection pb))) |
|
210 |
+ (net.post-office:close-connection pb))) |
|
211 | 211 |
|
212 | 212 |
|
213 | 213 |
|
214 | 214 |
(defun test-imap () |
215 |
- (handler-bind ((po:po-condition |
|
215 |
+ (handler-bind ((net.post-office:po-condition |
|
216 | 216 |
#'(lambda (con) |
217 | 217 |
(format t "Got imap condition: ~a~%" con)))) |
218 | 218 |
|