From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83087 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: Mon, 22 Apr 2013 02:06:19 +0300 Message-ID: <87ip3ffpqs.fsf@kepler.lan> References: <874nf1k0je.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 1366585670 3874 80.91.229.3 (21 Apr 2013 23:07:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Apr 2013 23:07:50 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M31353@lists.math.uh.edu Mon Apr 22 01:07:54 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 1UU3MP-0000Gt-OM for ding-account@gmane.org; Mon, 22 Apr 2013 01:07:54 +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 1UU3Ks-00019J-Ok; Sun, 21 Apr 2013 18:06:18 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1UU3Kq-000194-Sb for ding@lists.math.uh.edu; Sun, 21 Apr 2013 18:06:16 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1UU3Kl-0005N2-3S for ding@lists.math.uh.edu; Sun, 21 Apr 2013 18:06:16 -0500 Original-Received: from mail-we0-f174.google.com ([74.125.82.174]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1UU3Kj-0001yx-Le for ding@gnus.org; Mon, 22 Apr 2013 01:06:09 +0200 Original-Received: by mail-we0-f174.google.com with SMTP id u12so5545853wey.33 for ; Sun, 21 Apr 2013 16:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:subject:references:reply-to:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=0AHXdq2fk2dgDUUBU8a/k90NJvQdHbxfRhVYrI3YT6Y=; b=DnVr4Qcn6FjHuPaHbnSXt8CUqq36aaYLZ4oP830Eyp8Uge2L6gqIuGKYRl++AiD198 hCUgMbDrbW3w2h3+l5P7wUAvenyFeuUBG3mAGjy4TF61NKKa1u6ndwFFuVVtwV8ZyGYw ld/zz1c7bgwKWa72oirbuVBU47Tp9Y0XIxJIVc8+g2pmc3xX6zfm26h4LprYDcL6WnZT rWrrwHkEXiK7qfcTk2T/ZKMgTP/pYN05NWthxCVz3ROupHkSYUC6gZ3dHiQ6heT+iocQ pLGkeoJJl2MhoiXXbimKgZNBSpO/aIsx6CuAAaCr6qUZdP1cMZXuihJRX3bmZZ+EQsqh eBnA== X-Received: by 10.180.20.108 with SMTP id m12mr56476635wie.8.1366585564129; Sun, 21 Apr 2013 16:06:04 -0700 (PDT) Original-Received: from kepler.lan (178.128.144.244.dsl.dyn.forthnet.gr. [178.128.144.244]) by mx.google.com with ESMTPS id s47sm37206173eeg.8.2013.04.21.16.06.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 21 Apr 2013 16:06:03 -0700 (PDT) In-Reply-To: <874nf1k0je.fsf@kepler.lan> (Leonidas Tsampros's message of "Sat, 20 Apr 2013 12:35:01 +0300") 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:83087 Archived-At: --=-=-= Content-Type: text/plain Leonidas Tsampros writes: > Hello, > > long time no see :) > > TLDR: My Gmail inbox is full even after splitting mail. Here is why. > That was easier than I thought. Please take a look at the patch attached and send me your comments. The changes can be described as such: 1. Add nnimap server user defined variable that defines whether the server supports x-gm-ext-1 extension. Ideally this should come from CAPABILITY string, but I wanted an explicit user knob for that. 2. Add nnimap-rfc822-date-to-imap4date that takes an rfc822 date value and returns an imap4 datetime string (took the format from rfc3501). 3. Improve nnmail-split-incoming-mail so that if nnimap-x-gm-ext-1 is defined for the current server, remove that fraking \\Inbox label from the to be splitted mail. (Should this behaviour be configurable?) 4. Improve nnimap-request-accept-article so that it sets the INTERNALDATE of the APPENDed message to the value of the message's date header. (that's what I needed 2.) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=nnimap-patch Content-Description: nnimap x-gm-ext-1 improvement === modified file 'lisp/gnus/nnimap.el' --- lisp/gnus/nnimap.el 2013-01-01 09:11:05 +0000 +++ lisp/gnus/nnimap.el 2013-04-21 23:04:35 +0000 @@ -66,6 +66,10 @@ If nnimap-stream is `ssl', this will default to `imaps'. If not, it will default to `imap'.") +(defvoo nnimap-x-gm-ext-1 nil + "Defines whether this server supports the Gmail extensions + X-GM-EXT-1. 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 +1064,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 +1077,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 +1913,8 @@ (nnimap-fetch-inbox new-articles) (nnimap-transform-split-mail) (nnheader-ms-strip-cr) + (when nnimap-x-gm1-ext + (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 +2052,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) --=-=-=--