diff --git a/Makefile b/Makefile
index 1774638..b9501a4 100644
--- a/Makefile
+++ b/Makefile
@@ -100,6 +100,8 @@ $(PAGES_DIR)/bookmarks_page.chtml: $(PAGES_DIR)/bookmarks_page.html
./filec $< data_bookmarks_page_html > $@
$(PAGES_DIR)/favourites_page.chtml: $(PAGES_DIR)/favourites_page.html
./filec $< data_favourites_page_html > $@
+$(PAGES_DIR)/account_stub.chtml: $(PAGES_DIR)/account_stub.html
+ ./filec $< data_account_stub_html > $@
$(MASTODONT_DIR):
git clone $(MASTODONT_URL) || true
diff --git a/src/account.c b/src/account.c
index 37f4365..162d0ff 100644
--- a/src/account.c
+++ b/src/account.c
@@ -36,9 +36,17 @@
#include "../static/account_follow_btn.chtml"
#include "../static/favourites_page.chtml"
#include "../static/bookmarks_page.chtml"
+#include "../static/account_stub.chtml"
#define FOLLOWS_YOU_HTML "%s"
+struct account_args
+{
+ mastodont_t* api;
+ struct mstdnt_account* accts;
+ uint8_t flags;
+};
+
char* load_account_info(struct mstdnt_account* acct,
size_t* size)
{
@@ -290,6 +298,41 @@ size_t construct_account_page(char** result, struct account_page* page, char* co
return size;
}
+char* construct_account(mastodont_t* api,
+ struct mstdnt_account* acct,
+ uint8_t flags,
+ int* size)
+{
+ char* acct_html;
+
+ size_t s = easprintf(&acct_html, data_account_stub_html,
+ acct->acct);
+
+ if (size) *size = s;
+ return acct_html;
+}
+
+static char* construct_account_voidwrap(void* passed, size_t index, int* res)
+{
+ struct account_args* args = passed;
+ return construct_account(args->api, args->accts + index, args->flags, res);
+}
+
+char* construct_accounts(mastodont_t* api,
+ struct mstdnt_account* accounts,
+ size_t size,
+ uint8_t flags,
+ size_t* ret_size)
+{
+ if (!(accounts && size)) return NULL;
+ struct account_args acct_args = {
+ .api = api,
+ .accts = accounts,
+ .flags = flags,
+ };
+ return construct_func_strings(construct_account_voidwrap, &acct_args, size, ret_size);
+}
+
char* load_account_page(mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_relationship* relationship,
diff --git a/src/account.h b/src/account.h
index 150ec6d..f6e7473 100644
--- a/src/account.h
+++ b/src/account.h
@@ -55,8 +55,8 @@ struct account_page
char* construct_account(mastodont_t* api,
struct mstdnt_account* account,
- int* size,
- uint8_t flags);
+ uint8_t flags,
+ int* size);
char* construct_accounts(mastodont_t* api,
struct mstdnt_account* accounts,
size_t size,
diff --git a/src/search.c b/src/search.c
index 55c20fc..93973e1 100644
--- a/src/search.c
+++ b/src/search.c
@@ -24,6 +24,7 @@
#include "base_page.h"
#include "status.h"
#include "error.h"
+#include "account.h"
// Pages
#include "../static/search.chtml"
@@ -104,7 +105,7 @@ void content_search_accounts(struct session* ssn, mastodont_t* api, char** data)
struct mstdnt_storage storage = { 0 };
struct mstdnt_search_args args = {
.account_id = NULL,
- .type = MSTDNT_SEARCH_STATUSES,
+ .type = MSTDNT_SEARCH_ACCOUNTS,
.resolve = 0,
.following = 0,
.with_relationships = 0,
diff --git a/static/account_stub.html b/static/account_stub.html
new file mode 100644
index 0000000..042e93e
--- /dev/null
+++ b/static/account_stub.html
@@ -0,0 +1 @@
+%s