aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-12-27 16:34:27 +0000
committerdakkar <dakkar@thenautilus.net>2016-12-27 16:34:27 +0000
commitc6ffe49bff0a41046d4dd64d1f293f925b0f37e1 (patch)
tree54dc94688787f810d921ddd0df0188797d492909 /lib
parentlist & show moderation queue contents (diff)
downloadSietima-c6ffe49bff0a41046d4dd64d1f293f925b0f37e1.tar.gz
Sietima-c6ffe49bff0a41046d4dd64d1f293f925b0f37e1.tar.bz2
Sietima-c6ffe49bff0a41046d4dd64d1f293f925b0f37e1.zip
mailstore: retrieve_ids_by_tags
Diffstat (limited to 'lib')
-rw-r--r--lib/Sietima/MailStore.pm2
-rw-r--r--lib/Sietima/MailStore/FS.pm12
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/Sietima/MailStore.pm b/lib/Sietima/MailStore.pm
index d26d475..009580d 100644
--- a/lib/Sietima/MailStore.pm
+++ b/lib/Sietima/MailStore.pm
@@ -2,6 +2,6 @@ package Sietima::MailStore;
use Moo::Role;
use Sietima::Policy;
-requires 'store','retrieve_by_tags','retrieve_by_id','remove','clear';
+requires 'store','retrieve_ids_by_tags','retrieve_by_tags','retrieve_by_id','remove','clear';
1;
diff --git a/lib/Sietima/MailStore/FS.pm b/lib/Sietima/MailStore/FS.pm
index a45b433..6f872c1 100644
--- a/lib/Sietima/MailStore/FS.pm
+++ b/lib/Sietima/MailStore/FS.pm
@@ -58,7 +58,7 @@ sub _tagged_by($self,$tag) {
return $tag_file->lines({chomp=>1});
}
-sub retrieve_by_tags($self,@tags) {
+sub retrieve_ids_by_tags($self,@tags) {
state $check = compile(Object,slurpy ArrayRef[Str]);$check->(@_);
my %msgs;
@@ -74,6 +74,16 @@ sub retrieve_by_tags($self,@tags) {
my @ret;
for my $id (keys %msgs) {
next unless $msgs{$id} == @tags;
+ push @ret, $id;
+ }
+ return \@ret;
+}
+
+sub retrieve_by_tags($self,@tags) {
+ state $check = compile(Object,slurpy ArrayRef[Str]);$check->(@_);
+
+ my @ret;
+ for my $id ($self->retrieve_ids_by_tags(@tags)->@*) {
push @ret, {
id => $id,
mail => $self->retrieve_by_id($id),