summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj12
-rw-r--r--plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj.filters17
-rw-r--r--plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj12
-rw-r--r--plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj.filters19
-rw-r--r--plugins/ClientChangeNotify/src/ClientChangeNotify.cpp180
-rw-r--r--plugins/ClientChangeNotify/src/CommonLibs/CString.cpp2
-rw-r--r--plugins/ClientChangeNotify/src/CommonLibs/Options.cpp2
-rw-r--r--plugins/ClientChangeNotify/src/CommonLibs/pcre.cpp2
8 files changed, 130 insertions, 116 deletions
diff --git a/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj b/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj
index f30360ca36..006efe07cf 100644
--- a/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj
+++ b/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj
@@ -184,10 +184,16 @@
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\CommonLibs\CString.cpp" />
+ <ClCompile Include="src\CommonLibs\CString.cpp">
+ <PrecompiledHeaderFile>../Common.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="src\OptDlg.cpp" />
- <ClCompile Include="src\CommonLibs\Options.cpp" />
- <ClCompile Include="src\CommonLibs\pcre.cpp" />
+ <ClCompile Include="src\CommonLibs\Options.cpp">
+ <PrecompiledHeaderFile>../Common.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="src\CommonLibs\pcre.cpp">
+ <PrecompiledHeaderFile>../Common.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="src\ClientChangeNotify.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj.filters b/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj.filters
index aaf82085aa..872af3d866 100644
--- a/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj.filters
+++ b/plugins/ClientChangeNotify/ClientChangeNotify_10.vcxproj.filters
@@ -13,25 +13,28 @@
<UniqueIdentifier>{3887cace-f8eb-45a3-854b-f32b02819763}</UniqueIdentifier>
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
+ <Filter Include="Source Files\CommonLibs">
+ <UniqueIdentifier>{41f0858e-1f97-48b6-bb24-b40945d188ad}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\ClientChangeNotify.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\CommonLibs\CString.cpp">
+ <ClCompile Include="src\OptDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\OptDlg.cpp">
+ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\CommonLibs\CString.cpp">
+ <Filter>Source Files\CommonLibs</Filter>
+ </ClCompile>
<ClCompile Include="src\CommonLibs\Options.cpp">
- <Filter>Source Files</Filter>
+ <Filter>Source Files\CommonLibs</Filter>
</ClCompile>
<ClCompile Include="src\CommonLibs\pcre.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\stdafx.cpp">
- <Filter>Source Files</Filter>
+ <Filter>Source Files\CommonLibs</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
diff --git a/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj b/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj
index ab35b5df9f..76dec68b52 100644
--- a/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj
+++ b/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj
@@ -187,10 +187,16 @@
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\CommonLibs\CString.cpp" />
+ <ClCompile Include="src\CommonLibs\CString.cpp">
+ <PrecompiledHeaderFile>../Common.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="src\OptDlg.cpp" />
- <ClCompile Include="src\CommonLibs\Options.cpp" />
- <ClCompile Include="src\CommonLibs\pcre.cpp" />
+ <ClCompile Include="src\CommonLibs\Options.cpp">
+ <PrecompiledHeaderFile>../Common.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ClCompile Include="src\CommonLibs\pcre.cpp">
+ <PrecompiledHeaderFile>../Common.h</PrecompiledHeaderFile>
+ </ClCompile>
<ClCompile Include="src\ClientChangeNotify.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj.filters b/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj.filters
index aaf82085aa..c26e442322 100644
--- a/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj.filters
+++ b/plugins/ClientChangeNotify/ClientChangeNotify_11.vcxproj.filters
@@ -13,26 +13,29 @@
<UniqueIdentifier>{3887cace-f8eb-45a3-854b-f32b02819763}</UniqueIdentifier>
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
+ <Filter Include="Source Files\CommonLibs">
+ <UniqueIdentifier>{e1c3e36c-54d1-4e6e-83db-68358191bda8}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\ClientChangeNotify.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\CommonLibs\CString.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\OptDlg.cpp">
+ <ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\CommonLibs\Options.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="src\CommonLibs\CString.cpp">
+ <Filter>Source Files\CommonLibs</Filter>
</ClCompile>
<ClCompile Include="src\CommonLibs\pcre.cpp">
- <Filter>Source Files</Filter>
+ <Filter>Source Files\CommonLibs</Filter>
</ClCompile>
- <ClCompile Include="src\stdafx.cpp">
+ <ClCompile Include="src\OptDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\CommonLibs\Options.cpp">
+ <Filter>Source Files\CommonLibs</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Common.h">
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
index 387eef44de..00113d2b31 100644
--- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
+++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
@@ -54,16 +54,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD miranda
static int CALLBACK MenuWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_MEASUREITEM:
- {
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- }
- case WM_DRAWITEM:
- {
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- }
+ switch (uMsg) {
+ case WM_MEASUREITEM:
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+
+ case WM_DRAWITEM:
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
@@ -202,99 +198,99 @@ void ShowPopup(SHOWPOPUP_DATA *sd)
int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- if (!lstrcmpA(cws->szSetting, DB_MIRVER)) {
- HANDLE hContact = (HANDLE)wParam;
- SHOWPOPUP_DATA sd = {0};
- char *szProto = GetContactProto(hContact);
- if (g_PreviewOptPage)
- sd.MirVer = _T("Miranda NG ICQ 0.93.5.3007");
- else {
- if (!hContact) // exit if hContact == NULL and it's not a popup preview
- return 0;
-
- _ASSERT(szProto);
- if (bMetaContactsExists && !strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
- return 0;
-
- sd.MirVer = db_get_s(hContact, szProto, DB_MIRVER, _T(""));
- if (sd.MirVer.IsEmpty())
- return 0;
- }
- sd.OldMirVer = db_get_s(hContact, MOD_NAME, DB_OLDMIRVER, _T(""));
- db_set_ts(hContact, MOD_NAME, DB_OLDMIRVER, sd.MirVer); // we have to write it here, because we modify sd.OldMirVer and sd.MirVer to conform our settings later
- if (sd.OldMirVer.IsEmpty()) // looks like it's the right way to do
+ if (lstrcmpA(cws->szSetting, DB_MIRVER))
+ return 0;
+
+ HANDLE hContact = (HANDLE)wParam;
+ SHOWPOPUP_DATA sd = {0};
+ char *szProto = GetContactProto(hContact);
+ if (g_PreviewOptPage)
+ sd.MirVer = _T("Miranda NG ICQ 0.93.5.3007");
+ else {
+ if (!hContact) // exit if hContact == NULL and it's not a popup preview
return 0;
- COptPage PopupOptPage;
- if (g_PreviewOptPage)
- PopupOptPage = *g_PreviewOptPage;
- else {
- PopupOptPage = g_PopupOptPage;
- PopupOptPage.DBToMem();
- }
-
- HANDLE hContactOrMeta = (hContact && bMetaContactsExists) ? (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0) : hContact;
- if (!hContactOrMeta)
- hContactOrMeta = hContact;
+ _ASSERT(szProto);
+ if (bMetaContactsExists && !strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
+ return 0;
- if (hContact && db_get_b(hContactOrMeta, "CList", "Hidden", 0))
+ sd.MirVer = db_get_s(hContact, szProto, DB_MIRVER, _T(""));
+ if (sd.MirVer.IsEmpty())
return 0;
+ }
+ sd.OldMirVer = db_get_s(hContact, MOD_NAME, DB_OLDMIRVER, _T(""));
+ db_set_ts(hContact, MOD_NAME, DB_OLDMIRVER, sd.MirVer); // we have to write it here, because we modify sd.OldMirVer and sd.MirVer to conform our settings later
+ if (sd.OldMirVer.IsEmpty()) // looks like it's the right way to do
+ return 0;
+
+ COptPage PopupOptPage;
+ if (g_PreviewOptPage)
+ PopupOptPage = *g_PreviewOptPage;
+ else {
+ PopupOptPage = g_PopupOptPage;
+ PopupOptPage.DBToMem();
+ }
- int PerContactSetting = hContact ? db_get_b(hContact, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL) : NOTIFY_ALWAYS; // NOTIFY_ALWAYS for preview
- if (PerContactSetting == NOTIFY_USEGLOBAL && hContactOrMeta != hContact) // subcontact setting has a priority over a metacontact setting
- PerContactSetting = db_get_b(hContactOrMeta, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL);
-
- if (PerContactSetting && (PerContactSetting == NOTIFY_ALMOST_ALWAYS || PerContactSetting == NOTIFY_ALWAYS || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG) || !(db_get_dw(hContactOrMeta, "Ignore", "Mask1", 0) & 0x8))) { // check if we need to notify at all
- sd.hContact = hContact;
- sd.PopupOptPage = &PopupOptPage;
- if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
- CString OldMirVerA = TCHAR2ANSI(sd.OldMirVer);
- CString MirVerA = TCHAR2ANSI(sd.MirVer);
- 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) {
- if (PerContactSetting != NOTIFY_ALMOST_ALWAYS && PerContactSetting != NOTIFY_ALWAYS && !PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) && !strcmp(szClient, szOldClient))
- return 0;
-
- if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
- sd.MirVer = ANSI2TCHAR(szClient);
- sd.OldMirVer = ANSI2TCHAR(szOldClient);
- }
+ HANDLE hContactOrMeta = (hContact && bMetaContactsExists) ? (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0) : hContact;
+ if (!hContactOrMeta)
+ hContactOrMeta = hContact;
+
+ if (hContact && db_get_b(hContactOrMeta, "CList", "Hidden", 0))
+ return 0;
+
+ int PerContactSetting = hContact ? db_get_b(hContact, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL) : NOTIFY_ALWAYS; // NOTIFY_ALWAYS for preview
+ if (PerContactSetting == NOTIFY_USEGLOBAL && hContactOrMeta != hContact) // subcontact setting has a priority over a metacontact setting
+ PerContactSetting = db_get_b(hContactOrMeta, MOD_NAME, DB_CCN_NOTIFY, NOTIFY_USEGLOBAL);
+
+ if (PerContactSetting && (PerContactSetting == NOTIFY_ALMOST_ALWAYS || PerContactSetting == NOTIFY_ALWAYS || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_USESTATUSNOTIFYFLAG) || !(db_get_dw(hContactOrMeta, "Ignore", "Mask1", 0) & 0x8))) { // check if we need to notify at all
+ sd.hContact = hContact;
+ sd.PopupOptPage = &PopupOptPage;
+ if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
+ if (bFingerprintExists) {
+ LPCTSTR ptszOldClient = (LPCTSTR)CallService(MS_FP_SAMECLIENTST, (WPARAM)(TCHAR*)sd.OldMirVer, (LPARAM)(TCHAR*)sd.OldMirVer); // 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
+ LPCTSTR ptszClient = (LPCTSTR)CallService(MS_FP_SAMECLIENTST, (WPARAM)(TCHAR*)sd.MirVer, (LPARAM)(TCHAR*)sd.MirVer);
+ if (ptszOldClient && ptszClient) {
+ if (PerContactSetting != NOTIFY_ALMOST_ALWAYS && PerContactSetting != NOTIFY_ALWAYS && !PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) && !_tcscmp(ptszClient, ptszOldClient))
+ return 0;
+
+ if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
+ sd.MirVer = ptszClient;
+ sd.OldMirVer = ptszOldClient;
}
}
}
- if (sd.MirVer == (const TCHAR*)sd.OldMirVer) {
- _ASSERT(hContact);
- return 0;
- }
- if (PerContactSetting == NOTIFY_ALWAYS || (PopupOptPage.GetValue(IDC_POPUPOPTDLG_POPUPNOTIFY) && (g_PreviewOptPage || PerContactSetting == NOTIFY_ALMOST_ALWAYS || !PcreCheck(sd.MirVer)))) {
- ShowPopup(&sd);
- SkinPlaySound(CLIENTCHANGED_SOUND);
- }
}
- if (hContact) {
- TCString ClientName;
- if (PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT) && sd.OldMirVer.GetLen()) {
- mir_sntprintf(ClientName.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("%s (was %s)"), (const TCHAR*)sd.MirVer, (const TCHAR*)sd.OldMirVer);
- ClientName.ReleaseBuffer();
- }
- else ClientName = sd.MirVer;
-
- if (bVariablesExists)
- logservice_log(LOG_ID, hContact, ClientName);
- else {
- _ASSERT(szProto);
- TCString szUID(_T(""));
- char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (uid && (INT_PTR)uid != CALLSERVICE_NOTFOUND)
- szUID = DBGetContactSettingAsString(hContact, szProto, uid, _T(""));
-
- logservice_log(LOG_ID, hContact, TCString((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)) + _T(" (") + szUID + TranslateT(") changed client to ") + ClientName);
- }
+ if (sd.MirVer == (const TCHAR*)sd.OldMirVer) {
+ _ASSERT(hContact);
+ return 0;
+ }
+ if (PerContactSetting == NOTIFY_ALWAYS || (PopupOptPage.GetValue(IDC_POPUPOPTDLG_POPUPNOTIFY) && (g_PreviewOptPage || PerContactSetting == NOTIFY_ALMOST_ALWAYS || -1 == PcreCheck(sd.MirVer)))) {
+ ShowPopup(&sd);
+ SkinPlaySound(CLIENTCHANGED_SOUND);
+ }
+ }
+
+ if (hContact) {
+ TCString ClientName;
+ if (PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT) && sd.OldMirVer.GetLen()) {
+ mir_sntprintf(ClientName.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("%s (was %s)"), (const TCHAR*)sd.MirVer, (const TCHAR*)sd.OldMirVer);
+ ClientName.ReleaseBuffer();
+ }
+ else ClientName = sd.MirVer;
+
+ if (bVariablesExists)
+ logservice_log(LOG_ID, hContact, ClientName);
+ else {
+ _ASSERT(szProto);
+ TCString szUID(_T(""));
+ char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ if (uid && (INT_PTR)uid != CALLSERVICE_NOTFOUND)
+ szUID = DBGetContactSettingAsString(hContact, szProto, uid, _T(""));
+
+ logservice_log(LOG_ID, hContact, TCString((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)) + _T(" (") + szUID + TranslateT(") changed client to ") + ClientName);
}
- _ASSERT(sd.MirVer.GetLen()); // save the last known MirVer value even if the new one is empty
}
+ _ASSERT(sd.MirVer.GetLen()); // save the last known MirVer value even if the new one is empty
return 0;
}
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp b/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp
index a874b75721..de3e26d238 100644
--- a/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp
+++ b/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "Common.h"
+#include "../Common.h"
#include "CString.h"
#define STR_GROWBY 64
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
index e0d585d991..59bc65adfe 100644
--- a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
+++ b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "Common.h"
+#include "../Common.h"
#include "Options.h"
static CString sEmptyString("");
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/pcre.cpp b/plugins/ClientChangeNotify/src/CommonLibs/pcre.cpp
index ae82e43435..492c2f2a92 100644
--- a/plugins/ClientChangeNotify/src/CommonLibs/pcre.cpp
+++ b/plugins/ClientChangeNotify/src/CommonLibs/pcre.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "common.h"
+#include "../Common.h"
#include <windows.h>
#include <stdio.h>
#include <crtdbg.h>