* [PATCH] RFC4731 for lisp/net/imap.el
@ 2008-08-14 9:10 Vitaly Mayatskikh
2008-10-29 13:10 ` Simon Josefsson
0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Mayatskikh @ 2008-08-14 9:10 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
Hi!
I've added support for "IMAP4 Extension to SEARCH Command for Controlling
What Kind of Information Is Returned". It allows Gnus to uses some nice
features like very fast searching of minuid/maxuid or retrieving results
for SEARCH command in sequence-set. Also patch automatically routes query
from imap-search routine to the new imap-esearch when possible, as it
significantly reduces amount of consumed traffic.
Patch was tested with Zimbra server and it works well so far.
[-- Attachment #2: support for rfc4731 --]
[-- Type: text/plain, Size: 2628 bytes --]
diff -puw lisp/net/imap.el.orig lisp/net/imap.el
--- lisp/net/imap.el.orig 2008-05-06 09:31:46.000000000 +0200
+++ lisp/net/imap.el 2008-08-14 10:40:31.000000000 +0200
@@ -1721,6 +1721,8 @@ is non-nil return these properties."
(imap-message-get ,uid 'BODY)))
(defun imap-search (predicate &optional buffer)
+ (if (imap-capability 'ESEARCH)
+ (car (imap-esearch (concat "UID SEARCH RETURN (ALL) " predicate) '(ALL)))
(with-current-buffer (or buffer (current-buffer))
(imap-mailbox-put 'search 'dummy)
(when (imap-ok-p (imap-send-command-wait (concat "UID SEARCH " predicate)))
@@ -1728,7 +1730,39 @@ is non-nil return these properties."
(progn
(message "Missing SEARCH response to a SEARCH command (server not RFC compliant)...")
nil)
- (imap-mailbox-get-1 'search imap-current-mailbox)))))
+ (imap-mailbox-get-1 'search imap-current-mailbox))))))
+
+(defun imap-esearch (query tags &optional buffer)
+ (with-current-buffer (or buffer (current-buffer))
+ (imap-mailbox-put 'esearch 'dummy)
+ (when (imap-ok-p (imap-send-command-wait query))
+ (if (eq (imap-mailbox-get-1 'esearch imap-current-mailbox) 'dummy)
+ (progn
+ (message "Missing ESEARCH response to a SEARCH command (server not RFC compliant)...")
+ nil)
+ (let ((answer (imap-mailbox-get-1 'esearch imap-current-mailbox))
+ tag result)
+ (while answer
+ (setq tag (intern (upcase (car answer))))
+ (cond ((eq tag 'UID)
+ nil)
+ ((memq tag tags)
+ (setq result
+ (append result
+ (list
+ (if (eq tag 'ALL)
+ (gnus-uncompress-range
+ (mapcar #'(lambda (x)
+ (let ((y (split-string x ":")))
+ (if (null (cdr y))
+ (string-to-number (car y))
+ (cons (string-to-number (car y))
+ (string-to-number (cadr y))))))
+ (split-string (cadr answer) "\,")))
+ (string-to-number (cadr answer)))))))
+ (t nil))
+ (setq answer (cdr answer)))
+ result)))))
(defun imap-message-flag-permanent-p (flag &optional mailbox buffer)
"Return t if FLAG can be permanently (between IMAP sessions) saved on articles, in MAILBOX on server in BUFFER."
@@ -2265,6 +2299,9 @@ Return nil if no complete line has arriv
(SEARCH (imap-mailbox-put
'search
(read (concat "(" (buffer-substring (point) (point-max)) ")"))))
+ (ESEARCH (imap-mailbox-put
+ 'esearch
+ (cddr (split-string (buffer-substring (point) (point-max)) " " "\,"))))
(STATUS (imap-parse-status))
(CAPABILITY (setq imap-capability
(read (concat "(" (upcase (buffer-substring
[-- Attachment #3: Type: text/plain, Size: 25 bytes --]
Thanks!
--
wbr, Vitaly
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] RFC4731 for lisp/net/imap.el
2008-08-14 9:10 [PATCH] RFC4731 for lisp/net/imap.el Vitaly Mayatskikh
@ 2008-10-29 13:10 ` Simon Josefsson
2008-11-01 16:03 ` Vitaly Mayatskikh
0 siblings, 1 reply; 4+ messages in thread
From: Simon Josefsson @ 2008-10-29 13:10 UTC (permalink / raw)
To: Vitaly Mayatskikh; +Cc: emacs-devel
Vitaly Mayatskikh <v.mayatskih@gmail.com> writes:
> Hi!
>
> I've added support for "IMAP4 Extension to SEARCH Command for Controlling
> What Kind of Information Is Returned". It allows Gnus to uses some nice
> features like very fast searching of minuid/maxuid or retrieving results
> for SEARCH command in sequence-set. Also patch automatically routes query
> from imap-search routine to the new imap-esearch when possible, as it
> significantly reduces amount of consumed traffic.
>
> Patch was tested with Zimbra server and it works well so far.
Hi! Thanks for this. Do you have a copyright assignment for Emacs?
I'd like to apply the patch.
/Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] RFC4731 for lisp/net/imap.el
2008-10-29 13:10 ` Simon Josefsson
@ 2008-11-01 16:03 ` Vitaly Mayatskikh
2008-11-03 8:47 ` Simon Josefsson
0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Mayatskikh @ 2008-11-01 16:03 UTC (permalink / raw)
To: Simon Josefsson; +Cc: Vitaly Mayatskikh, emacs-devel
At Wed, 29 Oct 2008 14:10:19 +0100, Simon Josefsson wrote:
> > Patch was tested with Zimbra server and it works well so far.
>
> Hi! Thanks for this. Do you have a copyright assignment for Emacs?
> I'd like to apply the patch.
I haven't assignment yet. Where I can sign (?) it?
--
wbr, Vitaly
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] RFC4731 for lisp/net/imap.el
2008-11-01 16:03 ` Vitaly Mayatskikh
@ 2008-11-03 8:47 ` Simon Josefsson
0 siblings, 0 replies; 4+ messages in thread
From: Simon Josefsson @ 2008-11-03 8:47 UTC (permalink / raw)
To: Vitaly Mayatskikh; +Cc: emacs-devel
Vitaly Mayatskikh <v.mayatskih@gmail.com> writes:
> At Wed, 29 Oct 2008 14:10:19 +0100, Simon Josefsson wrote:
>
>> > Patch was tested with Zimbra server and it works well so far.
>>
>> Hi! Thanks for this. Do you have a copyright assignment for Emacs?
>> I'd like to apply the patch.
>
> I haven't assignment yet. Where I can sign (?) it?
Below is the form. Let me know when you get confirmation from the FSF
that they have received your papers, and then I can install the patch.
/Simon
Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.
Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES
[What is the name of the program or package you're contributing to?]
[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]
[Do you have an employer who might have a basis to claim to own
your changes? Do you attend a school which might make such a claim?]
[For the copyright registration, what country are you a citizen of?]
[What year were you born?]
[Please write your email address here.]
[Please write your postal address here.]
[Which files have you changed so far, and which new files have you written
so far?]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-03 8:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-14 9:10 [PATCH] RFC4731 for lisp/net/imap.el Vitaly Mayatskikh
2008-10-29 13:10 ` Simon Josefsson
2008-11-01 16:03 ` Vitaly Mayatskikh
2008-11-03 8:47 ` Simon Josefsson
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).