From dbecbbb19f48f752b6bf4b637e143a805ec4e897 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 9 Mar 2014 20:01:27 +0000 Subject: MC support in fingerprint git-svn-id: http://svn.miranda-ng.org/main/trunk@8524 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FingerprintNG/fingerprint_ng_12.vcxproj | 1 - .../fingerprint_ng_12.vcxproj.filters | 3 -- plugins/FingerprintNG/src/fingerprint.cpp | 32 ++++++++++++++++------ plugins/FingerprintNG/src/global.h | 1 + 4 files changed, 25 insertions(+), 12 deletions(-) (limited to 'plugins/FingerprintNG') diff --git a/plugins/FingerprintNG/fingerprint_ng_12.vcxproj b/plugins/FingerprintNG/fingerprint_ng_12.vcxproj index 484c976993..6e91fc240c 100644 --- a/plugins/FingerprintNG/fingerprint_ng_12.vcxproj +++ b/plugins/FingerprintNG/fingerprint_ng_12.vcxproj @@ -195,7 +195,6 @@ - diff --git a/plugins/FingerprintNG/fingerprint_ng_12.vcxproj.filters b/plugins/FingerprintNG/fingerprint_ng_12.vcxproj.filters index 62387364f4..7b30f41640 100644 --- a/plugins/FingerprintNG/fingerprint_ng_12.vcxproj.filters +++ b/plugins/FingerprintNG/fingerprint_ng_12.vcxproj.filters @@ -29,9 +29,6 @@ Source Files - - Source Files - Source Files diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 304d445002..c2a3b44f84 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -841,16 +841,31 @@ int OnExtraImageApply(WPARAM hContact, LPARAM lParam) if (hContact == NULL) return 0; + ptrT tszMirver; char *szProto = GetContactProto(hContact); - if (szProto != NULL) { - DBVARIANT dbvMirVer; - if ( !db_get_ts(hContact, szProto, "MirVer", &dbvMirVer)) { - ApplyFingerprintImage(hContact, dbvMirVer.ptszVal); - db_free(&dbvMirVer); + if (szProto != NULL) + tszMirver = db_get_tsa(hContact, szProto, "MirVer"); + + ApplyFingerprintImage(hContact, tszMirver); + return 0; +} + +/**************************************************************************************** +* OnMetaDefaultChanged +* update MC icon according to its default contact +*/ + +static int OnMetaDefaultChanged(WPARAM hMeta, LPARAM hSub) +{ + if (hSub != NULL) { + char *szProto = GetContactProto(hSub); + if (szProto != NULL) { + ptrT tszMirver(db_get_tsa(hSub, szProto, "MirVer")); + if (tszMirver) + db_set_ts(hMeta, META_PROTO, "MirVer", tszMirver); } - else ApplyFingerprintImage(hContact, NULL); } - else ApplyFingerprintImage(hContact, NULL); + return 0; } @@ -864,7 +879,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) if (hContact == NULL) return 0; - DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; if (cws && cws->szSetting && !strcmp(cws->szSetting, "MirVer")) { switch (cws->value.type) { case DBVT_UTF8: @@ -947,6 +962,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) void InitFingerModule() { HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_MC_DEFAULTTCHANGED, OnMetaDefaultChanged); CreateServiceFunction(MS_FP_SAMECLIENTSW, ServiceSameClientsW); CreateServiceFunction(MS_FP_GETCLIENTDESCRW, ServiceGetClientDescrW); diff --git a/plugins/FingerprintNG/src/global.h b/plugins/FingerprintNG/src/global.h index 64fa08b66c..19a7b22903 100644 --- a/plugins/FingerprintNG/src/global.h +++ b/plugins/FingerprintNG/src/global.h @@ -53,6 +53,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include -- cgit v1.2.3