summaryrefslogtreecommitdiff
path: root/plugins/FingerprintNG/src/fingerprint.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-09 20:01:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-09 20:01:27 +0000
commitdbecbbb19f48f752b6bf4b637e143a805ec4e897 (patch)
tree6aff29d1f7dd1cd9a44b7dc8b66aeae858393b2d /plugins/FingerprintNG/src/fingerprint.cpp
parent27802597c95f74aea3c7f0c0b43083a55a29b765 (diff)
MC support in fingerprint
git-svn-id: http://svn.miranda-ng.org/main/trunk@8524 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FingerprintNG/src/fingerprint.cpp')
-rw-r--r--plugins/FingerprintNG/src/fingerprint.cpp32
1 files changed, 24 insertions, 8 deletions
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);