mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Rename buffer functions
This commit is contained in:
parent
7e6e6296f1
commit
651541d7ec
@ -79,7 +79,7 @@ buffer_free(ProfBuff buffer)
|
||||
}
|
||||
|
||||
void
|
||||
buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time,
|
||||
buffer_append(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time,
|
||||
int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt)
|
||||
{
|
||||
ProfBuffEntry *e = malloc(sizeof(struct prof_buff_entry_t));
|
||||
@ -119,14 +119,14 @@ buffer_mark_received(ProfBuff buffer, const char *const id)
|
||||
}
|
||||
|
||||
ProfBuffEntry*
|
||||
buffer_yield_entry(ProfBuff buffer, int entry)
|
||||
buffer_get_entry(ProfBuff buffer, int entry)
|
||||
{
|
||||
GSList *node = g_slist_nth(buffer->entries, entry);
|
||||
return node->data;
|
||||
}
|
||||
|
||||
ProfBuffEntry*
|
||||
buffer_yield_entry_by_id(ProfBuff buffer, const char *const id)
|
||||
buffer_get_entry_by_id(ProfBuff buffer, const char *const id)
|
||||
{
|
||||
GSList *entries = buffer->entries;
|
||||
while (entries) {
|
||||
|
@ -60,11 +60,11 @@ typedef struct prof_buff_t *ProfBuff;
|
||||
|
||||
ProfBuff buffer_create();
|
||||
void buffer_free(ProfBuff buffer);
|
||||
void buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item,
|
||||
void buffer_append(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item,
|
||||
const char *const from, const char *const message, DeliveryReceipt *receipt);
|
||||
int buffer_size(ProfBuff buffer);
|
||||
ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry);
|
||||
ProfBuffEntry* buffer_yield_entry_by_id(ProfBuff buffer, const char *const id);
|
||||
ProfBuffEntry* buffer_get_entry(ProfBuff buffer, int entry);
|
||||
ProfBuffEntry* buffer_get_entry_by_id(ProfBuff buffer, const char *const id);
|
||||
gboolean buffer_mark_received(ProfBuff buffer, const char *const id);
|
||||
|
||||
#endif
|
||||
|
@ -1026,7 +1026,7 @@ win_println_them_message(ProfWin *window, const char *const them, const char *co
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', 0, timestamp, NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', 0, timestamp, NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1046,7 +1046,7 @@ win_println_me_message(ProfWin *window, const char *const me, const char *const
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1066,7 +1066,7 @@ win_print_outgoing(ProfWin *window, const char ch, const char *const message, ..
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1086,7 +1086,7 @@ win_print_history(ProfWin *window, GDateTime *timestamp, const char *const messa
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', 0, timestamp, NO_COLOUR_DATE, THEME_DEFAULT, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_COLOUR_DATE, THEME_DEFAULT, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', 0, timestamp, NO_COLOUR_DATE, THEME_DEFAULT, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1106,7 +1106,7 @@ win_print(ProfWin *window, theme_item_t theme_item, const char ch, const char *c
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, ch, 0, timestamp, NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, ch, 0, timestamp, NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, ch, 0, timestamp, NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1126,7 +1126,7 @@ win_println(ProfWin *window, theme_item_t theme_item, const char ch, const char
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, ch, 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, ch, 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, ch, 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1146,7 +1146,7 @@ win_println_indent(ProfWin *window, int pad, const char *const message, ...)
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', pad, timestamp, 0, THEME_DEFAULT, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', pad, timestamp, 0, THEME_DEFAULT, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', pad, timestamp, 0, THEME_DEFAULT, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1166,7 +1166,7 @@ win_append(ProfWin *window, theme_item_t theme_item, const char *const message,
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', 0, timestamp, NO_DATE | NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1186,7 +1186,7 @@ win_appendln(ProfWin *window, theme_item_t theme_item, const char *const message
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', 0, timestamp, NO_DATE, theme_item, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE, theme_item, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', 0, timestamp, NO_DATE, theme_item, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1206,7 +1206,7 @@ win_append_highlight(ProfWin *window, theme_item_t theme_item, const char *const
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_ME | NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_ME | NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', 0, timestamp, NO_DATE | NO_ME | NO_EOL, theme_item, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1226,7 +1226,7 @@ win_appendln_highlight(ProfWin *window, theme_item_t theme_item, const char *con
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_ME, theme_item, "", fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, '-', 0, timestamp, NO_DATE | NO_ME, theme_item, "", fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, '-', 0, timestamp, NO_DATE | NO_ME, theme_item, "", fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1252,7 +1252,7 @@ win_print_with_receipt(ProfWin *window, const char show_char, const char *const
|
||||
receipt->id = strdup(id);
|
||||
receipt->received = FALSE;
|
||||
|
||||
buffer_push(window->layout->buffer, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt);
|
||||
buffer_append(window->layout->buffer, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt);
|
||||
_win_print(window, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt);
|
||||
// TODO: cross-reference.. this should be replaced by a real event-based system
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1271,7 +1271,7 @@ win_mark_received(ProfWin *window, const char *const id)
|
||||
void
|
||||
win_update_entry_message(ProfWin *window, const char *const id, const char *const message)
|
||||
{
|
||||
ProfBuffEntry *entry = buffer_yield_entry_by_id(window->layout->buffer, id);
|
||||
ProfBuffEntry *entry = buffer_get_entry_by_id(window->layout->buffer, id);
|
||||
if (entry) {
|
||||
free(entry->message);
|
||||
entry->message = strdup(message);
|
||||
@ -1282,7 +1282,7 @@ win_update_entry_message(ProfWin *window, const char *const id, const char *cons
|
||||
void
|
||||
win_update_entry_theme(ProfWin *window, const char *const id, theme_item_t theme_item)
|
||||
{
|
||||
ProfBuffEntry *entry = buffer_yield_entry_by_id(window->layout->buffer, id);
|
||||
ProfBuffEntry *entry = buffer_get_entry_by_id(window->layout->buffer, id);
|
||||
if (entry) {
|
||||
entry->theme_item = theme_item;
|
||||
win_redraw(window);
|
||||
@ -1310,7 +1310,7 @@ _win_printf(ProfWin *window, const char show_char, int pad_indent, GDateTime *ti
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, message, arg);
|
||||
|
||||
buffer_push(window->layout->buffer, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str, NULL);
|
||||
buffer_append(window->layout->buffer, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str, NULL);
|
||||
|
||||
_win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str, NULL);
|
||||
inp_nonblocking(TRUE);
|
||||
@ -1576,7 +1576,7 @@ win_redraw(ProfWin *window)
|
||||
size = buffer_size(window->layout->buffer);
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
ProfBuffEntry *e = buffer_yield_entry(window->layout->buffer, i);
|
||||
ProfBuffEntry *e = buffer_get_entry(window->layout->buffer, i);
|
||||
_win_print(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user