summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-02-22 11:45:46 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-02-22 11:45:46 +0000
commitec0e2844534a148012b76debb6eff48d8c1931a8 (patch)
treef6e130e63d999bd921623c6eabba88dc3c6f193d /plugins
parent2eee15c40aea9351bcadace3d1ebfd0d98cb84ef (diff)
fully used loading/unloading events
git-svn-id: http://svn.miranda-ng.org/main/trunk@3689 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ClientChangeNotify/src/ClientChangeNotify.cpp15
-rw-r--r--plugins/ClientChangeNotify/src/Common.h2
-rw-r--r--plugins/ClientChangeNotify/src/Misc.h2
-rw-r--r--plugins/ClientChangeNotify/src/OptDlg.cpp2
4 files changed, 12 insertions, 9 deletions
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
index c0af9837c0..a22535f1b1 100644
--- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
+++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
@@ -25,7 +25,7 @@ HANDLE g_hTogglePopupsMenuItem;
int hLangpack;
TMyArray<HANDLE> hHooks, hServices;
COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview)
-BOOL bPopupExists = FALSE;
+BOOL bPopupExists = FALSE, bMetaContactsExists = FALSE, bFingerprintExists = FALSE, bVariablesExists = FALSE;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -213,7 +213,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
return 0;
_ASSERT(szProto);
- if (ServiceExists(MS_MC_GETPROTOCOLNAME) && !strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
+ if (bMetaContactsExists && !strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
return 0;
sd.MirVer = DBGetContactSettingString(hContact, szProto, DB_MIRVER, _T(""));
@@ -233,7 +233,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
PopupOptPage.DBToMem();
}
- HANDLE hContactOrMeta = (hContact && ServiceExists(MS_MC_GETMETACONTACT)) ? (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0) : hContact;
+ HANDLE hContactOrMeta = (hContact && bMetaContactsExists) ? (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0) : hContact;
if (!hContactOrMeta)
hContactOrMeta = hContact;
@@ -250,7 +250,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
CString OldMirVerA = TCHAR2ANSI(sd.OldMirVer);
CString MirVerA = TCHAR2ANSI(sd.MirVer);
- if (ServiceExists(MS_FP_SAMECLIENTS)) {
+ if (bFingerprintExists) {
char *szOldClient = (char*)CallService(MS_FP_SAMECLIENTS, (WPARAM)(const char*)OldMirVerA, (LPARAM)(const char*)OldMirVerA); // remove version from MirVer strings. I know, the way in which MS_FP_SAMECLIENTS is used here is pretty ugly, but at least it gives necessary results
char *szClient = (char*)CallService(MS_FP_SAMECLIENTS, (WPARAM)(const char*)MirVerA, (LPARAM)(const char*)MirVerA);
if (szOldClient && szClient) {
@@ -281,7 +281,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
}
else ClientName = sd.MirVer;
- if (ServiceExists(MS_VARS_FORMATSTRING))
+ if (bVariablesExists)
logservice_log(LOG_ID, hContact, ClientName);
else {
_ASSERT(szProto);
@@ -376,6 +376,9 @@ INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
static int ModuleLoad(WPARAM wParam, LPARAM lParam)
{
bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0;
+ bMetaContactsExists = ServiceExists(MS_MC_GETPROTOCOLNAME) && ServiceExists(MS_MC_GETMETACONTACT) != 0;
+ bFingerprintExists = ServiceExists(MS_FP_SAMECLIENTS) && ServiceExists(MS_FP_GETCLIENTICON) != 0;
+ bVariablesExists = ServiceExists(MS_VARS_FORMATSTRING) != 0;
return 0;
}
@@ -411,7 +414,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam)
}
// seems that Fingerprint is not installed
- if ((!ServiceExists(MS_FP_SAMECLIENTS) || !ServiceExists(MS_FP_GETCLIENTICON)) && !DBGetContactSettingByte(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0))
+ if (!bFingerprintExists && !DBGetContactSettingByte(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0))
CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), NULL, CCNErrorDlgProc);
logservice_register(LOG_ID, LPGENT("ClientChangeNotify"), _T("ClientChangeNotify?puts(p,?dbsetting(%subject%,Protocol,p))?if2(_?dbsetting(,?get(p),?pinfo(?get(p),uidsetting)),).log"), TranslateT("`[`!cdate()-!ctime()`]` ?cinfo(%subject%,display) (?cinfo(%subject%,id)) changed client to %extratext%"));
diff --git a/plugins/ClientChangeNotify/src/Common.h b/plugins/ClientChangeNotify/src/Common.h
index 14bed96102..7bcfb12636 100644
--- a/plugins/ClientChangeNotify/src/Common.h
+++ b/plugins/ClientChangeNotify/src/Common.h
@@ -105,7 +105,7 @@
#define CLIENTCHANGED_SOUND "ClientChanged"
extern HINSTANCE g_hInstance;
-extern BOOL bPopupExists;
+extern BOOL bPopupExists, bFingerprintExists;
extern COptPage g_PopupOptPage;
extern COptPage *g_PreviewOptPage;
diff --git a/plugins/ClientChangeNotify/src/Misc.h b/plugins/ClientChangeNotify/src/Misc.h
index 55bf91cfdf..1dc43fbc51 100644
--- a/plugins/ClientChangeNotify/src/Misc.h
+++ b/plugins/ClientChangeNotify/src/Misc.h
@@ -31,7 +31,7 @@ __inline void ShowMsg(TCHAR *FirstLine, TCHAR *SecondLine = _T(""), bool IsError
ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD;
ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000;
ppd.iSeconds = Timeout;
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
+ PUAddPopUpT(&ppd);
} else
{
MessageBox(NULL, SecondLine, FirstLine, MB_OK | (IsErrorMsg ? MB_ICONEXCLAMATION : MB_ICONINFORMATION));
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp
index 42cbacca9b..d86c6a473e 100644
--- a/plugins/ClientChangeNotify/src/OptDlg.cpp
+++ b/plugins/ClientChangeNotify/src/OptDlg.cpp
@@ -54,7 +54,7 @@ void EnablePopupOptDlgControls()
ShowVer->Enable(false);
ShowVer->MemToWnd(g_PopupOptPage.hWnd);
}
- if (!ServiceExists(MS_FP_SAMECLIENTS))
+ if (!bFingerprintExists)
{ // disable these checkboxes if Fingerprint wasn't found
g_PopupOptPage.Find(IDC_POPUPOPTDLG_VERCHGNOTIFY)->Enable(false);
g_PopupOptPage.Find(IDC_POPUPOPTDLG_SHOWVER)->Enable(false);