* wl-fldmgr.el (wl-fldmgr-make-indent): Change from macro to function.
[elisp/wanderlust.git] / elmo / elmo-imap4.el
index ca2b4ab..82e8dbf 100644 (file)
@@ -38,6 +38,7 @@
 ;;    Author: Simon Josefsson <jas@pdc.kth.se>
 ;;
 
+;;; Code:
 (require 'elmo-vars)
 (require 'elmo-util)
 (require 'elmo-date)
@@ -48,7 +49,6 @@
 (require 'utf7)
 (require 'elmo-mime)
 
-;;; Code:
 (eval-when-compile (require 'cl))
 
 (defvar elmo-imap4-disuse-server-flag-mailbox-regexp "^#mh" ; UW imapd
@@ -331,14 +331,14 @@ Returns a TAG string which is assigned to the COMMAND."
                          ;; rfc2088
                          (progn
                            (setq cmdstr (concat cmdstr
-                                                (format "{%d+}" (nth 2 token))))
+                                                (format "{%d+}" (nth 2 token))
+                                                "\r\n"))
                            (process-send-string process cmdstr)
-                           (process-send-string process "\r\n")
                            (setq cmdstr nil))
                        (setq cmdstr (concat cmdstr
-                                            (format "{%d}" (nth 2 token))))
+                                            (format "{%d}" (nth 2 token))
+                                            "\r\n"))
                        (process-send-string process cmdstr)
-                       (process-send-string process "\r\n")
                        (setq cmdstr nil)
                        (elmo-imap4-accept-continue-req session))
                      (cond ((stringp (nth 1 token))
@@ -356,9 +356,7 @@ Returns a TAG string which is assigned to the COMMAND."
              (t
               (error "Invalid argument")))
        (setq command-args (cdr command-args)))
-      (if cmdstr
-         (process-send-string process cmdstr))
-      (process-send-string process "\r\n")
+      (process-send-string process (concat cmdstr "\r\n"))
       tag)))
 
 (defun elmo-imap4-send-string (session string)
@@ -823,16 +821,7 @@ FLAG is one of the `unread', `read', `important', `answered', `any'."
   (let ((session (elmo-imap4-get-session folder))
        (criteria (elmo-imap4-flag-to-imap-criteria flag)))
     (if (elmo-imap4-session-flag-available-p session flag)
-       (progn
-         (elmo-imap4-session-select-mailbox
-          session
-          (elmo-imap4-folder-mailbox-internal folder))
-         (elmo-imap4-response-value
-          (elmo-imap4-send-command-wait
-           session
-           (format (if elmo-imap4-use-uid "uid search %s"
-                     "search %s") criteria))
-          'search))
+       (elmo-imap4-list folder criteria)
       ;; List flagged messages in the msgdb.
       (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) flag))))
 
@@ -1604,22 +1593,23 @@ Return nil if no complete line has arrived."
        (setq status
              (cons
               (let ((token (read (current-buffer))))
-                (cond ((eq token 'MESSAGES)
-                       (list 'messages (read (current-buffer))))
-                      ((eq token 'RECENT)
-                       (list 'recent (read (current-buffer))))
-                      ((eq token 'UIDNEXT)
-                       (list 'uidnext (read (current-buffer))))
-                      ((eq token 'UIDVALIDITY)
-                       (and (looking-at " \\([0-9]+\\)")
-                            (prog1 (list 'uidvalidity (match-string 1))
-                              (goto-char (match-end 1)))))
-                      ((eq token 'UNSEEN)
-                       (list 'unseen (read (current-buffer))))
-                      (t
-                       (message
-                        "Unknown status data %s in mailbox %s ignored"
-                        token mailbox))))
+                (case (intern (upcase (symbol-name token)))
+                  (MESSAGES
+                   (list 'messages (read (current-buffer))))
+                  (RECENT
+                   (list 'recent (read (current-buffer))))
+                  (UIDNEXT
+                   (list 'uidnext (read (current-buffer))))
+                  (UIDVALIDITY
+                   (and (looking-at " \\([0-9]+\\)")
+                        (prog1 (list 'uidvalidity (match-string 1))
+                          (goto-char (match-end 1)))))
+                  (UNSEEN
+                   (list 'unseen (read (current-buffer))))
+                  (t 
+                   (message
+                    "Unknown status data %s in mailbox %s ignored"
+                    token mailbox))))
               status))
        (skip-chars-forward " ")))
     (and elmo-imap4-status-callback