diff --git a/perl/icons.pm b/perl/icons.pm new file mode 100644 index 0000000..22404f7 --- /dev/null +++ b/perl/icons.pm @@ -0,0 +1,29 @@ +package icons; +use strict; +use warnings; + +use Exporter 'import'; + +our @EXPORT = qw( &get_icon &get_icon_svg &get_icon_png ); + +sub get_icon +{ + my ($ico, $is_png) = @_; + $is_png ||= 0; + + $is_png ? get_icon_png($ico) : get_icon_svg($ico); +} + +sub get_icon_svg +{ + my %res = ( + repeat => '', + like => '', + expand => '', + reply => '', + emoji => '', + likeboost => '', + ); + + $res{$_[0]}; +} diff --git a/perl/status.pm b/perl/status.pm index 232b621..05c6e8b 100644 --- a/perl/status.pm +++ b/perl/status.pm @@ -1,6 +1,7 @@ package status; use strict; use warnings; +use icons 'get_icon'; use Exporter 'import'; our @EXPORT = qw( status ); @@ -12,8 +13,10 @@ sub status my ($ssn, $data, $status) = @_; my %vars = ( - prefix => $ssn, - status => $status + prefix => '', + ssn => $ssn, + status => $status, + icon => \&get_icon, ); to_template(\%vars, \$data->{'status.tt'}); @@ -24,6 +27,7 @@ sub content_status my ($ssn, $data, $status, $statuses_before, $statuses_after) = @_; my %vars = ( + prefix => '', ssn => $ssn, data => $data, create_status => \&status, diff --git a/src/global_perl.c b/src/global_perl.c index 0bae575..719f5fe 100644 --- a/src/global_perl.c +++ b/src/global_perl.c @@ -22,6 +22,7 @@ #include "../templates/notif_compact.ctt" #include "../templates/status.ctt" #include "../templates/content_status.ctt" +#include "../templates/emoji_picker.ctt" HV* template_files; pthread_mutex_t perl_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -34,6 +35,7 @@ void init_template_files() hv_stores(template_files, "notif_compact.tt", newSVpv(data_notif_compact_tt, data_notif_compact_tt_size)); hv_stores(template_files, "status.tt", newSVpv(data_status_tt, data_status_tt_size)); hv_stores(template_files, "content_status.tt", newSVpv(data_content_status_tt, data_content_status_tt_size)); + hv_stores(template_files, "emoji_picker.tt", newSVpv(data_emoji_picker_tt, data_emoji_picker_tt_size)); } void cleanup_template_files() diff --git a/src/status.c b/src/status.c index 58638be..aedb98f 100644 --- a/src/status.c +++ b/src/status.c @@ -1122,7 +1122,7 @@ HV* perlify_status(const struct mstdnt_status* status) HV* status_hv = newHV(); hvstores_str(status_hv, "id", status->id); hvstores_str(status_hv, "uri", status->uri); - hvstores_str(status_hv, "created_at", status->id); + hvstores_int(status_hv, "created_at", status->created_at); hvstores_ref(status_hv, "account", perlify_account(&(status->account))); hvstores_str(status_hv, "content", status->content); hvstores_str(status_hv, "spoiler_text", status->spoiler_text); diff --git a/static/reply_checkbox.tmpl b/static/reply_checkbox.tmpl index 080eb2d..e69de29 100644 --- a/static/reply_checkbox.tmpl +++ b/static/reply_checkbox.tmpl @@ -1,5 +0,0 @@ - - diff --git a/templates/emoji_picker.tt b/templates/emoji_picker.tt new file mode 100644 index 0000000..70cd38a --- /dev/null +++ b/templates/emoji_picker.tt @@ -0,0 +1,81 @@ +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ {{%s:emojis_smileys}} +
+ +
+ {{%s:emojis_animals}} +
+ +
+ {{%s:emojis_food}} +
+ +
+ {{%s:emojis_travel}} +
+ +
+ {{%s:emojis_activities}} +
+ +
+ {{%s:emojis_objects}} +
+ +
+ {{%s:emojis_symbols}} +
+ +
+ {{%s:emojis_flags}} +
+
+
diff --git a/templates/status.tt b/templates/status.tt index b5bf5b8..c96170f 100644 --- a/templates/status.tt +++ b/templates/status.tt @@ -9,7 +9,7 @@
[% status.account.display_name %] - [% status.account.acct %] + [% status.account.acct %]