use user and diff filters

This commit is contained in:
Alexander Bondarenko
2024-05-14 16:56:28 +03:00
parent 17bcdaf6c4
commit 4f2102ac6e
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ constraints: zip +disable-bzip2 +disable-zstd
source-repository-package
type: git
location: https://github.com/simplex-chat/simplexmq.git
tag: 2f7f3dd9a3313d9d5ef2c20a476ecb8b6ffd6ada
tag: 0ebaa833dcb4c24ea7c409c14c3831999be150c7
source-repository-package
type: git
+1 -1
View File
@@ -1,5 +1,5 @@
{
"https://github.com/simplex-chat/simplexmq.git"."2f7f3dd9a3313d9d5ef2c20a476ecb8b6ffd6ada" = "0175l9l06xvk4fd5zjkj63ljjf7jpgbx9mvzls1bx2rbl55wlbcg";
"https://github.com/simplex-chat/simplexmq.git"."0ebaa833dcb4c24ea7c409c14c3831999be150c7" = "0yl0zfmlwwynjsq7cj9l5gici7l398ilvi96wxgf5i3h5b8sygq3";
"https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38";
"https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d";
"https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl";
+2 -2
View File
@@ -2227,7 +2227,7 @@ processChatCommand' vr = \case
counts <- map (first decodeLatin1) <$> withAgent' getMsgCounts
let allMsgs = foldl' (\(ts, ds) (_, (t, d)) -> (ts + t, ds + d)) (0, 0) counts
pure CRAgentMsgCounts {msgCounts = ("all", allMsgs) : sortOn (Down . snd) (filter (\(_, (_, d)) -> d /= 0) counts)}
GetAgentSubs -> lift $ CRAgentSubs <$> withAgent' getAgentSubscriptions
GetAgentSubs diff -> withUser $ \User {userId} -> lift $ CRAgentSubs <$> withAgent' (\a -> getAgentSubscriptions a diff (Just userId))
-- CustomChatCommand is unsupported, it can be processed in preCmdHook
-- in a modified CLI app or core - the hook should return Either ChatResponse ChatCommand
CustomChatCommand _cmd -> withUser $ \user -> pure $ chatCmdError (Just user) "not supported"
@@ -7348,7 +7348,7 @@ chatCommandP =
"/debug event " *> (DebugEvent <$> jsonP),
"/get stats" $> GetAgentStats,
"/reset stats" $> ResetAgentStats,
"/get subs" $> GetAgentSubs,
"/get subs" *> (GetAgentSubs <$> (" diff" $> True <|> pure False)),
"/get workers" $> GetAgentWorkers,
"/get workers details" $> GetAgentWorkersDetails,
"/get msgs" $> GetAgentMsgCounts,
+1 -1
View File
@@ -497,7 +497,7 @@ data ChatCommand
| DebugEvent ChatResponse
| GetAgentStats
| ResetAgentStats
| GetAgentSubs
| GetAgentSubs {diffOnly :: Bool}
| GetAgentWorkers
| GetAgentWorkersDetails
| GetAgentMsgCounts