diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-15 16:26:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-15 16:26:10 +0000 |
commit | 7fe6e93058f0e9253e2a79d7fc2d7a136784f791 (patch) | |
tree | 861225801bcda335939cac2fa6ddc6083f52f51f /protocols/Gadu-Gadu | |
parent | 21e84e8d5012cc0b600f27a4d796d3813b29a16c (diff) |
various popup related code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4056 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r-- | protocols/Gadu-Gadu/src/popups.cpp | 49 |
1 files changed, 20 insertions, 29 deletions
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);
|