about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-13 15:55:10 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-14 10:17:07 +0100
commitfcfb493dfb32dfd6aad864e4c6f8e775845c5d25 (patch)
tree7611e24811ede115f5850958d972cbfb3b79099f
parente27c414f1f22f8905ff2586a39ba91ff2ea23cb8 (diff)
downloadprofani-tty-fcfb493dfb32dfd6aad864e4c6f8e775845c5d25.tar.gz
Rename buffer->from to buffer->display_from
-rw-r--r--src/ui/buffer.c6
-rw-r--r--src/ui/buffer.h6
-rw-r--r--src/ui/window.c10
3 files changed, 12 insertions, 10 deletions
diff --git a/src/ui/buffer.c b/src/ui/buffer.c
index 5ff05d2f..86f87563 100644
--- a/src/ui/buffer.c
+++ b/src/ui/buffer.c
@@ -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);
diff --git a/src/ui/buffer.h b/src/ui/buffer.h
index 4704ae7c..813ac38e 100644
--- a/src/ui/buffer.h
+++ b/src/ui/buffer.h
@@ -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);
diff --git a/src/ui/window.c b/src/ui/window.c
index 4f6ceb2e..a1c71241 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -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);
         }
     }
 }
'>339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446