From ff3d3834645535bd225e996e80b596d51ecbd1d4 Mon Sep 17 00:00:00 2001 From: nekobit Date: Thu, 4 Aug 2022 02:47:48 +0000 Subject: [PATCH] Timeline template FossilOrigin-Name: 33082559569a1dd5aa038d4636583d0918253724defbb58570f5baafe06220d1 --- perl/timeline.pm | 4 ++-- src/global_perl.c | 2 ++ src/status.c | 2 +- templates/timeline.tt | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 templates/timeline.tt diff --git a/perl/timeline.pm b/perl/timeline.pm index ad088cd..482916b 100644 --- a/perl/timeline.pm +++ b/perl/timeline.pm @@ -17,8 +17,8 @@ sub content_timeline ssn => $ssn, statuses => $statuses, title => $title, - post_box => $show_post_box, + show_post_box => $show_post_box, ); - to_template(\&vars, \&data->{'attachment.tt'}); + to_template(\&vars, \&data->{'timeline.tt'}); } diff --git a/src/global_perl.c b/src/global_perl.c index 4e089bb..d5ae039 100644 --- a/src/global_perl.c +++ b/src/global_perl.c @@ -26,6 +26,7 @@ #include "../templates/attachment.ctt" #include "../templates/emoji.ctt" #include "../templates/postbox.ctt" +#include "../templates/timeline.ctt" HV* template_files; pthread_mutex_t perl_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -42,6 +43,7 @@ void init_template_files() hv_stores(template_files, "attachment.tt", newSVpv(data_attachment_tt, data_attachment_tt_size)); hv_stores(template_files, "emoji.tt", newSVpv(data_emoji_tt, data_emoji_tt_size)); hv_stores(template_files, "postbox.tt", newSVpv(data_postbox_tt, data_postbox_tt_size)); + hv_stores(template_files, "timeline.tt", newSVpv(data_timeline_tt, data_timeline_tt_size);) } void cleanup_template_files() diff --git a/src/status.c b/src/status.c index fb1998e..83b6173 100644 --- a/src/status.c +++ b/src/status.c @@ -947,7 +947,7 @@ void content_status(PATH_ARGS, uint8_t flags) SAVETMPS; PUSHMARK(SP); HV* session_hv = perlify_session(ssn); - XPUSHs(newRV_inc((SV*)session_hv)); + XPUSHs(newRV_noinc((SV*)session_hv)); XPUSHs(newRV_noinc((SV*)template_files)); XPUSHs(newRV_noinc((SV*)perlify_status(&status))); if (statuses_before) diff --git a/templates/timeline.tt b/templates/timeline.tt new file mode 100644 index 0000000..bd8704f --- /dev/null +++ b/templates/timeline.tt @@ -0,0 +1,14 @@ +