about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-10 01:44:32 +0000
committerJames Booth <boothj5@gmail.com>2014-12-10 01:44:32 +0000
commit706f31422dc73fff68c2955ec7e830943a5143e2 (patch)
treeada79673c0e450cca5d81897429e9a79939446ed /src/ui
parent12d0d22ab325aafc38e094f16f76ddf3408da181 (diff)
downloadprofani-tty-706f31422dc73fff68c2955ec7e830943a5143e2.tar.gz
Moved chat resource to WIN_CHAT type
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c2
-rw-r--r--src/ui/titlebar.c8
-rw-r--r--src/ui/window.c8
-rw-r--r--src/ui/window.h2
4 files changed, 11 insertions, 9 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index f8f564fc..c62d6b4d 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -888,7 +888,7 @@ _ui_gone_secure(const char * const recipient, gboolean trusted)
         return;
     }
 
-    FREE_SET_NULL(window->chat_resource);
+    FREE_SET_NULL(window->wins.chat.chat_resource);
 
     window->wins.chat.is_otr = TRUE;
     window->wins.chat.is_trusted = trusted;
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index cb593b4b..5c11c346 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -324,21 +324,21 @@ _show_contact_presence(void)
     int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
 
     ProfWin *current = wins_get_current();
-    if (current && current->chat_resource) {
+    if (current && current->wins.chat.chat_resource) {
         wprintw(win, "/");
-        wprintw(win, current->chat_resource);
+        wprintw(win, current->wins.chat.chat_resource);
     }
 
     if (prefs_get_boolean(PREF_PRESENCE)) {
         theme_item_t presence_colour = THEME_TITLE_OFFLINE;
         const char *presence = "offline";
 
-        if (current && current->chat_resource) {
+        if (current && current->wins.chat.chat_resource) {
             char *barejid = roster_barejid_from_name(current_recipient);
             if (barejid) {
                 PContact contact = roster_get_contact(barejid);
                 if (contact) {
-                    Resource *resource = p_contact_get_resource(contact, current->chat_resource);
+                    Resource *resource = p_contact_get_resource(contact, current->wins.chat.chat_resource);
                     if (resource) {
                         presence = string_from_resource_presence(resource->presence);
                     }
diff --git a/src/ui/window.c b/src/ui/window.c
index 89fde6c3..56225b67 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -122,10 +122,9 @@ win_create(const char * const title, win_type_t type)
     if (new_win->type == WIN_CHAT) {
         new_win->wins.chat.is_otr = FALSE;
         new_win->wins.chat.is_trusted = FALSE;
+        new_win->wins.chat.chat_resource = NULL;
     }
 
-    new_win->chat_resource = NULL;
-
     scrollok(new_win->win, TRUE);
 
     return new_win;
@@ -223,7 +222,10 @@ win_free(ProfWin* window)
         break;
     }
 
-    free(window->chat_resource);
+    if (window->type == WIN_CHAT) {
+        free(window->wins.chat.chat_resource);
+    }
+
     free(window->from);
 
     if (window->type == WIN_MUC_CONFIG) {
diff --git a/src/ui/window.h b/src/ui/window.h
index c74b7cae..f613c72a 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -71,7 +71,6 @@ typedef struct prof_win_t {
     WINDOW *win;
     ProfBuff buffer;
     char *from;
-    char *chat_resource;
     int y_pos;
     int paged;
     int unread;
@@ -87,6 +86,7 @@ typedef struct prof_win_t {
         struct {
             gboolean is_otr;
             gboolean is_trusted;
+            char *chat_resource;
         } chat;
 
         // WIN_MUC
325 326 327 328 329 330 331 332 333 334 335 336 337 338 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 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566