# HG changeset patch # User franky@teufel.fs # Date 1171399697 -3600 # Node ID f746d91c5d3b4b7764c8ca7d1e1af8260b9673aa # Parent 4e307d19427e94d08dc25586e5e68e4b8490a735 Rearranged duplicated code in screen.c diff -r 4e307d19427e -r f746d91c5d3b mcabber/src/screen.c --- a/mcabber/src/screen.c Mon Feb 12 22:19:02 2007 +0100 +++ b/mcabber/src/screen.c Tue Feb 13 21:48:17 2007 +0100 @@ -568,6 +568,19 @@ g_free(lines); } +static winbuf * scr_CreateWindow(const char *winId, int special, int dont_show) +{ + if (special) { + if (!statusWindow) { + statusWindow = scr_new_buddy(NULL, dont_show); + statusWindow->hbuf = statushbuf; + } + return statusWindow; + } else { + return scr_new_buddy(winId, dont_show); + } +} + // scr_ShowWindow() // Display the chat window with the given identifier. // "special" must be true if this is a special buffer window. @@ -578,15 +591,7 @@ win_entry = scr_SearchWindow(winId, special); if (!win_entry) { - if (special) { - if (!statusWindow) { - statusWindow = scr_new_buddy(NULL, FALSE); - statusWindow->hbuf = statushbuf; - } - win_entry = statusWindow; - } else { - win_entry = scr_new_buddy(winId, FALSE); - } + win_entry = scr_CreateWindow(winId, special, FALSE); } top_panel(win_entry->panel); @@ -675,15 +680,7 @@ // If the window entry doesn't exist yet, let's create it. if (!win_entry) { - if (special) { - if (!statusWindow) { - statusWindow = scr_new_buddy(NULL, dont_show); - statusWindow->hbuf = statushbuf; - } - win_entry = statusWindow; - } else { - win_entry = scr_new_buddy(winId, dont_show); - } + win_entry = scr_CreateWindow(winId, special, dont_show); } // The message must be displayed -> update top pointer