소스 검색

New function is_msg_mine().

grunfink 8 달 전
부모
커밋
5c2c7b27ac
2개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      activitypub.c
  2. 1 0
      snac.h

+ 14 - 0
activitypub.c

@@ -669,6 +669,20 @@ xs_list *recipient_list(snac *snac, const xs_dict *msg, int expand_public)
 }
 
 
+int is_msg_mine(snac *user, const char *id)
+/* returns true if a post id is by the given user */
+{
+    int ret = 0;
+
+    if (xs_is_string(id)) {
+        xs *s1 = xs_fmt("%s/", user->actor);
+        ret = xs_startswith(id, s1);
+    }
+
+    return ret;
+}
+
+
 int is_msg_public(const xs_dict *msg)
 /* checks if a message is public */
 {

+ 1 - 0
snac.h

@@ -388,6 +388,7 @@ int send_to_inbox(snac *snac, const xs_str *inbox, const xs_dict *msg,
 xs_str *get_actor_inbox(const char *actor, int shared);
 int send_to_actor(snac *snac, const char *actor, const xs_dict *msg,
                   xs_val **payload, int *p_size, int timeout);
+int is_msg_mine(snac *user, const char *id);
 int is_msg_public(const xs_dict *msg);
 int is_msg_from_private_user(const xs_dict *msg);
 int is_msg_for_me(snac *snac, const xs_dict *msg);