summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/mastoapi.c b/mastoapi.c
index c9d71b9..1dd91dc 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -171,7 +171,7 @@ const char *login_page = ""
171"<body><h1>%s OAuth identify</h1>\n" 171"<body><h1>%s OAuth identify</h1>\n"
172"<div style=\"background-color: red; color: white\">%s</div>\n" 172"<div style=\"background-color: red; color: white\">%s</div>\n"
173"<form method=\"post\" action=\"%s:/" "/%s/%s\">\n" 173"<form method=\"post\" action=\"%s:/" "/%s/%s\">\n"
174"<p>Login: <input type=\"text\" name=\"login\"></p>\n" 174"<p>Login: <input type=\"text\" name=\"login\" autocapitalize=\"off\"></p>\n"
175"<p>Password: <input type=\"password\" name=\"passwd\"></p>\n" 175"<p>Password: <input type=\"password\" name=\"passwd\"></p>\n"
176"<input type=\"hidden\" name=\"redir\" value=\"%s\">\n" 176"<input type=\"hidden\" name=\"redir\" value=\"%s\">\n"
177"<input type=\"hidden\" name=\"cid\" value=\"%s\">\n" 177"<input type=\"hidden\" name=\"cid\" value=\"%s\">\n"
@@ -1024,7 +1024,7 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
1024 st = xs_dict_append(st, "in_reply_to_id", xs_stock(XSTYPE_NULL)); 1024 st = xs_dict_append(st, "in_reply_to_id", xs_stock(XSTYPE_NULL));
1025 st = xs_dict_append(st, "in_reply_to_account_id", xs_stock(XSTYPE_NULL)); 1025 st = xs_dict_append(st, "in_reply_to_account_id", xs_stock(XSTYPE_NULL));
1026 1026
1027 tmp = xs_dict_get(msg, "inReplyTo"); 1027 tmp = get_in_reply_to(msg);
1028 if (!xs_is_null(tmp)) { 1028 if (!xs_is_null(tmp)) {
1029 xs *irto = NULL; 1029 xs *irto = NULL;
1030 1030
@@ -1727,11 +1727,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1727 if (logged_in) { 1727 if (logged_in) {
1728 xs *l = notify_list(&snac1, 0, 64); 1728 xs *l = notify_list(&snac1, 0, 64);
1729 xs *out = xs_list_new(); 1729 xs *out = xs_list_new();
1730 xs_list *p = l;
1731 const xs_dict *v; 1730 const xs_dict *v;
1732 const xs_list *excl = xs_dict_get(args, "exclude_types[]"); 1731 const xs_list *excl = xs_dict_get(args, "exclude_types[]");
1732 const char *max_id = xs_dict_get(args, "max_id");
1733 1733
1734 while (xs_list_iter(&p, &v)) { 1734 xs_list_foreach(l, v) {
1735 xs *noti = notify_get(&snac1, v); 1735 xs *noti = notify_get(&snac1, v);
1736 1736
1737 if (noti == NULL) 1737 if (noti == NULL)
@@ -1740,6 +1740,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1740 const char *type = xs_dict_get(noti, "type"); 1740 const char *type = xs_dict_get(noti, "type");
1741 const char *utype = xs_dict_get(noti, "utype"); 1741 const char *utype = xs_dict_get(noti, "utype");
1742 const char *objid = xs_dict_get(noti, "objid"); 1742 const char *objid = xs_dict_get(noti, "objid");
1743 const char *id = xs_dict_get(noti, "id");
1744 xs *fid = xs_replace(id, ".", "");
1743 xs *actor = NULL; 1745 xs *actor = NULL;
1744 xs *entry = NULL; 1746 xs *entry = NULL;
1745 1747
@@ -1752,6 +1754,13 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1752 if (is_hidden(&snac1, objid)) 1754 if (is_hidden(&snac1, objid))
1753 continue; 1755 continue;
1754 1756
1757 if (max_id) {
1758 if (strcmp(fid, max_id) == 0)
1759 max_id = NULL;
1760
1761 continue;
1762 }
1763
1755 /* convert the type */ 1764 /* convert the type */
1756 if (strcmp(type, "Like") == 0 || strcmp(type, "EmojiReact") == 0) 1765 if (strcmp(type, "Like") == 0 || strcmp(type, "EmojiReact") == 0)
1757 type = "favourite"; 1766 type = "favourite";
@@ -1778,12 +1787,15 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1778 1787
1779 mn = xs_dict_append(mn, "type", type); 1788 mn = xs_dict_append(mn, "type", type);
1780 1789
1781 xs *id = xs_replace(xs_dict_get(noti, "id"), ".", ""); 1790 mn = xs_dict_append(mn, "id", fid);
1782 mn = xs_dict_append(mn, "id", id);
1783 1791
1784 mn = xs_dict_append(mn, "created_at", xs_dict_get(noti, "date")); 1792 mn = xs_dict_append(mn, "created_at", xs_dict_get(noti, "date"));
1785 1793
1786 xs *acct = mastoapi_account(&snac1, actor); 1794 xs *acct = mastoapi_account(&snac1, actor);
1795
1796 if (acct == NULL)
1797 continue;
1798
1787 mn = xs_dict_append(mn, "account", acct); 1799 mn = xs_dict_append(mn, "account", acct);
1788 1800
1789 if (strcmp(type, "follow") != 0 && !xs_is_null(objid)) { 1801 if (strcmp(type, "follow") != 0 && !xs_is_null(objid)) {