comparison mcabber/src/screen.c @ 1154:f746d91c5d3b

Rearranged duplicated code in screen.c
author franky@teufel.fs
date Tue, 13 Feb 2007 21:48:17 +0100
parents 0e27177882c7
children cae430fcd385
comparison
equal deleted inserted replaced
1153:4e307d19427e 1154:f746d91c5d3b
566 } 566 }
567 } 567 }
568 g_free(lines); 568 g_free(lines);
569 } 569 }
570 570
571 static winbuf * scr_CreateWindow(const char *winId, int special, int dont_show)
572 {
573 if (special) {
574 if (!statusWindow) {
575 statusWindow = scr_new_buddy(NULL, dont_show);
576 statusWindow->hbuf = statushbuf;
577 }
578 return statusWindow;
579 } else {
580 return scr_new_buddy(winId, dont_show);
581 }
582 }
583
571 // scr_ShowWindow() 584 // scr_ShowWindow()
572 // Display the chat window with the given identifier. 585 // Display the chat window with the given identifier.
573 // "special" must be true if this is a special buffer window. 586 // "special" must be true if this is a special buffer window.
574 static void scr_ShowWindow(const char *winId, int special) 587 static void scr_ShowWindow(const char *winId, int special)
575 { 588 {
576 winbuf *win_entry; 589 winbuf *win_entry;
577 590
578 win_entry = scr_SearchWindow(winId, special); 591 win_entry = scr_SearchWindow(winId, special);
579 592
580 if (!win_entry) { 593 if (!win_entry) {
581 if (special) { 594 win_entry = scr_CreateWindow(winId, special, FALSE);
582 if (!statusWindow) {
583 statusWindow = scr_new_buddy(NULL, FALSE);
584 statusWindow->hbuf = statushbuf;
585 }
586 win_entry = statusWindow;
587 } else {
588 win_entry = scr_new_buddy(winId, FALSE);
589 }
590 } 595 }
591 596
592 top_panel(win_entry->panel); 597 top_panel(win_entry->panel);
593 currentWindow = win_entry; 598 currentWindow = win_entry;
594 chatmode = TRUE; 599 chatmode = TRUE;
673 else if ((!force_show) && ((!currentWindow || (currentWindow != win_entry)))) 678 else if ((!force_show) && ((!currentWindow || (currentWindow != win_entry))))
674 dont_show = TRUE; 679 dont_show = TRUE;
675 680
676 // If the window entry doesn't exist yet, let's create it. 681 // If the window entry doesn't exist yet, let's create it.
677 if (!win_entry) { 682 if (!win_entry) {
678 if (special) { 683 win_entry = scr_CreateWindow(winId, special, dont_show);
679 if (!statusWindow) {
680 statusWindow = scr_new_buddy(NULL, dont_show);
681 statusWindow->hbuf = statushbuf;
682 }
683 win_entry = statusWindow;
684 } else {
685 win_entry = scr_new_buddy(winId, dont_show);
686 }
687 } 684 }
688 685
689 // The message must be displayed -> update top pointer 686 // The message must be displayed -> update top pointer
690 if (win_entry->cleared) 687 if (win_entry->cleared)
691 win_entry->top = g_list_last(win_entry->hbuf); 688 win_entry->top = g_list_last(win_entry->hbuf);