summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main.c b/main.c
index b4e7fa1..6eefbf4 100644
--- a/main.c
+++ b/main.c
@@ -6,6 +6,7 @@
6#include "xs_json.h" 6#include "xs_json.h"
7#include "xs_time.h" 7#include "xs_time.h"
8#include "xs_openssl.h" 8#include "xs_openssl.h"
9#include "xs_match.h"
9 10
10#include "snac.h" 11#include "snac.h"
11 12
@@ -34,6 +35,7 @@ int usage(void)
34 printf("actor {basedir} [{uid}] {url} Requests an actor\n"); 35 printf("actor {basedir} [{uid}] {url} Requests an actor\n");
35 printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n"); 36 printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n");
36 printf("note_unlisted {basedir} {uid} {text} [files...] Sends an unlisted note with optional attachments\n"); 37 printf("note_unlisted {basedir} {uid} {text} [files...] Sends an unlisted note with optional attachments\n");
38 printf("note_mention {basedir} {uid} {text} [files...] Sends a note only to mentioned accounts\n");
37 printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n"); 39 printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n");
38 printf("unboost {basedir} {uid} {url} Unboosts a post\n"); 40 printf("unboost {basedir} {uid} {url} Unboosts a post\n");
39 printf("resetpwd {basedir} {uid} Resets the password of a user\n"); 41 printf("resetpwd {basedir} {uid} Resets the password of a user\n");
@@ -620,7 +622,7 @@ int main(int argc, char *argv[])
620 return 0; 622 return 0;
621 } 623 }
622 624
623 if (strcmp(cmd, "note") == 0 || strcmp(cmd, "note_unlisted") == 0) { /** **/ 625 if (xs_match(cmd, "note|note_unlisted|note_mention")) { /** **/
624 xs *content = NULL; 626 xs *content = NULL;
625 xs *msg = NULL; 627 xs *msg = NULL;
626 xs *c_msg = NULL; 628 xs *c_msg = NULL;
@@ -684,8 +686,14 @@ int main(int argc, char *argv[])
684 else 686 else
685 content = xs_dup(url); 687 content = xs_dup(url);
686 688
687 msg = msg_note(&snac, content, NULL, NULL, attl, 689 int scope = 0;
688 strcmp(cmd, "note_unlisted") == 0 ? 2 : 0, getenv("LANG")); 690 if (strcmp(cmd, "note_mention") == 0)
691 scope = 1;
692 else
693 if (strcmp(cmd, "note_unlisted") == 0)
694 scope = 2;
695
696 msg = msg_note(&snac, content, NULL, NULL, attl, scope, getenv("LANG"));
689 697
690 c_msg = msg_create(&snac, msg); 698 c_msg = msg_create(&snac, msg);
691 699