diff --git a/dist/treebird20.css b/dist/treebird20.css index b9040ef..1cfe7be 100644 --- a/dist/treebird20.css +++ b/dist/treebird20.css @@ -301,7 +301,7 @@ table.present th, table.present td .e-error { display: block; - background-color: #fcb0b0; + background: linear-gradient(#fba0a0, #fcb0b0); color: #000; border: 1px solid #bb1c1f; padding: 15px; @@ -317,9 +317,9 @@ table.present th, table.present td .e-notice { display: block; - background-color: #ddeeff; + background: linear-gradient(#ddeeff, #ccddff); color: #000; - border: 1px solid #66ccff; + border: 1px solid #80ccff; padding: 15px; font-weight: bold; } diff --git a/src/conversations.c b/src/conversations.c index 6a36995..cf2e518 100644 --- a/src/conversations.c +++ b/src/conversations.c @@ -28,6 +28,7 @@ #include "../static/chat.ctmpl" #include "../static/chats_page.ctmpl" #include "../static/message.ctmpl" +#include "../static/chat_view.ctmpl" struct construct_message_args { @@ -165,7 +166,7 @@ void content_chat_view(struct session* ssn, mastodont_t* api, char** data) struct mstdnt_storage storage = { 0 }, storage_chat = { 0 }; struct mstdnt_chat chat; struct mstdnt_storage acct_storage = { 0 }; - // char* chats_page = NULL; + char* chats_page = NULL; char* messages_html = NULL; struct mstdnt_chats_args args = { @@ -177,7 +178,6 @@ void content_chat_view(struct session* ssn, mastodont_t* api, char** data) .limit = 20, }; - if (mastodont_get_chat_messages(api, &m_args, data[0], &args, &storage, &messages, &messages_len) || mastodont_get_chat(api, &m_args, data[0], @@ -190,11 +190,21 @@ void content_chat_view(struct session* ssn, mastodont_t* api, char** data) if (!messages_html) messages_html = construct_error("This is the start of something new...", E_NOTICE, 1, NULL); /* messages_html = construct_chats_view(chats_html, NULL); */ + + struct chat_view_template tmpl = { + .prefix = config_url_prefix, + .avatar = chat.account.avatar, + .acct = chat.account.acct, + .messages = messages_html + }; + + chats_page = tmpl_gen_chat_view(&tmpl, NULL); } + struct base_page b = { .category = BASE_CAT_CHATS, - .content = messages_html, + .content = chats_page, .sidebar_left = NULL }; @@ -203,7 +213,8 @@ void content_chat_view(struct session* ssn, mastodont_t* api, char** data) // Cleanup mastodont_storage_cleanup(&storage); - //free(chats_page); + mastodont_storage_cleanup(&acct_storage); + free(chats_page); free(messages_html); // TOOD cleanup chats } diff --git a/static/chat_view.tmpl b/static/chat_view.tmpl new file mode 100644 index 0000000..22de856 --- /dev/null +++ b/static/chat_view.tmpl @@ -0,0 +1,15 @@ +
+ + | +