From 669cabc5d0a61f53d23ab503b71509bb9789e088 Mon Sep 17 00:00:00 2001 From: nick evans Date: Tue, 12 Nov 2024 13:22:30 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9A=20Fix=20broken=20example=20in?= =?UTF-8?q?=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `IMAP#list` returns an empty array (rather than `nil`), since v0.4.0. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42610b3b..1afc9ff0 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ end ```ruby imap.select('Mail/sent-mail') -if not imap.list('Mail/', 'sent-apr03') +if imap.list('Mail/', 'sent-apr03').empty? imap.create('Mail/sent-apr03') end imap.search(["BEFORE", "30-Apr-2003", "SINCE", "1-Apr-2003"]).each do |message_id| From 8916a4931ce1a40a6b6f2c1339c13445db0ab694 Mon Sep 17 00:00:00 2001 From: nick evans Date: Tue, 12 Nov 2024 13:38:36 -0500 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9A=20Update=20README=20example=20?= =?UTF-8?q?to=20use=20MOVE=20extension?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1afc9ff0..3a5982b5 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,12 @@ if imap.list('Mail/', 'sent-apr03').empty? imap.create('Mail/sent-apr03') end imap.search(["BEFORE", "30-Apr-2003", "SINCE", "1-Apr-2003"]).each do |message_id| - imap.copy(message_id, "Mail/sent-apr03") - imap.store(message_id, "+FLAGS", [:Deleted]) + if imap.capable?(:move) || imap.capable?(:IMAP4rev2) + imap.move(message_id, "Mail/sent-apr03") + else + imap.copy(message_id, "Mail/sent-apr03") + imap.store(message_id, "+FLAGS", [:Deleted]) + end end imap.expunge ```