forked from mirrors/treebird
Emoji picker
FossilOrigin-Name: d4a425913d5f30b4ee9660b08d16190da751d4a28614bc36bf3464a35674d446
This commit is contained in:
parent
2c0c69e765
commit
09a00d6e1f
18 changed files with 285 additions and 187 deletions
40
dist/treebird20.css
vendored
40
dist/treebird20.css
vendored
|
@ -51,7 +51,7 @@ ul
|
|||
}
|
||||
#main-page
|
||||
{
|
||||
margin: 8px;
|
||||
v margin: 8px;
|
||||
margin-top: 0;
|
||||
width: 1000px;
|
||||
border-top: 0 !important;
|
||||
|
@ -1064,7 +1064,8 @@ svg.in-reply-to-icon
|
|||
}
|
||||
|
||||
/* Emoji */
|
||||
.emoji
|
||||
.status-content .emoji,
|
||||
.notification-content .emoji
|
||||
{
|
||||
font-family: monospace;
|
||||
display: inline;
|
||||
|
@ -1075,12 +1076,14 @@ svg.in-reply-to-icon
|
|||
transition: transform .2s;
|
||||
}
|
||||
|
||||
.emoji:hover
|
||||
.status-content .emoji:hover,
|
||||
.notification-content .emoji:hover
|
||||
{
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
.emoji:active
|
||||
.status-content .emoji:active,
|
||||
.notification-content .emoji:active
|
||||
{
|
||||
transform: scale(2.7);
|
||||
}
|
||||
|
@ -1091,6 +1094,35 @@ svg.in-reply-to-icon
|
|||
border: 1px solid #cacaca;
|
||||
}
|
||||
|
||||
/* Emojo picker */
|
||||
.emoji-picker
|
||||
{
|
||||
position: absolute;
|
||||
margin-left: -15px;
|
||||
width: 260px;
|
||||
border: 1px solid #cacaca;
|
||||
background-color: #fff;
|
||||
background: linear-gradient(#fff, #f3f3f3);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.emoji-picker .emoji
|
||||
{
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
vertical-align: center;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.emoji-picker-emojos
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, 1fr);
|
||||
padding: 0px 8px;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.form-group
|
||||
{
|
||||
padding: 5px;
|
||||
|
|
|
@ -80,7 +80,7 @@ static char* account_statuses_cb(struct session* ssn,
|
|||
statuses_html = construct_error(storage.error, E_ERROR, 1, NULL);
|
||||
}
|
||||
else {
|
||||
statuses_html = construct_statuses(api, statuses, statuses_len, NULL, NULL);
|
||||
statuses_html = construct_statuses(ssn, api, statuses, statuses_len, NULL, NULL);
|
||||
if (!statuses_html)
|
||||
statuses_html = construct_error("No statuses", E_NOTICE, 1, NULL);
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ void content_account_bookmarks(struct session* ssn, mastodont_t* api, char** dat
|
|||
}
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(api, statuses, status_count, NULL, &statuses_html_count);
|
||||
status_format = construct_statuses(ssn, api, statuses, status_count, NULL, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = construct_error("Couldn't load posts", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ void content_account_favourites(struct session* ssn, mastodont_t* api, char** da
|
|||
}
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(api, statuses, status_count, NULL, &statuses_html_count);
|
||||
status_format = construct_statuses(ssn, api, statuses, status_count, NULL, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = construct_error("Couldn't load posts", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ void render_base_page(struct base_page* page, struct session* ssn, mastodont_t*
|
|||
};
|
||||
|
||||
if (mastodont_get_notifications(api, &args, &storage, ¬ifs, ¬ifs_len) == 0)
|
||||
sidebar_str = construct_notifications_compact(api, notifs, notifs_len, NULL);
|
||||
sidebar_str = construct_notifications_compact(ssn, api, notifs, notifs_len, NULL);
|
||||
|
||||
mstdnt_cleanup_notifications(notifs, notifs_len);
|
||||
}
|
||||
|
|
32
src/emoji.c
32
src/emoji.c
|
@ -58,11 +58,18 @@ char* emojify(char* content, struct mstdnt_emoji* emos, size_t emos_len)
|
|||
return res;
|
||||
}
|
||||
|
||||
char* construct_emoji(struct emoji_info* emoji, size_t* size)
|
||||
struct construct_emoji_picker_args
|
||||
{
|
||||
char* status_id;
|
||||
unsigned index;
|
||||
};
|
||||
|
||||
char* construct_emoji(struct emoji_info* emoji, char* status_id, int* size)
|
||||
{
|
||||
char* emoji_html;
|
||||
|
||||
size_t s = easprintf(&emoji_html, data_emoji_html, emoji->codes);
|
||||
size_t s = easprintf(&emoji_html, data_emoji_html,
|
||||
status_id, emoji->codes, emoji->codes);
|
||||
|
||||
if (size) *size = s;
|
||||
return emoji_html;
|
||||
|
@ -70,18 +77,31 @@ char* construct_emoji(struct emoji_info* emoji, size_t* size)
|
|||
|
||||
static char* construct_emoji_voidwrap(void* passed, size_t index, int* res)
|
||||
{
|
||||
return construct_emoji((struct emoji_info*)passed + index, 0);
|
||||
struct construct_emoji_picker_args* args = passed;
|
||||
size_t calc_index = index + args->index;
|
||||
return calc_index < 0 || calc_index > emojos_size ? NULL :
|
||||
construct_emoji(emojos + calc_index, args->status_id, res);
|
||||
}
|
||||
|
||||
char* construct_emoji_picker(enum emoji_picker_cat cat, unsigned index, size_t* size)
|
||||
char* construct_emoji_picker(char* status_id, unsigned index, size_t* size)
|
||||
{
|
||||
struct construct_emoji_picker_args args = {
|
||||
.status_id = status_id,
|
||||
.index = index
|
||||
};
|
||||
char* emoji_picker_html;
|
||||
char* emojis;
|
||||
|
||||
emojis = construct_func_strings(construct_emoji_voidwrap, emojos, 8, NULL);
|
||||
emojis = construct_func_strings(construct_emoji_voidwrap, &args, EMOJI_FACTOR_NUM, NULL);
|
||||
|
||||
size_t s = easprintf(&emoji_picker_html, data_emoji_picker_html,
|
||||
emojis);
|
||||
emojis ? emojis : "",
|
||||
status_id,
|
||||
// Index movements
|
||||
index > 0 ? index - EMOJI_FACTOR_NUM : 0,
|
||||
0 > index - EMOJI_FACTOR_NUM ? "disabled" : "",
|
||||
status_id,
|
||||
index + EMOJI_FACTOR_NUM);
|
||||
free(emojis);
|
||||
|
||||
if (size) *size = s;
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
#include <mastodont.h>
|
||||
#include "emoji_codes.h"
|
||||
|
||||
#define EMOJI_FACTOR_NUM 32
|
||||
|
||||
// No use?
|
||||
enum emoji_picker_cat
|
||||
{
|
||||
EMOJI_CAT_CUSTOM,
|
||||
|
@ -29,7 +31,7 @@ enum emoji_picker_cat
|
|||
};
|
||||
|
||||
char* emojify(char* content, struct mstdnt_emoji* emos, size_t emos_len);
|
||||
char* construct_emoji(struct emoji_info* emoji, size_t* size);
|
||||
char* construct_emoji_picker(enum emoji_picker_cat cat, unsigned index, size_t* size);
|
||||
char* construct_emoji(struct emoji_info* emoji, char* status_id, int* size);
|
||||
char* construct_emoji_picker(char* status_id, unsigned index, size_t* size);
|
||||
|
||||
#endif // EMOJI_H
|
||||
|
|
|
@ -3,140 +3,139 @@
|
|||
#define EMOJOS_H
|
||||
#include "emoji_info.h"
|
||||
|
||||
struct emoji_info emojos[] = {
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ NULL, NULL, NULL },
|
||||
#define emojos_size 130
|
||||
|
||||
static struct emoji_info emojos[] = {
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
{ "☺️", "smile", "Smiles" },
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
struct emoji_info
|
||||
{
|
||||
char* codes;
|
||||
char* name;
|
||||
char* group;
|
||||
const char* codes;
|
||||
const char* name;
|
||||
const char* group;
|
||||
};
|
||||
|
||||
#endif /* EMOJI_INFO_H */
|
||||
|
|
|
@ -39,11 +39,13 @@
|
|||
|
||||
struct notification_args
|
||||
{
|
||||
struct session* ssn;
|
||||
mastodont_t* api;
|
||||
struct mstdnt_notification* notifs;
|
||||
};
|
||||
|
||||
char* construct_notification(mastodont_t* api,
|
||||
char* construct_notification(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notif,
|
||||
int* size)
|
||||
{
|
||||
|
@ -53,7 +55,7 @@ char* construct_notification(mastodont_t* api,
|
|||
if (notif->status)
|
||||
{
|
||||
// Construct status with notification_info
|
||||
notif_html = construct_status(api, notif->status, &s, notif, NULL, 0);
|
||||
notif_html = construct_status(ssn, api, notif->status, &s, notif, NULL, 0);
|
||||
}
|
||||
else {
|
||||
notif_html = construct_notification_action(notif, &s);
|
||||
|
@ -82,7 +84,8 @@ char* construct_notification_action(struct mstdnt_notification* notif, int* size
|
|||
return notif_html;
|
||||
}
|
||||
|
||||
char* construct_notification_compact(mastodont_t* api,
|
||||
char* construct_notification_compact(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notif,
|
||||
int* size)
|
||||
{
|
||||
|
@ -132,33 +135,37 @@ char* construct_notification_compact(mastodont_t* api,
|
|||
static char* construct_notification_voidwrap(void* passed, size_t index, int* res)
|
||||
{
|
||||
struct notification_args* args = passed;
|
||||
return construct_notification(args->api, args->notifs + index, res);
|
||||
return construct_notification(args->ssn, args->api, args->notifs + index, res);
|
||||
}
|
||||
|
||||
static char* construct_notification_compact_voidwrap(void* passed, size_t index, int* res)
|
||||
{
|
||||
struct notification_args* args = passed;
|
||||
return construct_notification_compact(args->api, args->notifs + index, res);
|
||||
return construct_notification_compact(args->ssn, args->api, args->notifs + index, res);
|
||||
}
|
||||
|
||||
char* construct_notifications(mastodont_t* api,
|
||||
char* construct_notifications(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notifs,
|
||||
size_t size,
|
||||
size_t* ret_size)
|
||||
{
|
||||
struct notification_args args = {
|
||||
.ssn = ssn,
|
||||
.api = api,
|
||||
.notifs = notifs
|
||||
};
|
||||
return construct_func_strings(construct_notification_voidwrap, &args, size, ret_size);
|
||||
}
|
||||
|
||||
char* construct_notifications_compact(mastodont_t* api,
|
||||
char* construct_notifications_compact(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notifs,
|
||||
size_t size,
|
||||
size_t* ret_size)
|
||||
{
|
||||
struct notification_args args = {
|
||||
.ssn = ssn,
|
||||
.api = api,
|
||||
.notifs = notifs
|
||||
};
|
||||
|
@ -194,7 +201,7 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data)
|
|||
|
||||
if (mastodont_get_notifications(api, &args, &storage, ¬ifs, ¬ifs_len) == 0)
|
||||
{
|
||||
notif_html = construct_notifications(api, notifs, notifs_len, NULL);
|
||||
notif_html = construct_notifications(ssn, api, notifs, notifs_len, NULL);
|
||||
start_id = ssn->post.start_id ? ssn->post.start_id : notifs[0].id;
|
||||
navigation_box = construct_navigation_box(start_id,
|
||||
notifs[0].id,
|
||||
|
|
|
@ -22,18 +22,22 @@
|
|||
#include "session.h"
|
||||
#include "type_string.h"
|
||||
|
||||
char* construct_notification(mastodont_t* api,
|
||||
char* construct_notification(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notif,
|
||||
int* size);
|
||||
char* construct_notification_action(struct mstdnt_notification* notif, int* size);
|
||||
char* construct_notification_compact(mastodont_t* api,
|
||||
char* construct_notification_compact(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notif,
|
||||
int* size);
|
||||
char* construct_notifications(mastodont_t* api,
|
||||
char* construct_notifications(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notifs,
|
||||
size_t size,
|
||||
size_t* ret_size);
|
||||
char* construct_notifications_compact(mastodont_t* api,
|
||||
char* construct_notifications_compact(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_notification* notifs,
|
||||
size_t size,
|
||||
size_t* ret_size);
|
||||
|
|
|
@ -116,6 +116,7 @@ char* read_post_data(struct query_values* post)
|
|||
{ "start_id", &(post->start_id), key_string },
|
||||
{ "instance", &(post->instance), key_string },
|
||||
{ "visibility", &(post->visibility), key_string },
|
||||
{ "emojoindex", &(post->emojoindex), key_int },
|
||||
{ "file", &(post->files), key_files }
|
||||
};
|
||||
// END Query references
|
||||
|
|
|
@ -59,6 +59,7 @@ struct query_values
|
|||
char* replyid;
|
||||
char* visibility;
|
||||
char* instance;
|
||||
int emojoindex;
|
||||
|
||||
// Navigation
|
||||
char* min_id;
|
||||
|
|
|
@ -89,7 +89,7 @@ void content_search_statuses(struct session* ssn, mastodont_t* api, char** data)
|
|||
struct construct_statuses_args statuses_args = {
|
||||
.highlight_word = ssn->query.query,
|
||||
};
|
||||
statuses_html = construct_statuses(api, results.statuses, results.statuses_len, &statuses_args, NULL);
|
||||
statuses_html = construct_statuses(ssn, api, results.statuses, results.statuses_len, &statuses_args, NULL);
|
||||
if (!statuses_html)
|
||||
statuses_html = construct_error("No statuses", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
|
25
src/status.c
25
src/status.c
|
@ -51,6 +51,7 @@ struct status_args
|
|||
mastodont_t* api;
|
||||
struct mstdnt_status* status;
|
||||
struct construct_statuses_args* args;
|
||||
struct session* ssn;
|
||||
};
|
||||
|
||||
int try_post_status(struct session* ssn, mastodont_t* api)
|
||||
|
@ -105,7 +106,7 @@ int try_react_status(struct session* ssn, mastodont_t* api, char* id, char* emoj
|
|||
|
||||
mstdnt_cleanup_status(&status);
|
||||
mastodont_storage_cleanup(&storage);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void content_status_create(struct session* ssn, mastodont_t* api, char** data)
|
||||
|
@ -366,7 +367,8 @@ char* greentextify(char* content)
|
|||
return res;
|
||||
}
|
||||
|
||||
char* construct_status(mastodont_t* api,
|
||||
char* construct_status(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_status* local_status,
|
||||
int* size,
|
||||
struct mstdnt_notification* local_notif,
|
||||
|
@ -402,7 +404,7 @@ char* construct_status(mastodont_t* api,
|
|||
// Emojo picker
|
||||
if ((flags & STATUS_EMOJI_PICKER) == STATUS_EMOJI_PICKER)
|
||||
{
|
||||
emoji_picker_html = construct_emoji_picker(EMOJI_CAT_FACES, 0, NULL);
|
||||
emoji_picker_html = construct_emoji_picker(status->id, ssn->post.emojoindex, NULL);
|
||||
}
|
||||
|
||||
// If focused, show status interactions
|
||||
|
@ -526,10 +528,11 @@ char* construct_status(mastodont_t* api,
|
|||
status->id,
|
||||
config_url_prefix,
|
||||
status->id,
|
||||
status->id,
|
||||
emoji_picker_html ? emoji_picker_html : "",
|
||||
config_url_prefix,
|
||||
status->id,
|
||||
status->id,
|
||||
emoji_picker_html);
|
||||
status->id);
|
||||
|
||||
if (size) *size = s;
|
||||
// Cleanup
|
||||
|
@ -549,10 +552,11 @@ char* construct_status(mastodont_t* api,
|
|||
static char* construct_status_voidwrap(void* passed, size_t index, int* res)
|
||||
{
|
||||
struct status_args* args = passed;
|
||||
return construct_status(args->api, args->status + index, res, NULL, args->args, 0);
|
||||
return construct_status(args->ssn, args->api, args->status + index, res, NULL, args->args, 0);
|
||||
}
|
||||
|
||||
char* construct_statuses(mastodont_t* api,
|
||||
char* construct_statuses(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_status* statuses,
|
||||
size_t size,
|
||||
struct construct_statuses_args* args,
|
||||
|
@ -563,6 +567,7 @@ char* construct_statuses(mastodont_t* api,
|
|||
.api = api,
|
||||
.status = statuses,
|
||||
.args = args,
|
||||
.ssn = ssn,
|
||||
};
|
||||
return construct_func_strings(construct_status_voidwrap, &stat_args, size, ret_size);
|
||||
}
|
||||
|
@ -617,10 +622,10 @@ void content_status(struct session* ssn, mastodont_t* api, char** data, uint8_t
|
|||
stat_html = construct_error("Status not found", E_ERROR, 1, NULL);
|
||||
}
|
||||
else {
|
||||
before_html = construct_statuses(api, statuses_before, stat_before_len, NULL, 0);
|
||||
before_html = construct_statuses(ssn, api, statuses_before, stat_before_len, NULL, 0);
|
||||
|
||||
// Current status
|
||||
stat_html = construct_status(api, &status, NULL, NULL, NULL, flags);
|
||||
stat_html = construct_status(ssn, api, &status, NULL, NULL, NULL, flags);
|
||||
if ((flags & STATUS_REPLY) == STATUS_REPLY)
|
||||
{
|
||||
stat_reply = reply_status(data[0],
|
||||
|
@ -629,7 +634,7 @@ void content_status(struct session* ssn, mastodont_t* api, char** data, uint8_t
|
|||
}
|
||||
|
||||
// After...
|
||||
after_html = construct_statuses(api, statuses_after, stat_after_len, NULL, 0);
|
||||
after_html = construct_statuses(ssn, api, statuses_after, stat_after_len, NULL, 0);
|
||||
|
||||
easprintf(&output, "%s%s%s%s",
|
||||
before_html ? before_html : "",
|
||||
|
|
|
@ -50,13 +50,15 @@ void content_status_react(struct session* ssn, mastodont_t* api, char** data);
|
|||
char* construct_post_box(char* reply_id,
|
||||
char* default_content,
|
||||
int* size);
|
||||
char* construct_status(mastodont_t* api,
|
||||
char* construct_status(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_status* status,
|
||||
int* size,
|
||||
struct mstdnt_notification* notif,
|
||||
struct construct_statuses_args* args,
|
||||
uint8_t flags);
|
||||
char* construct_statuses(mastodont_t* api,
|
||||
char* construct_statuses(struct session* ssn,
|
||||
mastodont_t* api,
|
||||
struct mstdnt_status* statuses,
|
||||
size_t size,
|
||||
struct construct_statuses_args* args,
|
||||
|
|
|
@ -62,7 +62,7 @@ void tl_home(struct session* ssn, mastodont_t* api, int local)
|
|||
}
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(api, statuses, status_count, NULL, &statuses_html_count);
|
||||
status_format = construct_statuses(ssn, api, statuses, status_count, NULL, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = construct_error("Couldn't load posts", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void tl_direct(struct session* ssn, mastodont_t* api)
|
|||
}
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(api, statuses, status_count, NULL, &statuses_html_count);
|
||||
status_format = construct_statuses(ssn, api, statuses, status_count, NULL, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = construct_error("Couldn't load posts", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ void tl_public(struct session* ssn, mastodont_t* api, int local, enum base_categ
|
|||
}
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(api, statuses, status_count, NULL, &statuses_html_count);
|
||||
status_format = construct_statuses(ssn, api, statuses, status_count, NULL, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = construct_error("Couldn't load posts", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ void tl_list(struct session* ssn, mastodont_t* api, char* list_id)
|
|||
}
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(api, statuses, status_count, NULL, &statuses_html_count);
|
||||
status_format = construct_statuses(ssn, api, statuses, status_count, NULL, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = construct_error("No statuses", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ void tl_tag(struct session* ssn, mastodont_t* api, char* tag_id)
|
|||
status_format = construct_error(storage.error, E_ERROR, 1, NULL);
|
||||
else {
|
||||
// Construct statuses into HTML
|
||||
status_format = construct_statuses(api, statuses, status_count, NULL, &statuses_html_count);
|
||||
status_format = construct_statuses(ssn, api, statuses, status_count, NULL, &statuses_html_count);
|
||||
if (!status_format)
|
||||
status_format = construct_error("No statuses", E_ERROR, 1, NULL);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
<span class="emoji">%s</span>
|
||||
<a href="/status/%s/react/%s" class="emoji">%s</a>
|
||||
|
|
|
@ -1,3 +1,28 @@
|
|||
<div class="emoji-picker">
|
||||
%s
|
||||
<div class="emoji-picker-emojos">
|
||||
%s
|
||||
</div>
|
||||
|
||||
<table class="navigation ui-table">
|
||||
<tr>
|
||||
<td class="nav-prev btn">
|
||||
<form action="#id-%s" method="post">
|
||||
<label class="pointer">
|
||||
<input type="hidden" name="emojoindex" value="%u">
|
||||
<span class="nav-btn %s">Previous</span>
|
||||
<input type="submit" class="hidden">
|
||||
</label>
|
||||
</form>
|
||||
</td>
|
||||
<td class="nav-next btn">
|
||||
<form action="#id-%s" method="post">
|
||||
<label class="pointer">
|
||||
<input type="hidden" name="emojoindex" value="%u">
|
||||
<span class="nav-btn">Next</span>
|
||||
<input type="submit" class="hidden">
|
||||
</label>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -86,12 +86,13 @@
|
|||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form action="%s/status/%s/react" method="post">
|
||||
<form action="%s/status/%s/react#id-%s" method="post">
|
||||
<label class="pointer">
|
||||
<svg class="emoji-btn" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="8" y1="12" x2="16" y2="12"></line></svg>
|
||||
<input class="hidden" type="submit" value="Emoji">
|
||||
</label>
|
||||
</form>
|
||||
%s
|
||||
</td>
|
||||
<td>
|
||||
<form action="%s/status/%s#id-%s" method="post">
|
||||
|
@ -110,4 +111,3 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
%s
|
||||
|
|
Loading…
Reference in a new issue