Gnus development mailing list
 help / color / mirror / Atom feed
From: Leonidas Tsampros <ltsampros@upnet.gr>
To: ding@gnus.org
Subject: Re: [PATCH] gmail and X-GM-EXT1 extensions
Date: Thu, 18 Jul 2013 07:11:10 +0300	[thread overview]
Message-ID: <87mwpkbj8h.fsf@kepler.lan> (raw)
In-Reply-To: <m238sqeaz3.fsf@lifelogs.com> (Ted Zlatanov's message of "Mon, 10 Jun 2013 02:28:00 -0400")

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

Ted Zlatanov <tzz@lifelogs.com> writes:
> On Mon, 10 Jun 2013 08:46:26 +0300 Leonidas Tsampros <ltsampros@upnet.gr> wrote: 
>
> LT> Ted Zlatanov <tzz@lifelogs.com> writes:
>>> On Sun, 09 Jun 2013 21:53:49 +0300 Leonidas Tsampros <ltsampros@upnet.gr> wrote: 
>
> LT> Do we need point 4 (INTERNALDATE of APPENDed messages) to be an optional
> LT> behaviour as well?
>>> 
>>> Erm.... yes? :)  Can you fit it into the nnimap-ext style I suggested?
>
> LT> I'll do that, but technically it's not an extension.
>
> OK, don't do it then.  I am really OK either way as long as it works for you.
>
> LT> Is there really a use case were we don't want the INTERNALDATE to be set
> LT> during APPEND?
>
> I don't think so.  I thought you might, since you asked.
>
> Ted

Attached a new version as discussed last time.

Recap:
- new server option nnimap-ext. Current offering is x-gm-ext-1. When
`x-gm-ext-1' is enabled, the \\Inbox gmail label is removed from fancy
splitted mail.

- we now set the INTERNALDATE of messages when doing APPEND (fixes the
  incorrect date's in gmail web ui when importing mail in gmail).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnimap-patch --]
[-- Type: text/x-patch, Size: 1865 bytes --]

=== modified file 'lisp/gnus/nnimap.el'
--- lisp/gnus/nnimap.el	2013-01-01 09:11:05 +0000
+++ lisp/gnus/nnimap.el	2013-07-18 03:18:12 +0000
@@ -66,6 +66,11 @@
 If nnimap-stream is `ssl', this will default to `imaps'.  If not,
 it will default to `imap'.")
 
+(defvoo nnimap-ext nil
+  "Defines which extensions are supported by the
+  server. Currently `x-gm-ext-1' is offered for gmail imap
+  server.  Defaults to nil.")
+
 (defvoo nnimap-stream 'undecided
   "How nnimap talks to the IMAP server.
 The value should be either `undecided', `ssl' or `tls',
@@ -1060,6 +1065,7 @@
   (when (nnimap-possibly-change-group nil server)
     (nnmail-check-syntax)
     (let ((message-id (message-field-value "message-id"))
+	  (dt (message-field-value "date"))
 	  sequence message)
       (nnimap-add-cr)
       (setq message (buffer-substring-no-properties (point-min) (point-max)))
@@ -1072,7 +1078,8 @@
 	    (nnimap-unselect-group))
 	  (erase-buffer)
 	  (setq sequence (nnimap-send-command
-			  "APPEND %S {%d}" (utf7-encode group t)
+			  "APPEND %S %S {%d}" (utf7-encode group t)
+			  (nnimap-rfc822-date-to-imap4date dt)
 			  (length message)))
 	  (unless nnimap-streaming
 	    (nnimap-wait-for-connection "^[+]"))
@@ -1907,6 +1914,8 @@
 	(nnimap-fetch-inbox new-articles)
 	(nnimap-transform-split-mail)
 	(nnheader-ms-strip-cr)
+	(when (eq nnimap-ext 'x-gm-ext-1)
+	  (nnimap-wait-for-response (nnimap-send-command "UID STORE %s -X-GM-LABELS (\\Inbox)" (nnimap-article-ranges new-articles))))
 	(nnmail-cache-open)
 	(nnmail-split-incoming (current-buffer)
 			       #'nnimap-save-mail-spec
@@ -2044,6 +2053,8 @@
 		   "(OR (OR HEADER Message-Id %S HEADER REFERENCES %S) %s)"
 		   refid refid value)))))
 
+(defun nnimap-rfc822-date-to-imap4date (datetime)
+  (format-time-string "%d-%b-%Y %H:%M:%S %z" (date-to-time datetime)))
 
 (provide 'nnimap)
 


  reply	other threads:[~2013-07-18  4:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-20  9:35 Leonidas Tsampros
2013-04-21 23:06 ` [PATCH] " Leonidas Tsampros
2013-06-06 15:09   ` Ted Zlatanov
2013-06-09 18:53     ` Leonidas Tsampros
2013-06-10  3:30       ` Ted Zlatanov
2013-06-10  5:46         ` Leonidas Tsampros
2013-06-10  6:28           ` Ted Zlatanov
2013-07-18  4:11             ` Leonidas Tsampros [this message]
2013-08-01 15:27               ` Lars Magne Ingebrigtsen
2013-08-01 16:22                 ` Leonidas Tsampros
2013-08-01 16:35                   ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwpkbj8h.fsf@kepler.lan \
    --to=ltsampros@upnet.gr \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).