Chats
FossilOrigin-Name: 54a80dceb8d34d72d13ae4adc77229d8293fed346908ea4d5fdbac6c4c916b67
This commit is contained in:
parent
2aa34fea2a
commit
ce74e7125e
6 changed files with 30 additions and 5 deletions
|
@ -6,6 +6,7 @@ use Exporter 'import';
|
|||
our @EXPORTS = qw( content_chats );
|
||||
|
||||
use template_helpers 'to_template';
|
||||
use string_helpers 'format_username';
|
||||
|
||||
sub construct_chat
|
||||
{
|
||||
|
@ -28,6 +29,7 @@ sub content_chats
|
|||
prefix => '',
|
||||
ssn => $ssn,
|
||||
chats => $chats,
|
||||
format_username => \&format_username,
|
||||
);
|
||||
|
||||
to_template(\%vars, \$data->{'content_chats.tt'});
|
||||
|
|
|
@ -11,6 +11,7 @@ use status;
|
|||
use account;
|
||||
use lists;
|
||||
use search;
|
||||
use chat;
|
||||
|
||||
# my $template = Template->new(
|
||||
# {
|
||||
|
|
|
@ -184,7 +184,7 @@ void content_chats(PATH_ARGS)
|
|||
HV* session_hv = perlify_session(ssn);
|
||||
XPUSHs(newRV_noinc((SV*)session_hv));
|
||||
XPUSHs(newRV_noinc((SV*)template_files));
|
||||
XPUSHs(newRV_noinc((SV*)perlify_chats(&chats, chats_len)));
|
||||
XPUSHs(newRV_noinc((SV*)perlify_chats(chats, chats_len)));
|
||||
// ARGS
|
||||
PUTBACK;
|
||||
call_pv("chat::content_chats", G_SCALAR);
|
||||
|
@ -200,7 +200,7 @@ void content_chats(PATH_ARGS)
|
|||
|
||||
struct base_page b = {
|
||||
.category = BASE_CAT_CHATS,
|
||||
.content = chats_page,
|
||||
.content = dup,
|
||||
.session = session_hv,
|
||||
.sidebar_left = NULL
|
||||
};
|
||||
|
@ -210,9 +210,8 @@ void content_chats(PATH_ARGS)
|
|||
|
||||
// Cleanup
|
||||
mastodont_storage_cleanup(&storage);
|
||||
free(chats_page);
|
||||
free(chats_html);
|
||||
// TOOD cleanup chats
|
||||
Safefree(dup);
|
||||
}
|
||||
|
||||
char* construct_chat_view(struct session* ssn, mastodont_t* api, char* id, size_t* len)
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "../templates/search_accounts.ctt"
|
||||
#include "../templates/search_statuses.ctt"
|
||||
#include "../templates/search_tags.ctt"
|
||||
#include "../templates/content_chats.ctt"
|
||||
#include "../templates/chat.ctt"
|
||||
|
||||
PerlInterpreter* my_perl;
|
||||
HV* template_files;
|
||||
|
@ -70,6 +72,8 @@ void init_template_files(pTHX)
|
|||
hv_stores(template_files, "search_accounts.tt", newSVpv(data_search_accounts_tt, data_search_accounts_tt_size));
|
||||
hv_stores(template_files, "search_statuses.tt", newSVpv(data_search_statuses_tt, data_search_statuses_tt_size));
|
||||
hv_stores(template_files, "search_tags.tt", newSVpv(data_search_tags_tt, data_search_tags_tt_size));
|
||||
hv_stores(template_files, "content_chats.tt", newSVpv(data_content_chats_tt, data_content_chats_tt_size));
|
||||
hv_stores(template_files, "chat.tt", newSVpv(data_chat_tt, data_chat_tt_size));
|
||||
}
|
||||
|
||||
void cleanup_template_files()
|
||||
|
|
1
templates/chat.tt
Normal file
1
templates/chat.tt
Normal file
|
@ -0,0 +1 @@
|
|||
chat
|
|
@ -1,5 +1,23 @@
|
|||
<h1 class="text-header">Chats</h1>
|
||||
|
||||
[% FOREACH chat IN chats %]
|
||||
[% make_chat(chat) %]
|
||||
<a href="/chats/[% chat.id %]">
|
||||
<table class="contact">
|
||||
<tr>
|
||||
<td class="pfp-td">
|
||||
<img src="[% chat.account.avatar %]">
|
||||
</td>
|
||||
<td class="contact-right-td">
|
||||
<div class="contact-right">
|
||||
<div class="contact-info">
|
||||
<span class="username" title="[% chat.account.acct %]">[% format_username(chat.account) %]</span>
|
||||
</div>
|
||||
<div class="last-message">
|
||||
<span class="chat-msg-preview">Chat message</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</a>
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue