summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2025-11-29 06:08:37 +0100
committerGravatar grunfink2025-11-29 06:08:37 +0100
commit5c2c7b27aca8bec59f90007481e5e2c6e961827f (patch)
treed07dd72c332c45a8855363a52dd74267e482ef22
parentSome attachments are of type 'Video' instead of a MIME type (bsky). (diff)
downloadsnac2-5c2c7b27aca8bec59f90007481e5e2c6e961827f.tar.gz
snac2-5c2c7b27aca8bec59f90007481e5e2c6e961827f.tar.xz
snac2-5c2c7b27aca8bec59f90007481e5e2c6e961827f.zip
New function is_msg_mine().
-rw-r--r--activitypub.c14
-rw-r--r--snac.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c
index 2c0fa2e..65eed05 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -669,6 +669,20 @@ xs_list *recipient_list(snac *snac, const xs_dict *msg, int expand_public)
669} 669}
670 670
671 671
672int is_msg_mine(snac *user, const char *id)
673/* returns true if a post id is by the given user */
674{
675 int ret = 0;
676
677 if (xs_is_string(id)) {
678 xs *s1 = xs_fmt("%s/", user->actor);
679 ret = xs_startswith(id, s1);
680 }
681
682 return ret;
683}
684
685
672int is_msg_public(const xs_dict *msg) 686int is_msg_public(const xs_dict *msg)
673/* checks if a message is public */ 687/* checks if a message is public */
674{ 688{
diff --git a/snac.h b/snac.h
index 91dfa27..4d387a6 100644
--- a/snac.h
+++ b/snac.h
@@ -388,6 +388,7 @@ int send_to_inbox(snac *snac, const xs_str *inbox, const xs_dict *msg,
388xs_str *get_actor_inbox(const char *actor, int shared); 388xs_str *get_actor_inbox(const char *actor, int shared);
389int send_to_actor(snac *snac, const char *actor, const xs_dict *msg, 389int send_to_actor(snac *snac, const char *actor, const xs_dict *msg,
390 xs_val **payload, int *p_size, int timeout); 390 xs_val **payload, int *p_size, int timeout);
391int is_msg_mine(snac *user, const char *id);
391int is_msg_public(const xs_dict *msg); 392int is_msg_public(const xs_dict *msg);
392int is_msg_from_private_user(const xs_dict *msg); 393int is_msg_from_private_user(const xs_dict *msg);
393int is_msg_for_me(snac *snac, const xs_dict *msg); 394int is_msg_for_me(snac *snac, const xs_dict *msg);