diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-25 20:43:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-25 20:43:51 +0300 |
commit | e19a213605f1974c2000a9f2b1b7d6d4666cdb90 (patch) | |
tree | 0c5b0cd3ce239e9ac964ab765a592bdf35a42172 /plugins/Clist_blind/src | |
parent | b7656780ce149ba23304ae1f6f292fc5a5197a1b (diff) |
duplicate cache item removed to avoid rare crashes
Diffstat (limited to 'plugins/Clist_blind/src')
-rw-r--r-- | plugins/Clist_blind/src/contact.cpp | 8 | ||||
-rw-r--r-- | plugins/Clist_blind/src/init.cpp | 17 | ||||
-rw-r--r-- | plugins/Clist_blind/src/stdafx.h | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/plugins/Clist_blind/src/contact.cpp b/plugins/Clist_blind/src/contact.cpp index f9881fcd1b..2b42024382 100644 --- a/plugins/Clist_blind/src/contact.cpp +++ b/plugins/Clist_blind/src/contact.cpp @@ -54,8 +54,8 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) {
MCONTACT a = c1->hContact, b = c2->hContact;
- int statusa = db_get_w(a, c1->proto, "Status", ID_STATUS_OFFLINE);
- int statusb = db_get_w(b, c2->proto, "Status", ID_STATUS_OFFLINE);
+ int statusa = db_get_w(a, c1->pce->szProto, "Status", ID_STATUS_OFFLINE);
+ int statusb = db_get_w(b, c2->pce->szProto, "Status", ID_STATUS_OFFLINE);
if (g_bSortByProto) {
/* deal with statuses, online contacts have to go above offline */
@@ -63,8 +63,8 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) return 2 * (statusa == ID_STATUS_OFFLINE) - 1;
}
/* both are online, now check protocols */
- if (c1->proto != nullptr && c2->proto != nullptr) {
- int rc = mir_strcmp(c1->proto, c2->proto);
+ if (c1->pce->szProto != nullptr && c2->pce->szProto != nullptr) {
+ int rc = mir_strcmp(c1->pce->szProto, c2->pce->szProto);
if (rc != 0)
return rc;
}
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 69d8883d96..118de95447 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -387,31 +387,30 @@ wchar_t* GetStatusName(struct ClcContact *item) int status;
status_name[0] = '\0';
- if (item->hContact == NULL || item->proto == nullptr)
+ if (item->hContact == NULL || item->pce->szProto == nullptr)
return status_name;
// Get XStatusName
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), nullptr);
+ MyDBGetContactSettingTString(item->hContact, item->pce->szProto, "XStatusName", status_name, _countof(status_name), nullptr);
if (status_name[0] != '\0')
return status_name;
// Get status name
- status = db_get_w(item->hContact, item->proto, "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(item->hContact, item->pce->szProto, "Status", ID_STATUS_OFFLINE);
mir_wstrncpy(status_name, Clist_GetStatusModeDescription(status, 0), _countof(status_name));
return status_name;
}
-
wchar_t status_message[256];
wchar_t* GetStatusMessage(struct ClcContact *item)
{
status_message[0] = '\0';
- if (item->hContact == NULL || item->proto == nullptr)
+ if (item->hContact == NULL || item->pce->szProto == nullptr)
return status_message;
// Get XStatusMsg
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), nullptr);
+ MyDBGetContactSettingTString(item->hContact, item->pce->szProto, "XStatusMsg", status_message, _countof(status_message), nullptr);
if (status_message[0] != '\0')
return status_message;
@@ -430,15 +429,15 @@ wchar_t* GetProtoName(struct ClcContact *item) #endif
proto_name[0] = '\0';
- if (item->hContact == NULL || item->proto == nullptr) {
+ if (item->hContact == NULL || item->pce->szProto == nullptr) {
mir_wstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
return proto_name;
}
- PROTOACCOUNT *acc = Proto_GetAccount(item->proto);
+ PROTOACCOUNT *acc = Proto_GetAccount(item->pce->szProto);
if (acc == nullptr) {
#ifdef UNICODE
- CallProtoService(item->proto, PS_GETNAME, sizeof(description), (LPARAM)description);
+ CallProtoService(item->pce->szProto, PS_GETNAME, sizeof(description), (LPARAM)description);
mir_snwprintf(proto_name, L"%S", description);
#else
CallProtoService(item->proto, PS_GETNAME, sizeof(proto_name), (LPARAM)proto_name);
diff --git a/plugins/Clist_blind/src/stdafx.h b/plugins/Clist_blind/src/stdafx.h index 62ce6c4d07..f819286769 100644 --- a/plugins/Clist_blind/src/stdafx.h +++ b/plugins/Clist_blind/src/stdafx.h @@ -46,6 +46,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> int Load() override;
};
+struct ClcCacheEntry : public ClcCacheEntryBase {};
+
struct ClcContact : public ClcContactBase {};
struct ClcData : public ClcDataBase
|