summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Variables/src/contact.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index a61b0524d0..995a4ce610 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -359,23 +359,31 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *dbw = (DBCONTACTWRITESETTING*)lParam;
+ char *szProto = GetContactProto(hContact);
+ if (szProto == NULL)
+ return 0;
+
+ char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+
+ bool isNick = !strcmp(dbw->szSetting, "Nick");
+ bool isFirstName = !strcmp(dbw->szSetting, "FirstName");
+ bool isLastName = !strcmp(dbw->szSetting, "LastName");
+ bool isEmail = !strcmp(dbw->szSetting, "e-mail");
+ bool isMyHandle = !strcmp(dbw->szSetting, "MyHandle");
+ bool isUid = (((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != NULL)) && (!strcmp(dbw->szSetting, uid));
+
mir_cslock lck(csContactCache);
for (int i = 0; i < cacheSize; i++) {
if (hContact != cce[i].hContact && (cce[i].flags & CI_CNFINFO) == 0)
continue;
-
- char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- continue;
-
- char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (((!strcmp(dbw->szSetting, "Nick")) && (cce[i].flags & CI_NICK)) ||
- ((!strcmp(dbw->szSetting, "FirstName")) && (cce[i].flags & CI_FIRSTNAME)) ||
- ((!strcmp(dbw->szSetting, "LastName")) && (cce[i].flags & CI_LASTNAME)) ||
- ((!strcmp(dbw->szSetting, "e-mail")) && (cce[i].flags & CI_EMAIL)) ||
- ((!strcmp(dbw->szSetting, "MyHandle")) && (cce[i].flags & CI_LISTNAME)) ||
+
+ if ((isNick && (cce[i].flags & CI_NICK)) ||
+ (isFirstName && (cce[i].flags & CI_FIRSTNAME)) ||
+ (isLastName && (cce[i].flags & CI_LASTNAME)) ||
+ (isEmail && (cce[i].flags & CI_EMAIL)) ||
+ (isMyHandle && (cce[i].flags & CI_LISTNAME)) ||
(cce[i].flags & CI_CNFINFO) != 0 || // lazy; always invalidate CNF info cache entries
- ((((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != NULL)) && (!strcmp(dbw->szSetting, uid)) && (cce[i].flags & CI_UNIQUEID))) {
+ (isUid && (cce[i].flags & CI_UNIQUEID))) {
/* remove from cache */
mir_free(cce[i].tszContact);
if (cacheSize > 1) {