diff --git a/perl/timeline.pm b/perl/timeline.pm index 482916b..6e86a2f 100644 --- a/perl/timeline.pm +++ b/perl/timeline.pm @@ -7,6 +7,8 @@ our @EXPORT = qw( generate_attachment ); use template_helpers 'to_template'; use icons 'get_icon'; +use postbox 'generate_postbox'; +use status 'generate_status'; sub content_timeline { @@ -18,6 +20,8 @@ sub content_timeline statuses => $statuses, title => $title, show_post_box => $show_post_box, + postbox => \&postbox, + create_status => \&generate_status, ); to_template(\&vars, \&data->{'timeline.tt'}); diff --git a/src/global_perl.c b/src/global_perl.c index d5ae039..1cd1039 100644 --- a/src/global_perl.c +++ b/src/global_perl.c @@ -43,7 +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);) + 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 83b6173..e93ead7 100644 --- a/src/status.c +++ b/src/status.c @@ -947,16 +947,16 @@ void content_status(PATH_ARGS, uint8_t flags) SAVETMPS; PUSHMARK(SP); HV* session_hv = perlify_session(ssn); - XPUSHs(newRV_noinc((SV*)session_hv)); - XPUSHs(newRV_noinc((SV*)template_files)); - XPUSHs(newRV_noinc((SV*)perlify_status(&status))); + XPUSHs(newRV_inc((SV*)session_hv)); + XPUSHs(newRV_inc((SV*)template_files)); + XPUSHs(newRV_inc((SV*)perlify_status(&status))); if (statuses_before) - XPUSHs(newRV_noinc((AV*)perlify_statuses(statuses_before, stat_before_len))); + XPUSHs(newRV_inc((AV*)perlify_statuses(statuses_before, stat_before_len))); else XPUSHs(&PL_sv_undef); if (statuses_after) - XPUSHs(newRV_noinc((AV*)perlify_statuses(statuses_after, stat_after_len))); + XPUSHs(newRV_inc((AV*)perlify_statuses(statuses_after, stat_after_len))); else XPUSHs(&PL_sv_undef); // ARGS diff --git a/src/timeline.c b/src/timeline.c index 0962d86..9dc1d10 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -30,7 +30,7 @@ #include "query.h" #include "error.h" #include "string_helpers.h" -#include "perl_global.h" +#include "global_perl.h" #include "../static/timeline_options.ctmpl" #include "../static/navigation.ctmpl" @@ -51,21 +51,21 @@ void content_timeline(FCGX_Request* req, SAVETMPS; PUSHMARK(SP); HV* session_hv = perlify_session(ssn); - XPUSHs(newRV_noinc((SV*)session_hv)); - XPUSHs(newRV_noinc((SV*)template_files)); + XPUSHs(newRV_inc((SV*)session_hv)); + XPUSHs(newRV_inc((SV*)template_files)); if (statuses) - XPUSHs(newRV_noinc((AV*)perlify_statuses(statuses, statuses_len))); - else ARG_UNDEFINED(); + XPUSHs(newRV_inc((SV*)perlify_statuses(statuses, statuses_len))); + else { ARG_UNDEFINED(); } - if (title) + if (header_text) XPUSHs(newSVpv(header_text, 0)); - else ARG_UNDEFINED(); + else { ARG_UNDEFINED(); } XPUSHi(show_post_box); PUTBACK; - call_pv("status::content_timeline", G_SCALAR); + call_pv("timeline::content_timeline", G_SCALAR); SPAGAIN; // Duplicate to free temps @@ -78,7 +78,7 @@ void content_timeline(FCGX_Request* req, struct base_page b = { .category = cat, - .content = output, + .content = dup, .session = session_hv, .sidebar_left = NULL }; diff --git a/templates/timeline.tt b/templates/timeline.tt index bd8704f..0c2c4e9 100644 --- a/templates/timeline.tt +++ b/templates/timeline.tt @@ -1,3 +1,7 @@ +[% IF show_post_box %] + [% postbox(ssn, data, undef) %] +[% END %] + + +[% FOREACH i IN statuses %] + [% create_status(ssn, data, i) %] +[% END %] + +[%# TODO navigation %]