From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83537 Path: news.gmane.org!not-for-mail From: Leonidas Tsampros Newsgroups: gmane.emacs.gnus.general Subject: Re: [PATCH] gmail and X-GM-EXT1 extensions Date: Thu, 18 Jul 2013 07:11:10 +0300 Message-ID: <87mwpkbj8h.fsf@kepler.lan> References: <874nf1k0je.fsf@kepler.lan> <87ip3ffpqs.fsf@kepler.lan> <87wqq7tgvy.fsf@lifelogs.com> <87zjuzw1xe.fsf@kepler.lan> <87obbewma5.fsf@kepler.lan> Reply-To: ltsampros@upnet.gr NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1374120746 13877 80.91.229.3 (18 Jul 2013 04:12:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Jul 2013 04:12:26 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M31795@lists.math.uh.edu Thu Jul 18 06:12:26 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UzfZo-0004ti-2i for ding-account@gmane.org; Thu, 18 Jul 2013 06:12:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1UzfYt-0008Iw-62; Wed, 17 Jul 2013 23:11:27 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1UzfYr-0008Ij-BN for ding@lists.math.uh.edu; Wed, 17 Jul 2013 23:11:25 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1UzfYp-0003ME-2Q for ding@lists.math.uh.edu; Wed, 17 Jul 2013 23:11:24 -0500 Original-Received: from mail-ea0-f175.google.com ([209.85.215.175]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1UzfYn-0003km-6Q for ding@gnus.org; Thu, 18 Jul 2013 06:11:21 +0200 Original-Received: by mail-ea0-f175.google.com with SMTP id z7so1415594eaf.6 for ; Wed, 17 Jul 2013 21:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:in-reply-to:references:user-agent:reply-to :date:message-id:mime-version:content-type; bh=0XIzThHgiQKsEtCrfb7j1wwWI5WfpVtkQhhoc07+BKc=; b=AsTxXeKrEFmTJqf7pj0fOQ/NfX9/s0e++yvGBXytrOvGipCSaCiixj2axyW61doDiS jz4HoNEPuHT3KQX9ur19wVpe8UZoS9Q9DHp5K8UY14Pha6yRox9+Jx8EDX+KkruZDBdS Twf+p77/7wbHDNOE6sw7ggf1H76ZpJhNFJ9hrxNLpcezj7t9yEo3x7ztXok2jARFzaa2 1Z+zr+taUq4Sp71AnlBre5FxxDcJkY1ANJI2PAt5MHLkSuVk8ofJ05Ons1f9H9qIbZPZ 5eqHs2aN+7Hd9+lMW8cXV28AalD9Gv9N/1esctYHP2UL4A/voadNHKPvp/3WYO6CKNhR DsGw== X-Received: by 10.14.4.70 with SMTP id 46mr9033378eei.42.1374120675730; Wed, 17 Jul 2013 21:11:15 -0700 (PDT) Original-Received: from kepler.lan (178.128.69.130.dsl.dyn.forthnet.gr. [178.128.69.130]) by mx.google.com with ESMTPSA id m1sm15780777eex.17.2013.07.17.21.11.11 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 17 Jul 2013 21:11:14 -0700 (PDT) In-Reply-To: (Ted Zlatanov's message of "Mon, 10 Jun 2013 02:28:00 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Spam-Score: -2.9 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83537 Archived-At: --=-=-= Content-Type: text/plain Ted Zlatanov writes: > On Mon, 10 Jun 2013 08:46:26 +0300 Leonidas Tsampros wrote: > > LT> Ted Zlatanov writes: >>> On Sun, 09 Jun 2013 21:53:49 +0300 Leonidas Tsampros 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). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=nnimap-patch === 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) --=-=-=--