commit 5c2c7b2
grunfink
·
2025-11-29 05:08:37 +0000 UTC
parent fcae55f
New function is_msg_mine().
2 files changed,
+15,
-0
M
snac.h
+14,
-0
1@@ -669,6 +669,20 @@ xs_list *recipient_list(snac *snac, const xs_dict *msg, int expand_public)
2 }
3
4
5+int is_msg_mine(snac *user, const char *id)
6+/* returns true if a post id is by the given user */
7+{
8+ int ret = 0;
9+
10+ if (xs_is_string(id)) {
11+ xs *s1 = xs_fmt("%s/", user->actor);
12+ ret = xs_startswith(id, s1);
13+ }
14+
15+ return ret;
16+}
17+
18+
19 int is_msg_public(const xs_dict *msg)
20 /* checks if a message is public */
21 {
M
snac.h
+1,
-0
1@@ -388,6 +388,7 @@ int send_to_inbox(snac *snac, const xs_str *inbox, const xs_dict *msg,
2 xs_str *get_actor_inbox(const char *actor, int shared);
3 int send_to_actor(snac *snac, const char *actor, const xs_dict *msg,
4 xs_val **payload, int *p_size, int timeout);
5+int is_msg_mine(snac *user, const char *id);
6 int is_msg_public(const xs_dict *msg);
7 int is_msg_from_private_user(const xs_dict *msg);
8 int is_msg_for_me(snac *snac, const xs_dict *msg);