summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.md2
-rw-r--r--activitypub.c14
-rw-r--r--data.c8
-rw-r--r--html.c6
-rw-r--r--mastoapi.c4
-rw-r--r--rss.c2
-rw-r--r--upgrade.c2
7 files changed, 20 insertions, 18 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 570cc1a..505d080 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -8,6 +8,8 @@ Added metadata to remote users in the people page (contributed by dandelions).
8 8
9Fixed memory leak (contributed by dandelions). 9Fixed memory leak (contributed by dandelions).
10 10
11Fixed user matching (contributed by rakoo).
12
11Fixed typo in man page (contributed by spky). 13Fixed typo in man page (contributed by spky).
12 14
13## 2.84 15## 2.84
diff --git a/activitypub.c b/activitypub.c
index 2c0fa2e..90230d8 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -779,7 +779,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
779 object_get(object, &obj); 779 object_get(object, &obj);
780 780
781 /* if it's about one of our posts, accept it */ 781 /* if it's about one of our posts, accept it */
782 if (xs_startswith(object, snac->actor)) 782 if (is_msg_mine(snac, object))
783 return 2; 783 return 2;
784 784
785 /* blocked by hashtag? */ 785 /* blocked by hashtag? */
@@ -1242,7 +1242,7 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
1242 1242
1243 if (xs_match(type, "Like|Announce|EmojiReact")) { 1243 if (xs_match(type, "Like|Announce|EmojiReact")) {
1244 /* if it's not an admiration about something by us, done */ 1244 /* if it's not an admiration about something by us, done */
1245 if (xs_is_null(objid) || !xs_startswith(objid, snac->actor)) 1245 if (xs_is_null(objid) || !is_msg_mine(snac, objid))
1246 return; 1246 return;
1247 1247
1248 /* if it's an announce by our own relay, done */ 1248 /* if it's an announce by our own relay, done */
@@ -1267,7 +1267,7 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
1267 return; 1267 return;
1268 1268
1269 /* if it's not ours and we didn't vote, discard */ 1269 /* if it's not ours and we didn't vote, discard */
1270 if (!xs_startswith(poll_id, snac->actor) && !was_question_voted(snac, poll_id)) 1270 if (!is_msg_mine(snac, poll_id) && !was_question_voted(snac, poll_id))
1271 return; 1271 return;
1272 } 1272 }
1273 1273
@@ -2792,10 +2792,10 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req)
2792 if (xs_is_null(object)) 2792 if (xs_is_null(object))
2793 snac_log(snac, xs_fmt("malformed message: no 'id' field")); 2793 snac_log(snac, xs_fmt("malformed message: no 'id' field"));
2794 else 2794 else
2795 if (is_muted(snac, actor) && !xs_startswith(object, snac->actor)) 2795 if (is_muted(snac, actor) && !is_msg_mine(snac, object))
2796 snac_log(snac, xs_fmt("dropped 'Announce' from muted actor %s", actor)); 2796 snac_log(snac, xs_fmt("dropped 'Announce' from muted actor %s", actor));
2797 else 2797 else
2798 if (is_limited(snac, actor) && !xs_startswith(object, snac->actor)) 2798 if (is_limited(snac, actor) && !is_msg_mine(snac, object))
2799 snac_log(snac, xs_fmt("dropped 'Announce' from limited actor %s", actor)); 2799 snac_log(snac, xs_fmt("dropped 'Announce' from limited actor %s", actor));
2800 else { 2800 else {
2801 xs *a_msg = NULL; 2801 xs *a_msg = NULL;
@@ -2903,7 +2903,7 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req)
2903 snac_log(snac, xs_fmt("malformed message: no 'id' field")); 2903 snac_log(snac, xs_fmt("malformed message: no 'id' field"));
2904 else 2904 else
2905 if (object_here(object)) { 2905 if (object_here(object)) {
2906 if (xs_startswith(object, srv_baseurl) && !xs_startswith(object, actor)) 2906 if (xs_startswith(object, srv_baseurl) && !is_msg_mine(snac, object))
2907 snac_log(snac, xs_fmt("ignored incorrect 'Delete' %s %s", actor, object)); 2907 snac_log(snac, xs_fmt("ignored incorrect 'Delete' %s %s", actor, object));
2908 else { 2908 else {
2909 timeline_del(snac, object); 2909 timeline_del(snac, object);
@@ -3716,7 +3716,7 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
3716 const char *type = xs_dict_get(i, "type"); 3716 const char *type = xs_dict_get(i, "type");
3717 const char *id = xs_dict_get(i, "id"); 3717 const char *id = xs_dict_get(i, "id");
3718 3718
3719 if (type && id && strcmp(type, "Note") == 0 && xs_startswith(id, snac.actor)) { 3719 if (type && id && strcmp(type, "Note") == 0 && is_msg_mine(&snac, id)) {
3720 if (is_msg_public(i)) { 3720 if (is_msg_public(i)) {
3721 xs *c_msg = msg_create(&snac, i); 3721 xs *c_msg = msg_create(&snac, i);
3722 list = xs_list_append(list, c_msg); 3722 list = xs_list_append(list, c_msg);
diff --git a/data.c b/data.c
index c2fdccb..688d2e3 100644
--- a/data.c
+++ b/data.c
@@ -1467,7 +1467,7 @@ void timeline_update_indexes(snac *snac, const char *id)
1467{ 1467{
1468 object_user_cache_add(snac, id, "private"); 1468 object_user_cache_add(snac, id, "private");
1469 1469
1470 if (xs_startswith(id, snac->actor)) { 1470 if (is_msg_mine(snac, id)) {
1471 xs *msg = NULL; 1471 xs *msg = NULL;
1472 1472
1473 if (valid_status(object_get(id, &msg))) { 1473 if (valid_status(object_get(id, &msg))) {
@@ -1927,7 +1927,7 @@ int pin(snac *user, const char *id)
1927{ 1927{
1928 int ret = -2; 1928 int ret = -2;
1929 1929
1930 if (xs_startswith(id, user->actor)) { 1930 if (is_msg_mine(user, id)) {
1931 if (is_pinned(user, id)) 1931 if (is_pinned(user, id))
1932 ret = -3; 1932 ret = -3;
1933 else 1933 else
@@ -3527,7 +3527,7 @@ void enqueue_output(snac *snac, const xs_dict *msg,
3527 const xs_str *inbox, int retries, int p_status) 3527 const xs_str *inbox, int retries, int p_status)
3528/* enqueues an output message to an inbox */ 3528/* enqueues an output message to an inbox */
3529{ 3529{
3530 if (xs_startswith(inbox, snac->actor)) { 3530 if (is_msg_mine(snac, inbox)) {
3531 snac_debug(snac, 1, xs_str_new("refusing enqueue to myself")); 3531 snac_debug(snac, 1, xs_str_new("refusing enqueue to myself"));
3532 return; 3532 return;
3533 } 3533 }
@@ -4055,7 +4055,7 @@ void delete_purged_posts(snac *user, int days)
4055 if (xs_is_dict(msg)) { 4055 if (xs_is_dict(msg)) {
4056 const char *id = xs_dict_get(msg, "id"); 4056 const char *id = xs_dict_get(msg, "id");
4057 4057
4058 if (xs_is_string(id) && xs_startswith(id, user->actor)) { 4058 if (xs_is_string(id) && is_msg_mine(user, id)) {
4059 xs *d_msg = msg_delete(user, id); 4059 xs *d_msg = msg_delete(user, id);
4060 4060
4061 enqueue_message(user, d_msg); 4061 enqueue_message(user, d_msg);
diff --git a/html.c b/html.c
index 12d269a..d6223b9 100644
--- a/html.c
+++ b/html.c
@@ -1898,7 +1898,7 @@ xs_html *html_entry_controls(snac *user, const char *actor,
1898 xs_html_attr("name", "redir"), 1898 xs_html_attr("name", "redir"),
1899 xs_html_attr("value", redir)))); 1899 xs_html_attr("value", redir))));
1900 1900
1901 if (!xs_startswith(id, user->actor)) { 1901 if (!is_msg_mine(user, id)) {
1902 if (xs_list_in(likes, user->md5) == -1) { 1902 if (xs_list_in(likes, user->md5) == -1) {
1903 /* not already liked; add button */ 1903 /* not already liked; add button */
1904 xs_html_add(form, 1904 xs_html_add(form,
@@ -2426,7 +2426,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2426 if (read_only) 2426 if (read_only)
2427 closed = 1; /* non-identified page; show as closed */ 2427 closed = 1; /* non-identified page; show as closed */
2428 else 2428 else
2429 if (user && xs_startswith(id, user->actor)) 2429 if (user && is_msg_mine(user, id))
2430 closed = 1; /* we questioned; closed for us */ 2430 closed = 1; /* we questioned; closed for us */
2431 else 2431 else
2432 if (user && was_question_voted(user, id)) 2432 if (user && was_question_voted(user, id))
@@ -5022,7 +5022,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
5022 } 5022 }
5023 else { 5023 else {
5024 /* delete an entry */ 5024 /* delete an entry */
5025 if (xs_startswith(id, snac.actor) && !is_draft(&snac, id)) { 5025 if (is_msg_mine(&snac, id) && !is_draft(&snac, id)) {
5026 /* it's a post by us: generate a delete */ 5026 /* it's a post by us: generate a delete */
5027 xs *msg = msg_delete(&snac, id); 5027 xs *msg = msg_delete(&snac, id);
5028 5028
diff --git a/mastoapi.c b/mastoapi.c
index 94912f1..acb95a0 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1919,7 +1919,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1919 /* add only posts by the author */ 1919 /* add only posts by the author */
1920 if (!xs_is_null(msg_id) && 1920 if (!xs_is_null(msg_id) &&
1921 strcmp(xs_dict_get(msg, "type"), "Note") == 0 && 1921 strcmp(xs_dict_get(msg, "type"), "Note") == 0 &&
1922 xs_startswith(xs_dict_get(msg, "id"), snac2.actor) && is_msg_public(msg)) { 1922 is_msg_mine(&snac2, xs_dict_get(msg, "id")) && is_msg_public(msg)) {
1923 1923
1924 /* if max_id is set, skip entries until we find it */ 1924 /* if max_id is set, skip entries until we find it */
1925 if (skip_until_max) { 1925 if (skip_until_max) {
@@ -3824,7 +3824,7 @@ int mastoapi_delete_handler(const xs_dict *req, const char *q_path,
3824 if (valid_status(object_get_by_md5(p, &obj))) { 3824 if (valid_status(object_get_by_md5(p, &obj))) {
3825 const char *id = xs_dict_get(obj, "id"); 3825 const char *id = xs_dict_get(obj, "id");
3826 3826
3827 if (xs_is_string(id) && xs_startswith(id, snac.actor)) { 3827 if (xs_is_string(id) && is_msg_mine(&snac, id)) {
3828 xs *out = mastoapi_status(&snac, obj); 3828 xs *out = mastoapi_status(&snac, obj);
3829 3829
3830 xs *msg = msg_delete(&snac, id); 3830 xs *msg = msg_delete(&snac, id);
diff --git a/rss.c b/rss.c
index 6e77205..6124e7a 100644
--- a/rss.c
+++ b/rss.c
@@ -59,7 +59,7 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline,
59 const char *content = xs_dict_get(msg, "content"); 59 const char *content = xs_dict_get(msg, "content");
60 const char *published = xs_dict_get(msg, "published"); 60 const char *published = xs_dict_get(msg, "published");
61 61
62 if (user && !xs_startswith(id, user->actor)) 62 if (user && !is_msg_mine(user, id))
63 continue; 63 continue;
64 64
65 if (!id || !content || !published) 65 if (!id || !content || !published)
diff --git a/upgrade.c b/upgrade.c
index 87ddfc8..9e0ae6e 100644
--- a/upgrade.c
+++ b/upgrade.c
@@ -213,7 +213,7 @@ int snac_upgrade(xs_str **error)
213 object_add_ow(id, o); 213 object_add_ow(id, o);
214 214
215 /* if it's from us, add to public */ 215 /* if it's from us, add to public */
216 if (xs_startswith(id, snac.actor)) { 216 if (is_msg_mine(&snac, id)) {
217 const xs_list *p; 217 const xs_list *p;
218 const char *v; 218 const char *v;
219 int c; 219 int c;