summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
commitd9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 (patch)
treef09baaf9b91477d009cedc5bd77449b0fa3e3af7 /protocols/Gadu-Gadu
parent8a1ff32e54b39ceef22df61bda17bbfda94918fc (diff)
Popup:
- wiping out checks for service presence; - code cleaning
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp29
-rw-r--r--protocols/Gadu-Gadu/src/popups.cpp57
2 files changed, 28 insertions, 58 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 9176da06e7..4807733917 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -949,22 +949,19 @@ retry:
}
gg_LeaveCriticalSection(&sessions_mutex, "mainthread", 19, 1, "sessions_mutex", 1);
sessions_updatedlg();
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
- {
- const wchar_t* szText = time(0) - logonTime > 3
- ? TranslateT("You have logged in at another location")
- : TranslateT("You are logged in at another location");
- for (i = 0; i < e->event.multilogon_info.count; i++)
- {
- wchar_t szMsg[MAX_SECONDLINE];
- if (iIndexes && iIndexes[i])
- continue;
-
- mir_snwprintf(szMsg, L"%s (%s)", szText,
- *e->event.multilogon_info.sessions[i].name != '\0' ?
- _A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
- showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
- }
+
+ const wchar_t* szText = time(0) - logonTime > 3
+ ? TranslateT("You have logged in at another location")
+ : TranslateT("You are logged in at another location");
+ for (i = 0; i < e->event.multilogon_info.count; i++) {
+ wchar_t szMsg[MAX_SECONDLINE];
+ if (iIndexes && iIndexes[i])
+ continue;
+
+ mir_snwprintf(szMsg, L"%s (%s)", szText,
+ *e->event.multilogon_info.sessions[i].name != '\0' ?
+ _A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
+ showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
}
mir_free(iIndexes);
}
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp
index dd9c32d105..962c570002 100644
--- a/protocols/Gadu-Gadu/src/popups.cpp
+++ b/protocols/Gadu-Gadu/src/popups.cpp
@@ -105,48 +105,21 @@ void GaduProto::initpopups()
//
void CALLBACK sttMainThreadCallback(PVOID dwParam)
{
- PopupData* puData = (PopupData*)dwParam;
- GaduProto* gg = puData->gg;
-
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- char szName[256];
- POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = puData->title;
- ppd.pwszText = puData->text;
- ppd.PluginData = puData;
- ppd.pszClassName = szName;
-
- if (puData->flags & GG_POPUP_ERROR || puData->flags & GG_POPUP_WARNING)
- mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Error");
- else
- mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Notify");
-
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
- return;
- }
-
- if (puData->flags & GG_POPUP_ALLOW_MSGBOX) {
- BOOL bShow = TRUE;
-
- if (puData->flags & GG_POPUP_ONCE) {
- HWND hWnd = FindWindow(nullptr, gg->m_tszUserName);
- while (hWnd != nullptr) {
- if (FindWindowEx(hWnd, nullptr, nullptr, puData->text) != nullptr) {
- bShow = FALSE;
- break;
- }
- hWnd = FindWindowEx(nullptr, hWnd, nullptr, gg->m_tszUserName);
- }
- }
-
- if (bShow) {
- UINT uIcon = puData->flags & GG_POPUP_ERROR ? MB_ICONERROR : puData->flags & GG_POPUP_WARNING ? MB_ICONEXCLAMATION : MB_ICONINFORMATION;
- MessageBox(nullptr, puData->text, gg->m_tszUserName, MB_OK | uIcon);
- }
- }
- mir_free(puData->title);
- mir_free(puData->text);
- mir_free(puData);
+ PopupData *puData = (PopupData*)dwParam;
+ GaduProto *gg = puData->gg;
+
+ char szName[256];
+ POPUPDATACLASS ppd = { sizeof(ppd) };
+ ppd.pwszTitle = puData->title;
+ ppd.pwszText = puData->text;
+ ppd.PluginData = puData;
+ ppd.pszClassName = szName;
+
+ if (puData->flags & GG_POPUP_ERROR || puData->flags & GG_POPUP_WARNING)
+ mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Error");
+ else
+ mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Notify");
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
void GaduProto::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags)