From 7fe6e93058f0e9253e2a79d7fc2d7a136784f791 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 15 Mar 2013 16:26:10 +0000 Subject: various popup related code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4056 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/popups.cpp | 49 ++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 29 deletions(-) (limited to 'protocols/Gadu-Gadu/src/popups.cpp') diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index 69ac1c350d..386435c973 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -110,8 +110,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) PopupData* puData = (PopupData*)dwParam; GGPROTO* gg = puData->gg; - if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) - { + if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { char szName[256]; POPUPDATACLASS ppd = {sizeof(ppd)}; ppd.ptszTitle = puData->title; @@ -125,46 +124,38 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) mir_snprintf(szName, SIZEOF(szName), "%s_%s", gg->m_szModuleName, "Notify"); CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + return; } - else - { - if (puData->flags & GG_POPUP_ALLOW_MSGBOX) - { - BOOL bShow = TRUE; - if (puData->flags & GG_POPUP_ONCE) - { - HWND hWnd = FindWindow(NULL, gg->m_tszUserName); - while (hWnd != NULL) - { - if (FindWindowEx(hWnd, NULL, NULL, puData->text) != NULL) - { - bShow = FALSE; - break; - } - hWnd = FindWindowEx(NULL, hWnd, NULL, gg->m_tszUserName); + if (puData->flags & GG_POPUP_ALLOW_MSGBOX) { + BOOL bShow = TRUE; + + if (puData->flags & GG_POPUP_ONCE) { + HWND hWnd = FindWindow(NULL, gg->m_tszUserName); + while (hWnd != NULL) { + if (FindWindowEx(hWnd, NULL, NULL, puData->text) != NULL) { + bShow = FALSE; + break; } + hWnd = FindWindowEx(NULL, hWnd, NULL, gg->m_tszUserName); } + } - if (bShow) - { - UINT uIcon = puData->flags & GG_POPUP_ERROR ? MB_ICONERROR : puData->flags & GG_POPUP_WARNING ? MB_ICONEXCLAMATION : MB_ICONINFORMATION; - MessageBox(NULL, puData->text, gg->m_tszUserName, MB_OK | uIcon); - } + if (bShow) { + UINT uIcon = puData->flags & GG_POPUP_ERROR ? MB_ICONERROR : puData->flags & GG_POPUP_WARNING ? MB_ICONEXCLAMATION : MB_ICONINFORMATION; + MessageBox(NULL, puData->text, gg->m_tszUserName, MB_OK | uIcon); } - mir_free(puData->title); - mir_free(puData->text); - mir_free(puData); } + mir_free(puData->title); + mir_free(puData->text); + mir_free(puData); } void GGPROTO::showpopup(const TCHAR* nickname, const TCHAR* msg, int flags) { - PopupData* puData; - if (Miranda_Terminated()) return; - puData = (PopupData*)mir_alloc(sizeof(PopupData)); + PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData)); puData->flags = flags; puData->title = mir_tstrdup(nickname); puData->text = mir_tstrdup(msg); -- cgit v1.2.3