summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/format/format.go35
-rw-r--r--lib/msgstore.go73
2 files changed, 107 insertions, 1 deletions
diff --git a/lib/format/format.go b/lib/format/format.go
index 30e8be7..96a19b9 100644
--- a/lib/format/format.go
+++ b/lib/format/format.go
@@ -297,6 +297,15 @@ func ParseMessageFormat(format string, timeFmt string, ctx Ctx) (string,
seen := false
recent := false
answered := false
+ // NOTE(shivesh): my custom flags
+ var importantFlag = ""
+ var listFlag = ""
+ var foodFlag = ""
+ var personalFlag = ""
+ var workFlag = ""
+ var physicsFlag = ""
+ var todoFlag = ""
+ var laterFlag = ""
for _, flag := range ctx.MsgInfo.Flags {
if flag == models.SeenFlag {
seen = true
@@ -305,6 +314,30 @@ func ParseMessageFormat(format string, timeFmt string, ctx Ctx) (string,
} else if flag == models.AnsweredFlag {
answered = true
}
+ if flag == models.ImportantFlag {
+ importantFlag = "I"
+ }
+ if flag == models.ListFlag {
+ listFlag = "l"
+ }
+ if flag == models.FoodFlag {
+ foodFlag = "F"
+ }
+ if flag == models.PersonalFlag {
+ personalFlag = "P"
+ }
+ if flag == models.WorkFlag {
+ workFlag = "W"
+ }
+ if flag == models.PhysicsFlag {
+ physicsFlag = "X"
+ }
+ if flag == models.TodoFlag {
+ todoFlag = "T"
+ }
+ if flag == models.LaterFlag {
+ laterFlag = "L"
+ }
if flag == models.DeletedFlag {
delFlag = "D"
// TODO: check if attachments
@@ -329,7 +362,7 @@ func ParseMessageFormat(format string, timeFmt string, ctx Ctx) (string,
markedFlag = "*"
}
retval = append(retval, '4', 's')
- args = append(args, readReplyFlag+delFlag+flaggedFlag+markedFlag)
+ args = append(args, readReplyFlag+delFlag+flaggedFlag+markedFlag+importantFlag+listFlag+foodFlag+personalFlag+workFlag+physicsFlag+todoFlag+laterFlag)
// Move the below cases to proper alphabetical positions once
// implemented
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 7af9fd2..222c9fc 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -361,6 +361,79 @@ func (store *MessageStore) Answered(uids []uint32, answered bool,
}, cb)
}
+// NOTE(shivesh): my custom flags
+func (store *MessageStore) Important(uids []uint32, important bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.ImportantMessages{
+ Important: important,
+ Uids: uids,
+ }, cb)
+}
+
+func (store *MessageStore) List(uids []uint32, list bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.ListMessages{
+ List: list,
+ Uids: uids,
+ }, cb)
+}
+
+func (store *MessageStore) Food(uids []uint32, food bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.FoodMessages{
+ Food: food,
+ Uids: uids,
+ }, cb)
+}
+
+func (store *MessageStore) Personal(uids []uint32, personal bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.PersonalMessages{
+ Personal: personal,
+ Uids: uids,
+ }, cb)
+}
+
+func (store *MessageStore) Work(uids []uint32, work bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.WorkMessages{
+ Work: work,
+ Uids: uids,
+ }, cb)
+}
+
+func (store *MessageStore) Physics(uids []uint32, physics bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.PhysicsMessages{
+ Physics: physics,
+ Uids: uids,
+ }, cb)
+}
+
+func (store *MessageStore) Todo(uids []uint32, todo bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.TodoMessages{
+ Todo: todo,
+ Uids: uids,
+ }, cb)
+}
+
+func (store *MessageStore) Later(uids []uint32, later bool,
+ cb func(msg types.WorkerMessage)) {
+
+ store.worker.PostAction(&types.LaterMessages{
+ Later: later,
+ Uids: uids,
+ }, cb)
+}
+
func (store *MessageStore) Uids() []uint32 {
if store.filter {
return store.results