1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Rename buffer->from to buffer->display_from

This commit is contained in:
Michael Vetter 2020-02-13 15:55:10 +01:00
parent e27c414f1f
commit fcfb493dfb
3 changed files with 12 additions and 10 deletions

View File

@ -82,7 +82,7 @@ buffer_free(ProfBuff buffer)
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, const char *const id)
int flags, theme_item_t theme_item, const char *const display_from, const char *const message, DeliveryReceipt *receipt, const char *const id)
{
ProfBuffEntry *e = malloc(sizeof(struct prof_buff_entry_t));
e->show_char = show_char;
@ -90,7 +90,7 @@ buffer_append(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *
e->flags = flags;
e->theme_item = theme_item;
e->time = g_date_time_ref(time);
e->from = from ? strdup(from) : NULL;
e->display_from = display_from ? strdup(display_from) : NULL;
e->message = strdup(message);
e->receipt = receipt;
if (id) {
@ -164,7 +164,7 @@ static void
_free_entry(ProfBuffEntry *entry)
{
free(entry->message);
free(entry->from);
free(entry->display_from);
free(entry->id);
free(entry->receipt);
g_date_time_unref(entry->time);

View File

@ -52,7 +52,9 @@ typedef struct prof_buff_entry_t {
GDateTime *time;
int flags;
theme_item_t theme_item;
char *from;
// from as it is displayed
// might be nick, jid..
char *display_from;
char *message;
DeliveryReceipt *receipt;
// message id, in case we have it
@ -64,7 +66,7 @@ typedef struct prof_buff_t *ProfBuff;
ProfBuff buffer_create();
void buffer_free(ProfBuff buffer);
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, const char *const id);
int flags, theme_item_t theme_item, const char *const display_from, const char *const message, DeliveryReceipt *receipt, const char *const id);
void buffer_remove_entry_by_id(ProfBuff buffer, const char *const id);
int buffer_size(ProfBuff buffer);
ProfBuffEntry* buffer_get_entry(ProfBuff buffer, int entry);

View File

@ -1098,7 +1098,7 @@ _win_correct(ProfWin *window, const char *const message, const char *const id, c
}
void
win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message)
win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMessage *message)
{
char enc_char = '-';
int flags = NO_ME;
@ -1125,12 +1125,12 @@ win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message
if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && message->replace_id) {
_win_correct(window, message->plain, message->id, message->replace_id);
} else {
_win_printf(window, enc_char, 0, message->timestamp, flags, THEME_TEXT_THEM, from, message->id, "%s", message->plain);
_win_printf(window, enc_char, 0, message->timestamp, flags, THEME_TEXT_THEM, display_name_from, message->id, "%s", message->plain);
}
break;
}
case WIN_PRIVATE:
_win_printf(window, '-', 0, message->timestamp, flags, THEME_TEXT_THEM, from, message->id, "%s", message->plain);
_win_printf(window, '-', 0, message->timestamp, flags, THEME_TEXT_THEM, display_name_from, message->id, "%s", message->plain);
break;
default:
assert(FALSE);
@ -1743,12 +1743,12 @@ win_redraw(ProfWin *window)
for (i = 0; i < size; i++) {
ProfBuffEntry *e = buffer_get_entry(window->layout->buffer, i);
if (e->from == NULL && e->message && e->message[0] == '-') {
if (e->display_from == NULL && e->message && e->message[0] == '-') {
// just an indicator to print the separator not the actual message
win_print_separator(window);
} else {
// regular thing to print
_win_print_internal(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt);
_win_print_internal(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->display_from, e->message, e->receipt);
}
}
}