1 ;;; elmo-pop3.el -- POP3 Interface for ELMO.
3 ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
4 ;; Copyright (C) 1999,2000 Kenichi OKADA <okada@opaopa.org>
6 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
7 ;; Kenichi OKADA <okada@opaopa.org>
8 ;; Keywords: mail, net news
10 ;; This file is part of ELMO (Elisp Library for Message Orchestration).
12 ;; This program is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; This program is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
41 (autoload 'md5 "md5"))
43 (defvar elmo-pop3-exists-exactly t)
44 (defvar sasl-mechanism-alist)
46 (defvar elmo-pop3-total-size nil)
49 (defvar elmo-pop3-debug nil
50 "Non-nil forces POP3 folder as debug mode.
51 Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
53 (defvar elmo-pop3-debug-inhibit-logging nil)
56 (defsubst elmo-pop3-debug (message &rest args)
58 (with-current-buffer (get-buffer-create "*POP3 DEBUG*")
59 (goto-char (point-max))
60 (if elmo-pop3-debug-inhibit-logging
61 (insert "NO LOGGING\n")
62 (insert (apply 'format message args) "\n")))))
64 (luna-define-class elmo-pop3-session (elmo-network-session))
67 (defvar elmo-pop3-read-point nil)
68 (defvar elmo-pop3-number-uidl-hash nil) ; number -> uidl
69 (defvar elmo-pop3-uidl-number-hash nil) ; uidl -> number
70 (defvar elmo-pop3-size-hash nil) ; number -> size
71 (defvar elmo-pop3-uidl-done nil)
72 (defvar elmo-pop3-list-done nil)
74 (defvar elmo-pop3-local-variables '(elmo-pop3-read-point
75 elmo-pop3-uidl-number-hash
76 elmo-pop3-number-uidl-hash
81 (luna-define-method elmo-network-close-session ((session elmo-pop3-session))
82 (when (elmo-network-session-process-internal session)
83 (when (memq (process-status
84 (elmo-network-session-process-internal session))
86 (elmo-pop3-send-command (elmo-network-session-process-internal session)
88 (or (elmo-pop3-read-response
89 (elmo-network-session-process-internal session) t)
90 (error "POP error: QUIT failed")))
91 (kill-buffer (process-buffer
92 (elmo-network-session-process-internal session)))
93 (delete-process (elmo-network-session-process-internal session))))
95 (defun elmo-pop3-get-session (spec &optional if-exists)
96 (elmo-network-get-session
99 (elmo-pop3-spec-hostname spec)
100 (elmo-pop3-spec-port spec)
101 (elmo-pop3-spec-username spec)
102 (elmo-pop3-spec-auth spec)
103 (elmo-pop3-spec-stream-type spec)
106 (defun elmo-pop3-send-command (process command &optional no-erase)
107 (with-current-buffer (process-buffer process)
110 (goto-char (point-min))
111 (setq elmo-pop3-read-point (point))
112 (elmo-pop3-debug "SEND: %s\n" command)
113 (process-send-string process command)
114 (process-send-string process "\r\n")))
116 (defun elmo-pop3-read-response (process &optional not-command)
117 (with-current-buffer (process-buffer process)
118 (let ((case-fold-search nil)
119 (response-string nil)
120 (response-continue t)
123 (while response-continue
124 (goto-char elmo-pop3-read-point)
125 (while (not (re-search-forward "\r?\n" nil t))
126 (accept-process-output process)
127 (goto-char elmo-pop3-read-point))
128 (setq match-end (point))
129 (setq response-string
130 (buffer-substring elmo-pop3-read-point (- match-end 2)))
131 (goto-char elmo-pop3-read-point)
132 (if (looking-at "\\+.*$")
134 (setq response-continue nil)
135 (setq elmo-pop3-read-point match-end)
138 (concat return-value "\n" response-string)
140 (if (looking-at "\\-.*$")
142 (setq response-continue nil)
143 (setq elmo-pop3-read-point match-end)
144 (setq return-value nil))
145 (setq elmo-pop3-read-point match-end)
147 (setq response-continue nil))
150 (concat return-value "\n" response-string)
152 (setq elmo-pop3-read-point match-end)))
155 (defun elmo-pop3-process-filter (process output)
157 (set-buffer (process-buffer process))
158 (goto-char (point-max))
160 (elmo-pop3-debug "RECEIVED: %s\n" output)
161 (if elmo-pop3-total-size
162 (message "Retrieving...(%d/%d bytes)."
163 (buffer-size) elmo-pop3-total-size))))
165 (defun elmo-pop3-auth-user (session)
166 (let ((process (elmo-network-session-process-internal session)))
168 (elmo-pop3-send-command
170 (format "user %s" (elmo-network-session-user-internal session)))
171 (or (elmo-pop3-read-response process t)
172 (signal 'elmo-authenticate-error
173 '(elmo-pop-auth-user)))
174 (elmo-pop3-send-command process
178 (elmo-network-session-password-key session))))
179 (or (elmo-pop3-read-response process t)
180 (signal 'elmo-authenticate-error
181 '(elmo-pop-auth-user)))))
183 (defun elmo-pop3-auth-apop (session)
184 (if (string-match "^\+OK .*\\(<[^\>]+>\\)"
185 (elmo-network-session-greeting-internal session))
186 ;; good, APOP ready server
188 (elmo-pop3-send-command
189 (elmo-network-session-process-internal session)
191 (elmo-network-session-user-internal session)
193 (concat (match-string
195 (elmo-network-session-greeting-internal session))
197 (elmo-network-session-password-key session))))))
198 (or (elmo-pop3-read-response
199 (elmo-network-session-process-internal session)
201 (signal 'elmo-authenticate-error
202 '(elmo-pop3-auth-apop))))
203 (signal 'elmo-open-error '(elmo-pop3-auth-apop))))
205 (luna-define-method elmo-network-initialize-session-buffer :after
206 ((session elmo-pop3-session) buffer)
207 (with-current-buffer buffer
208 (mapcar 'make-variable-buffer-local elmo-pop3-local-variables)))
210 (luna-define-method elmo-network-initialize-session ((session
212 (let ((process (elmo-network-session-process-internal session))
214 (with-current-buffer (process-buffer process)
215 (set-process-filter process 'elmo-pop3-process-filter)
216 (setq elmo-pop3-read-point (point-min))
217 ;; Skip garbage output from process before greeting.
218 (while (and (memq (process-status process) '(open run))
219 (goto-char (point-max))
221 (not (looking-at "+OK")))
222 (accept-process-output process 1))
223 (setq elmo-pop3-read-point (point))
224 (or (elmo-network-session-set-greeting-internal
226 (elmo-pop3-read-response process t))
227 (signal 'elmo-open-error
228 '(elmo-network-intialize-session)))
229 (when (eq (elmo-network-stream-type-symbol
230 (elmo-network-session-stream-type-internal session))
232 (elmo-pop3-send-command process "stls")
233 (if (string-match "^\+OK"
234 (elmo-pop3-read-response process))
235 (starttls-negotiate process)
236 (signal 'elmo-open-error
237 '(elmo-pop3-starttls-error)))))))
239 (luna-define-method elmo-network-authenticate-session ((session
241 (with-current-buffer (process-buffer
242 (elmo-network-session-process-internal session))
243 (let* ((process (elmo-network-session-process-internal session))
244 (elmo-pop3-debug-inhibit-logging t)
245 (auth (elmo-network-session-auth-internal session))
246 (auth (mapcar '(lambda (mechanism) (upcase (symbol-name mechanism)))
247 (if (listp auth) auth (list auth))))
249 client name step response mechanism
250 sasl-read-passphrase)
251 (or (and (string= "USER" (car auth))
252 (elmo-pop3-auth-user session))
253 (and (string= "APOP" (car auth))
254 (elmo-pop3-auth-apop session))
257 (setq sasl-mechanisms (mapcar 'car sasl-mechanism-alist))
258 (setq mechanism (sasl-find-mechanism auth))
260 (signal 'elmo-authenticate-error '(elmo-pop3-auth-no-mechanisms)))
264 (elmo-network-session-user-internal session)
266 (elmo-network-session-host-internal session)))
267 ;;; (if elmo-pop3-auth-user-realm
268 ;;; (sasl-client-set-property client 'realm elmo-pop3-auth-user-realm))
269 (setq name (sasl-mechanism-name mechanism))
270 (elmo-network-session-set-auth-internal session
271 (intern (downcase name)))
272 (setq sasl-read-passphrase
276 (elmo-network-session-password-key session)))))
277 (setq step (sasl-next-step client nil))
278 (elmo-pop3-send-command
281 (and (sasl-step-data step)
284 (elmo-base64-encode-string
285 (sasl-step-data step) 'no-line-break))))) ;)
288 (unless (setq response (elmo-pop3-read-response process t))
289 ;; response is NO or BAD.
290 (signal 'elmo-authenticate-error
292 (concat "elmo-pop3-auth-"
294 (if (string-match "^\+OK" response)
295 (if (sasl-next-step client step)
297 (signal 'elmo-authenticate-error
299 (concat "elmo-pop3-auth-"
301 ;; The authentication process is finished.
305 (elmo-base64-decode-string
306 (cadr (split-string response " "))))
307 (setq step (sasl-next-step client step))
308 (elmo-pop3-send-command
310 (if (sasl-step-data step)
311 (elmo-base64-encode-string (sasl-step-data step)
315 (luna-define-method elmo-network-setup-session ((session
317 (let ((process (elmo-network-session-process-internal session))
319 (with-current-buffer (process-buffer process)
320 (setq elmo-pop3-size-hash (elmo-make-hash 31))
321 ;; To get obarray of uidl and size
322 (elmo-pop3-send-command process "list")
323 (if (null (elmo-pop3-read-response process))
324 (error "POP LIST command failed"))
325 (if (null (setq response
326 (elmo-pop3-read-contents
327 (current-buffer) process)))
328 (error "POP LIST command failed"))
329 ;; POP server always returns a sequence of serial numbers.
330 (setq count (elmo-pop3-parse-list-response response))
332 (when elmo-pop3-use-uidl
333 (setq elmo-pop3-uidl-number-hash (elmo-make-hash (* count 2)))
334 (setq elmo-pop3-number-uidl-hash (elmo-make-hash (* count 2)))
336 (elmo-pop3-send-command process "uidl")
337 (unless (elmo-pop3-read-response process)
338 (error "POP UIDL failed"))
339 (unless (setq response (elmo-pop3-read-contents
340 (current-buffer) process))
341 (error "POP UIDL failed"))
342 (elmo-pop3-parse-uidl-response response)))))
344 (defun elmo-pop3-read-contents (buffer process)
345 (with-current-buffer buffer
346 (let ((case-fold-search nil)
348 (goto-char elmo-pop3-read-point)
349 (while (not (re-search-forward "^\\.\r\n" nil t))
350 (accept-process-output process)
351 (goto-char elmo-pop3-read-point))
352 (setq match-end (point))
354 (buffer-substring elmo-pop3-read-point
358 (defun elmo-pop3-list-folders (spec &optional hierarchy) nil)
359 (defun elmo-pop3-append-msg (spec string) nil nil)
360 (defun elmo-pop3-folder-creatable-p (spec) nil)
361 (defun elmo-pop3-create-folder (spec) nil)
363 (defun elmo-pop3-folder-exists-p (spec)
364 (if (and elmo-pop3-exists-exactly
365 (elmo-pop3-plugged-p spec))
367 (let (elmo-auto-change-plugged ; don't change plug status.
368 elmo-pop3-use-uidl ; No need to use uidl.
371 (setq session (elmo-pop3-get-session spec))
373 (elmo-network-close-session session)))))
376 (defun elmo-pop3-parse-uidl-response (string)
377 (let ((buffer (current-buffer))
380 (let (number uid list)
382 (goto-char (point-min))
383 (while (re-search-forward "^\\([0-9]+\\)[\t ]+\\([^ \n]+\\)$" nil t)
384 (setq number (elmo-match-buffer 1))
385 (setq uid (elmo-match-buffer 2))
386 (with-current-buffer buffer
387 (elmo-set-hash-val uid number elmo-pop3-uidl-number-hash)
388 (elmo-set-hash-val (concat "#" number) uid
389 elmo-pop3-number-uidl-hash))
390 (setq list (cons uid list)))
391 (with-current-buffer buffer (setq elmo-pop3-uidl-done t))
394 (defun elmo-pop3-parse-list-response (string)
395 (let ((buffer (current-buffer))
400 (goto-char (point-min))
401 (while (re-search-forward "^\\([0-9]+\\)[\t ]\\([0-9]+\\)$" nil t)
404 (cons (elmo-match-buffer 1)
405 (elmo-match-buffer 2))
407 (setq count (1+ count)))
408 (with-current-buffer buffer
409 (setq elmo-pop3-size-hash (elmo-make-hash (* (length alist) 2)))
411 (elmo-set-hash-val (concat "#" (car (car alist)))
414 (setq alist (cdr alist)))
415 (setq elmo-pop3-list-done t))
418 (defun elmo-pop3-list-location (spec)
419 (with-current-buffer (process-buffer
420 (elmo-network-session-process-internal
421 (elmo-pop3-get-session spec)))
423 (if elmo-pop3-uidl-done
427 (setq list (cons (symbol-name atom) list)))
428 elmo-pop3-uidl-number-hash)
430 (error "POP3: Error in UIDL")))))
432 (defun elmo-pop3-list-by-uidl-subr (spec &optional nonsort)
433 (let ((flist (elmo-list-folder-by-location
435 (elmo-pop3-list-location spec))))
437 (cons (elmo-max-of-list flist) (length flist))
440 (defun elmo-pop3-list-by-list (spec)
441 (with-current-buffer (process-buffer
442 (elmo-network-session-process-internal
443 (elmo-pop3-get-session spec)))
445 (if elmo-pop3-list-done
447 (mapatoms (lambda (atom)
448 (setq list (cons (string-to-int
449 (substring (symbol-name atom) 1))
453 (error "POP3: Error in list")))))
455 (defun elmo-pop3-list-folder (spec &optional nohide)
456 (let ((killed (and elmo-use-killed-list
457 (elmo-msgdb-killed-list-load
458 (elmo-msgdb-expand-path spec))))
460 (elmo-pop3-commit spec)
461 (setq numbers (if elmo-pop3-use-uidl
463 (elmo-pop3-list-by-uidl-subr spec))
464 (elmo-pop3-list-by-list spec)))
465 (elmo-living-messages numbers killed)))
467 (defun elmo-pop3-max-of-folder (spec)
468 (elmo-pop3-commit spec)
469 (if elmo-pop3-use-uidl
471 (elmo-pop3-list-by-uidl-subr spec 'nonsort)
472 (elmo-pop3-commit spec))
474 (elmo-network-session-process-internal
475 (elmo-pop3-get-session spec)))
478 (with-current-buffer (process-buffer process)
479 (elmo-pop3-send-command process "STAT")
480 (setq response (elmo-pop3-read-response process))
481 ;; response: "^\+OK 2 7570$"
482 (if (not (string-match "^\+OK[ \t]*\\([0-9]*\\)" response))
483 (error "POP STAT command failed")
486 (substring response (match-beginning 1)(match-end 1 ))))
487 (elmo-pop3-commit spec)
488 (cons total total))))))
490 (defvar elmo-pop3-header-fetch-chop-length 200)
492 (defsubst elmo-pop3-next-result-arrived-p ()
494 ((eq (following-char) ?+)
495 (if (re-search-forward "\n\\.\r?\n" nil t)
499 (if (search-forward "\n" nil t)
505 (defun elmo-pop3-retrieve-headers (buffer tobuffer process articles)
509 (let ((number (length articles))
512 (last-point (point-min)))
513 ;; Send HEAD commands.
515 (elmo-pop3-send-command process (format
516 "top %s 0" (car articles))
518 ;;; (accept-process-output process 1)
519 (setq articles (cdr articles))
520 (setq count (1+ count))
521 ;; Every 200 requests we have to read the stream in
522 ;; order to avoid deadlocks.
523 (when (or elmo-pop3-send-command-synchronously
524 (null articles) ;All requests have been sent.
525 (zerop (% count elmo-pop3-header-fetch-chop-length)))
526 (unless elmo-pop3-send-command-synchronously
527 (accept-process-output process 1))
531 (goto-char last-point)
533 (while (elmo-pop3-next-result-arrived-p)
534 (setq last-point (point))
535 (setq received (1+ received)))
537 (when (> number elmo-display-progress-threshold)
538 (if (or (zerop (% received 5)) (= received number))
539 (elmo-display-progress
540 'elmo-pop3-retrieve-headers "Getting headers..."
541 (/ (* received 100) number))))
542 (accept-process-output process 1)
543 ;;; (accept-process-output process)
545 ;; Remove all "\r"'s.
546 (goto-char (point-min))
547 (while (search-forward "\r\n" nil t)
548 (replace-match "\n"))
549 (copy-to-buffer tobuffer (point-min) (point-max)))))
551 (defalias 'elmo-pop3-msgdb-create 'elmo-pop3-msgdb-create-as-numlist)
553 (defun elmo-pop3-sort-overview-by-original-number (overview loc-alist)
557 (< (elmo-pop3-uidl-to-number
558 (cdr (assq (elmo-msgdb-overview-entity-get-number ent1)
560 (elmo-pop3-uidl-to-number
561 (cdr (assq (elmo-msgdb-overview-entity-get-number ent2)
565 (defun elmo-pop3-sort-msgdb-by-original-number (msgdb)
566 (message "Sorting...")
567 (let ((overview (elmo-msgdb-get-overview msgdb)))
568 (setq overview (elmo-pop3-sort-overview-by-original-number
570 (elmo-msgdb-get-location msgdb)))
571 (message "Sorting...done")
572 (list overview (nth 1 msgdb)(nth 2 msgdb)(nth 3 msgdb)(nth 4 msgdb))))
574 (defun elmo-pop3-msgdb-create-as-numlist (spec numlist new-mark
575 already-mark seen-mark
576 important-mark seen-list
579 (let ((process (elmo-network-session-process-internal
580 (elmo-pop3-get-session spec)))
582 (if elmo-pop3-use-uidl
583 (setq loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
584 (elmo-msgdb-location-load
585 (elmo-msgdb-expand-path spec)))))
586 (with-current-buffer (process-buffer process)
587 (elmo-pop3-sort-msgdb-by-original-number
588 (elmo-pop3-msgdb-create-by-header process numlist
589 new-mark already-mark
593 (defun elmo-pop3-uidl-to-number (uidl)
594 (string-to-number (elmo-get-hash-val uidl
595 elmo-pop3-uidl-number-hash)))
597 (defun elmo-pop3-number-to-uidl (number)
598 (elmo-get-hash-val (format "#%d" number)
599 elmo-pop3-number-uidl-hash))
601 (defun elmo-pop3-number-to-size (number)
602 (elmo-get-hash-val (format "#%d" number)
603 elmo-pop3-size-hash))
605 (defun elmo-pop3-msgdb-create-by-header (process numlist
606 new-mark already-mark
610 (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*")))
611 (with-current-buffer (process-buffer process)
612 (if loc-alist ; use uidl.
618 (elmo-pop3-uidl-to-number (cdr (assq number loc-alist))))
620 (elmo-pop3-retrieve-headers (process-buffer process)
621 tmp-buffer process numlist)
623 (elmo-pop3-msgdb-create-message
628 new-mark already-mark seen-mark seen-list loc-alist)
629 (kill-buffer tmp-buffer)))))
631 (defun elmo-pop3-msgdb-create-message (buffer
634 numlist new-mark already-mark
639 (let (beg overview number-alist mark-alist
640 entity i number message-id gmark seen size)
642 (elmo-set-buffer-multibyte default-enable-multibyte-characters)
643 (goto-char (point-min))
645 (message "Creating msgdb...")
647 (setq beg (save-excursion (forward-line 1) (point)))
648 (elmo-pop3-next-result-arrived-p)
652 (narrow-to-region beg (point))
654 (elmo-msgdb-create-overview-from-buffer
656 (setq numlist (cdr numlist))
659 (elmo-msgdb-append-element
661 (with-current-buffer (process-buffer process)
662 (elmo-msgdb-overview-entity-set-size
665 (elmo-pop3-number-to-size
666 (elmo-msgdb-overview-entity-get-number entity))))
670 (elmo-pop3-number-to-uidl
671 (elmo-msgdb-overview-entity-get-number entity))
673 (elmo-msgdb-overview-entity-set-number entity number)))
675 (elmo-msgdb-number-add
677 (elmo-msgdb-overview-entity-get-number entity)
679 (setq message-id (car entity))
680 (setq seen (member message-id seen-list))
681 (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
682 (if (elmo-cache-exists-p
688 (if elmo-pop3-use-cache
692 (elmo-msgdb-mark-append
694 (elmo-msgdb-overview-entity-get-number entity)
696 (when (> num elmo-display-progress-threshold)
698 (if (or (zerop (% i 5)) (= i num))
699 (elmo-display-progress
700 'elmo-pop3-msgdb-create-message "Creating msgdb..."
701 (/ (* i 100) num)))))
702 (list overview number-alist mark-alist loc-alist))))
704 (defun elmo-pop3-read-body (process outbuf)
705 (with-current-buffer (process-buffer process)
706 (let ((start elmo-pop3-read-point)
709 (while (not (re-search-forward "^\\.\r?\n" nil t))
710 (accept-process-output process)
713 (with-current-buffer outbuf
715 (insert-buffer-substring (process-buffer process) start (- end 3))
716 (elmo-delete-cr-get-content-type)))))
718 (defun elmo-pop3-read-msg (spec number outbuf &optional msgdb unread)
719 (let* ((loc-alist (if elmo-pop3-use-uidl
721 (elmo-msgdb-get-location msgdb)
722 (elmo-msgdb-location-load
723 (elmo-msgdb-expand-path spec)))))
724 (process (elmo-network-session-process-internal
725 (elmo-pop3-get-session spec)))
726 size response errmsg msg)
727 (with-current-buffer (process-buffer process)
729 (setq number (elmo-pop3-uidl-to-number
730 (cdr (assq number loc-alist)))))
731 (setq size (string-to-number
732 (elmo-pop3-number-to-size number)))
734 (elmo-pop3-send-command process
735 (format "retr %s" number))
736 (setq elmo-pop3-total-size size)
737 (unless elmo-inhibit-display-retrieval-progress
738 (setq elmo-pop3-total-size size)
739 (elmo-display-progress
740 'elmo-pop3-display-retrieval-progress
741 (format "Retrieving (0/%d bytes)..." elmo-pop3-total-size)
745 (when (null (setq response (elmo-pop3-read-response
747 (error "Fetching message failed"))
748 (setq response (elmo-pop3-read-body process outbuf)))
749 (setq elmo-pop3-total-size nil))
750 (unless elmo-inhibit-display-retrieval-progress
751 (elmo-display-progress
752 'elmo-display-retrieval-progress "" 100) ; remove progress bar.
753 (message "Retrieving...done."))
755 (goto-char (point-min))
756 (while (re-search-forward "^\\." nil t)
761 (defun elmo-pop3-delete-msg (process number loc-alist)
762 (with-current-buffer (process-buffer process)
763 (let (response errmsg msg)
765 (setq number (elmo-pop3-uidl-to-number
766 (cdr (assq number loc-alist)))))
769 (elmo-pop3-send-command process
770 (format "dele %s" number))
771 (when (null (setq response (elmo-pop3-read-response
773 (error "Deleting message failed")))
774 (error "Deleting message failed")))))
776 (defun elmo-pop3-delete-msgs (spec msgs &optional msgdb)
777 (let ((loc-alist (if elmo-pop3-use-uidl
779 (elmo-msgdb-get-location msgdb)
780 (elmo-msgdb-location-load
781 (elmo-msgdb-expand-path spec)))))
782 (process (elmo-network-session-process-internal
783 (elmo-pop3-get-session spec))))
784 (mapcar '(lambda (msg) (elmo-pop3-delete-msg
785 process msg loc-alist))
788 (defun elmo-pop3-search (spec condition &optional numlist)
789 (error "Searching in pop3 folder is not implemented yet"))
791 (defun elmo-pop3-use-cache-p (spec number)
794 (defun elmo-pop3-local-file-p (spec number)
797 (defun elmo-pop3-port-label (spec)
799 (if (elmo-pop3-spec-stream-type spec)
800 (concat "!" (symbol-name
801 (elmo-network-stream-type-symbol
802 (elmo-pop3-spec-stream-type spec)))))))
804 (defsubst elmo-pop3-portinfo (spec)
805 (list (elmo-pop3-spec-hostname spec)
806 (elmo-pop3-spec-port spec)))
808 (defun elmo-pop3-plugged-p (spec)
809 (apply 'elmo-plugged-p
810 (append (elmo-pop3-portinfo spec)
811 (list nil (quote (elmo-pop3-port-label spec))))))
813 (defun elmo-pop3-set-plugged (spec plugged add)
814 (apply 'elmo-set-plugged plugged
815 (append (elmo-pop3-portinfo spec)
816 (list nil nil (quote (elmo-pop3-port-label spec)) add))))
818 (defalias 'elmo-pop3-sync-number-alist
819 'elmo-generic-sync-number-alist)
820 (defalias 'elmo-pop3-list-folder-unread
821 'elmo-generic-list-folder-unread)
822 (defalias 'elmo-pop3-list-folder-important
823 'elmo-generic-list-folder-important)
824 (defalias 'elmo-pop3-folder-diff 'elmo-generic-folder-diff)
826 (defun elmo-pop3-commit (spec)
827 (if (elmo-pop3-plugged-p spec)
828 (let ((session (elmo-pop3-get-session spec 'if-exists)))
830 (elmo-network-close-session session)))))
833 (product-provide (provide 'elmo-pop3) (require 'elmo-version))
835 ;;; elmo-pop3.el ends here