srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/internal/ipc/ipc.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ipc/ipc.go')
-rw-r--r--internal/ipc/ipc.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/internal/ipc/ipc.go b/internal/ipc/ipc.go
index d295238..7d81473 100644
--- a/internal/ipc/ipc.go
+++ b/internal/ipc/ipc.go
@@ -44,11 +44,14 @@ type Request struct {
Rule *rules.Rule `json:"rule,omitempty"`
RuleID int64 `json:"rule_id,omitempty"`
RuleEnabled bool `json:"rule_enabled,omitempty"`
+
+ // For "set_flagged": ID identifies the history entry.
+ Flagged bool `json:"flagged,omitempty"`
}
// Response is sent by the daemon to a client.
type Response struct {
- Type string `json:"type"` // "list", "get", "new", "repeat", "rules", "intrude_result", "intrude_done", "status", or "error"
+ Type string `json:"type"` // "list", "get", "new", "repeat", "rules", "intrude_result", "intrude_done", "status", "flagged", or "error"
Entries []store.Summary `json:"entries,omitempty"` // for "list"
Detail *EntryDetail `json:"detail,omitempty"` // for "get" and "repeat"
New *store.Summary `json:"new,omitempty"` // for "new" (subscribe push)
@@ -117,6 +120,25 @@ func (c *Client) Close() error {
return c.conn.Close()
}
+// SetFlagged sets the flagged marker on a history entry - a simple
+// "mark this, revisit later" bit, filterable via flagged:true/false in
+// Search.
+func (c *Client) SetFlagged(id int64, flagged bool) error {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+ if err := c.enc.Encode(Request{Type: "set_flagged", ID: id, Flagged: flagged}); err != nil {
+ return err
+ }
+ var resp Response
+ if err := c.dec.Decode(&resp); err != nil {
+ return err
+ }
+ if resp.Type == "error" {
+ return errors.New(resp.Error)
+ }
+ return nil
+}
+
// Status returns basic daemon info for a status bar.
func (c *Client) Status() (*StatusMsg, error) {
c.mu.Lock()