diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-15 21:47:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-15 21:47:10 +0000 |
commit | 9d482ed81c2a6a3361a5a9b2d0efbfc4b6b815c5 (patch) | |
tree | e5b304c159f7c79ab44926eee439eb93288acec6 /plugins/TabSRMM/src/eventpopups.cpp | |
parent | 7fe6e93058f0e9253e2a79d7fc2d7a136784f791 (diff) |
- POPUPDATAT_V2 replaced with POPUPDATAT in all possible cases;
- fix: wrong popup initialization code;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4057 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/eventpopups.cpp')
-rw-r--r-- | plugins/TabSRMM/src/eventpopups.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 362adf97b3..9a7d8cf45c 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -669,12 +669,6 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType, HWND hContainer)
{
- POPUPDATAT_V2 pud = {0};
- PLUGIN_DATAT *pdata;
- DBEVENTINFO dbe;
- long iSeconds = 0;
- TCHAR *szPreview = NULL;
-
//there has to be a maximum number of popups shown at the same time
if (PopupList.size() >= MAX_POPUPS)
return(2);
@@ -682,6 +676,8 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent if (!PluginConfig.g_PopupAvail)
return 0;
+ POPUPDATAT pud = {0};
+ long iSeconds;
switch (eventType) {
case EVENTTYPE_MESSAGE:
pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
@@ -699,23 +695,18 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent return 1;
}
- ZeroMemory(&dbe, sizeof(dbe));
- dbe.pBlob = NULL;
- dbe.cbSize = sizeof(dbe);
-
+ DBEVENTINFO dbe = { sizeof(dbe) };
// fix for a crash
if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
dbe.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
- } else
- dbe.cbBlob = 0;
+ }
CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbe);
if (hEvent == 0 && hContact == 0)
dbe.szModule = Translate("Unknown module or contact");
- pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
-
+ PLUGIN_DATAT *pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
pdata->eventType = eventType;
pdata->hContact = hContact;
pdata->pluginOptions = pluginOptions;
@@ -737,7 +728,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent mir_free(szModule);
}
- szPreview = GetPreviewT((WORD)eventType, &dbe);
+ TCHAR *szPreview = GetPreviewT((WORD)eventType, &dbe);
if (szPreview) {
mir_sntprintf(pud.lptzText, MAX_SECONDLINE, _T("%s"), szPreview);
mir_free(szPreview);
@@ -753,14 +744,11 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent pdata->nrMerged = 1;
// fix for broken popups -- process failures
- if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pud, 0) < 0) {
- // failed to display, perform cleanup
- if (pdata->eventData)
- mir_free(pdata->eventData);
+ if ( PUAddPopUpT(&pud) < 0) {
+ mir_free(pdata->eventData);
mir_free(pdata);
}
- else
- PopupList.push_back(pdata);
+ else PopupList.push_back(pdata);
if (dbe.pBlob)
free(dbe.pBlob);
@@ -936,7 +924,7 @@ int tabSRMM_ShowPopup(WPARAM wParam, LPARAM lParam, WORD eventType, int windowOp return 0;
}
passed:
- if (!(PluginConfig.g_PopupAvail && PluginConfig.g_PopupWAvail))
+ if ( !PluginConfig.g_PopupAvail)
return 0;
if (PU_GetByContact((HANDLE)wParam) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) {
|