* [PATCH 0/6] lei: more steps towards kw sync
@ 2021-05-02 6:05 5% Eric Wong
2021-05-02 6:05 7% ` [PATCH 5/6] net_writer: use "FLAGS.SILENT" to set keywords Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-05-02 6:05 UTC (permalink / raw)
To: meta
6/6 is a fairly significant change, but I think it's
worth doing by default to make things less surprising
for eventual users of "lei export-kw" (I'm not sure if
that's even a good name).
Eric Wong (6):
lei <q|up>: combine written/results into one line
lei_input: common net_merge_all_done for lei <import|tag>
lei_input: reject --mail-sync if using HTTP(S) for now
lei: simplify workers_start API
net_writer: use "FLAGS.SILENT" to set keywords
lei <q|up>: writes to Maildirs and IMAP use mail-sync
lib/PublicInbox/LEI.pm | 5 +++--
lib/PublicInbox/LeiBlob.pm | 2 +-
lib/PublicInbox/LeiConvert.pm | 2 +-
lib/PublicInbox/LeiImport.pm | 9 ++-------
lib/PublicInbox/LeiInput.pm | 9 +++++++++
lib/PublicInbox/LeiLsSearch.pm | 2 +-
lib/PublicInbox/LeiMirror.pm | 2 +-
lib/PublicInbox/LeiP2q.pm | 2 +-
lib/PublicInbox/LeiQuery.pm | 7 +++----
lib/PublicInbox/LeiStore.pm | 8 ++++----
lib/PublicInbox/LeiTag.pm | 9 ++-------
lib/PublicInbox/LeiToMail.pm | 24 +++++++++++++++++-------
lib/PublicInbox/LeiXSearch.pm | 9 +++++----
lib/PublicInbox/NetWriter.pm | 14 ++++++--------
t/lei-import-http.t | 5 +++++
xt/net_writer-imap.t | 9 +++++++--
16 files changed, 68 insertions(+), 50 deletions(-)
^ permalink raw reply [relevance 5%]
* [PATCH 5/6] net_writer: use "FLAGS.SILENT" to set keywords
2021-05-02 6:05 5% [PATCH 0/6] lei: more steps towards kw sync Eric Wong
@ 2021-05-02 6:05 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-05-02 6:05 UTC (permalink / raw)
To: meta
Instead of "+FLAGS.SILENT" which merely adds to the keywords.
We store all keywords together, so it's unlikely we will rely
on the "+FLAGS.SILENT" or "-FLAGS.SILENT".
---
lib/PublicInbox/NetWriter.pm | 14 ++++++--------
xt/net_writer-imap.t | 9 +++++++--
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/NetWriter.pm b/lib/PublicInbox/NetWriter.pm
index 49ac02a6..06d69f27 100644
--- a/lib/PublicInbox/NetWriter.pm
+++ b/lib/PublicInbox/NetWriter.pm
@@ -53,17 +53,15 @@ sub imap_delete_1 {
$$delete_mic->delete_message($uid);
}
-sub imap_set_kw {
- my ($self, $url, $uid, $kw) = @_;
- my $mic = mic_for_folder($self, my $uri = $url) or return;
- $mic->set_flag(kw2flags($kw), $uid);
+sub imap_add_kw {
+ my ($self, $mic, $uid, $kw) = @_;
+ $mic->store($uid, '+FLAGS.SILENT', '('.kw2flags($kw).')');
$mic; # caller must ->expunge
}
-sub imap_unset_kw {
- my ($self, $url, $uid, $kw) = @_;
- my $mic = mic_for_folder($self, my $uri = $url) or return;
- $mic->unset_flag(kw2flags($kw), $uid);
+sub imap_set_kw {
+ my ($self, $mic, $uid, $kw) = @_;
+ $mic->store($uid, 'FLAGS.SILENT', '('.kw2flags($kw).')');
$mic; # caller must ->expunge
}
diff --git a/xt/net_writer-imap.t b/xt/net_writer-imap.t
index 007de35e..1298b958 100644
--- a/xt/net_writer-imap.t
+++ b/xt/net_writer-imap.t
@@ -157,8 +157,13 @@ test_lei(sub {
lei_ok qw(import -F eml), $f, \'import local copy w/o keywords';
- $nwr->imap_set_kw($folder_uri, $uid[0], [ 'seen' ])->expunge
- or BAIL_OUT "expunge $@";
+ $mic = $nwr->mic_for_folder($folder_uri);
+ # dummy set to ensure second set_kw clobbers
+ $nwr->imap_set_kw($mic, $uid[0], [ qw(seen answered flagged) ]
+ )->expunge or BAIL_OUT "expunge $@";
+ $nwr->imap_set_kw($mic, $uid[0], [ 'seen' ]
+ )->expunge or BAIL_OUT "expunge $@";
+ $mic = undef;
@res = ();
$nwr->imap_each($folder_uri, $imap_slurp_all, \@res);
is_deeply(\@res, [ [ ['seen'], $exp ] ], 'seen flag set') or
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-05-02 6:05 5% [PATCH 0/6] lei: more steps towards kw sync Eric Wong
2021-05-02 6:05 7% ` [PATCH 5/6] net_writer: use "FLAGS.SILENT" to set keywords Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.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).