commit e42cf9b
default
·
2025-01-19 17:27:59 +0000 UTC
parent 4127ec4
New command 'note_mention'.
1 files changed,
+11,
-3
M
main.c
M
main.c
+11,
-3
1@@ -6,6 +6,7 @@
2 #include "xs_json.h"
3 #include "xs_time.h"
4 #include "xs_openssl.h"
5+#include "xs_match.h"
6
7 #include "snac.h"
8
9@@ -34,6 +35,7 @@ int usage(void)
10 printf("actor {basedir} [{uid}] {url} Requests an actor\n");
11 printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n");
12 printf("note_unlisted {basedir} {uid} {text} [files...] Sends an unlisted note with optional attachments\n");
13+ printf("note_mention {basedir} {uid} {text} [files...] Sends a note only to mentioned accounts\n");
14 printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n");
15 printf("unboost {basedir} {uid} {url} Unboosts a post\n");
16 printf("resetpwd {basedir} {uid} Resets the password of a user\n");
17@@ -620,7 +622,7 @@ int main(int argc, char *argv[])
18 return 0;
19 }
20
21- if (strcmp(cmd, "note") == 0 || strcmp(cmd, "note_unlisted") == 0) { /** **/
22+ if (xs_match(cmd, "note|note_unlisted|note_mention")) { /** **/
23 xs *content = NULL;
24 xs *msg = NULL;
25 xs *c_msg = NULL;
26@@ -684,8 +686,14 @@ int main(int argc, char *argv[])
27 else
28 content = xs_dup(url);
29
30- msg = msg_note(&snac, content, NULL, NULL, attl,
31- strcmp(cmd, "note_unlisted") == 0 ? 2 : 0, getenv("LANG"));
32+ int scope = 0;
33+ if (strcmp(cmd, "note_mention") == 0)
34+ scope = 1;
35+ else
36+ if (strcmp(cmd, "note_unlisted") == 0)
37+ scope = 2;
38+
39+ msg = msg_note(&snac, content, NULL, NULL, attl, scope, getenv("LANG"));
40
41 c_msg = msg_create(&snac, msg);
42