diff --git a/Makefile b/Makefile index ad94e82..dfad923 100644 --- a/Makefile +++ b/Makefile @@ -90,6 +90,10 @@ $(PAGES_DIR)/scrobble.chtml: $(PAGES_DIR)/scrobble.html ./filec $< data_scrobble_html > $@ $(PAGES_DIR)/directs_page.chtml: $(PAGES_DIR)/directs_page.html ./filec $< data_directs_page_html > $@ +$(PAGES_DIR)/status_interactions.chtml: $(PAGES_DIR)/status_interactions.html + ./filec $< data_status_interactions_html > $@ +$(PAGES_DIR)/status_interactions_label.chtml: $(PAGES_DIR)/status_interactions_label.html + ./filec $< data_status_interactions_label_html > $@ $(MASTODONT_DIR): git clone $(MASTODONT_URL) || true diff --git a/src/status.c b/src/status.c index ce28c26..b8058d2 100644 --- a/src/status.c +++ b/src/status.c @@ -246,11 +246,30 @@ char* construct_status(mastodont_t* api, char* emoji_reactions = NULL; char* notif_info = NULL; char* in_reply_to_str = NULL; + char* interactions_html; struct mstdnt_status* status = local_status; // Create a "fake" notification header which contains information for // the reblogged status struct mstdnt_notification notif_reblog; struct mstdnt_notification* notif = local_notif; + struct mstdnt_account* favourites = NULL; + struct mstdnt_account* reblogs = NULL; + struct mstdnt_storage favourites_storage = { 0 }; + struct mstdnt_storage reblogs_storage = { 0 }; + size_t favourites_len; + size_t reblogs_len; + + // If focused, show status interactions + if ((flags & STATUS_FOCUSED) == STATUS_FOCUSED && + (status->reblogs_count || status->favourites_count)) + { + if (status->reblogs_count) + mastodont_status_favourited_by(api, status->id, + &favourites_storage, + &favourites, + &favourites_len); + + } // Repoint value if it's a reblog if (status->reblog) @@ -312,6 +331,7 @@ char* construct_status(mastodont_t* api, parse_content, attachments ? attachments : "", emoji_reactions ? emoji_reactions : "", + interactions_html ? interactions_html : "", config_url_prefix, status->id, status->id, diff --git a/src/status.h b/src/status.h index 33b7513..00b6a43 100644 --- a/src/status.h +++ b/src/status.h @@ -27,7 +27,6 @@ #define STATUS_FOCUSED (1<<0) #define STATUS_EMOJI_PICKER (1<<1) -char* construct_in_reply_to(mastodont_t* api, struct mstdnt_status* status, size_t* size); int try_post_status(struct session* ssn, mastodont_t* api); int try_interact_status(struct session* ssn, mastodont_t* api, char* id); void content_status_create(struct session* ssn, mastodont_t* api, char** data); @@ -36,10 +35,12 @@ void content_status_create(struct session* ssn, mastodont_t* api, char** data); char* construct_post_box(char* reply_id, char* default_content, int* size); -char* reformat_status(char* content, struct mstdnt_emoji* emos, size_t emos_len); -char* greentextify(char* content); char* construct_status(mastodont_t* api, struct mstdnt_status* status, int* size, struct mstdnt_notification* notif, uint8_t flags); char* construct_statuses(mastodont_t* api, struct mstdnt_status* statuses, size_t size, size_t* ret_size); +char* construct_in_reply_to(mastodont_t* api, struct mstdnt_status* status, size_t* size); +char* construct_status_interactions(struct mstdnt_account* accounts, size_t accounts_len); +char* reformat_status(char* content, struct mstdnt_emoji* emos, size_t emos_len); +char* greentextify(char* content); // Status frontends void status_view(struct session* ssn, mastodont_t* api, char** data); diff --git a/static/status.html b/static/status.html index af96fcc..51e98fe 100644 --- a/static/status.html +++ b/static/status.html @@ -43,6 +43,7 @@ %s %s + %s
diff --git a/static/status_interactions.html b/static/status_interactions.html new file mode 100644 index 0000000..74a6e3e --- /dev/null +++ b/static/status_interactions.html @@ -0,0 +1,11 @@ +
+
+ + %s + + %s +
+
+ %s +
+
diff --git a/static/status_interactions_label.html b/static/status_interactions_label.html new file mode 100644 index 0000000..52b48b8 --- /dev/null +++ b/static/status_interactions_label.html @@ -0,0 +1,4 @@ +
+ %s + %s +