about summary refs log tree commit diff stats
path: root/worker/imap
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-24 16:29:13 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-24 16:29:25 -0400
commit0e9c411751c752eeef4e2132f778308689001388 (patch)
treefe9fe8059873f1399f4e732078772534b59a13fd /worker/imap
parentb15d1e52b3fc53d2b0336168b29ccb14722eac69 (diff)
downloadaerc-0e9c411751c752eeef4e2132f778308689001388.tar.gz
worker/imap: implement search
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/list.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index a61ea06..b9578ab 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -60,3 +60,19 @@ func canOpen(mbox *imap.MailboxInfo) bool {
 	}
 	return true
 }
+
+func (imapw *IMAPWorker) handleSearchDirectory(msg *types.SearchDirectory) {
+	imapw.worker.Logger.Println("Executing search")
+
+	if uids, err := imapw.client.UidSearch(msg.Criteria); err != nil {
+		imapw.worker.PostMessage(&types.Error{
+			Message: types.RespondTo(msg),
+			Error:   err,
+		}, nil)
+	} else {
+		imapw.worker.PostMessage(&types.SearchResults{
+			Message: types.RespondTo(msg),
+			Uids:    uids,
+		}, nil)
+	}
+}
'alt'>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102