diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-04-09 20:51:56 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-04-09 20:51:56 +0000 |
commit | 22d948a4cd28ccf08008db597e4f7470c3a57219 (patch) | |
tree | c02c11079548e32703db659e7e1b390b3b171665 | |
parent | 84261a1bda35dcdd1a4e56c3a573a169092f7363 (diff) |
SkypeWeb: ugly contacts lookup hack
git-svn-id: http://svn.miranda-ng.org/main/trunk@12718 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 17 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 1 |
3 files changed, 15 insertions, 6 deletions
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 4e34d1b2e0..e4a46cd0e3 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -47,15 +47,22 @@ MCONTACT CSkypeProto::GetContact(const char *skypename) if (it != contactMap.end())
return it->second;
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ MCONTACT hContact = NULL;
+ if (contactMap.empty())
+ MCONTACT hContact = db_find_first(m_szModuleName);
+ else
+ {
+ hContact = db_find_next(lastMapContact, m_szModuleName);
+ }
+ for (; hContact; hContact = db_find_next(hContact, m_szModuleName))
{
std::string cSkypename = ptrA(getStringA(hContact, SKYPE_SETTINGS_ID));
if (!contactMap.count(cSkypename))
- contactMap[cSkypename] = hContact;
+ contactMap[cSkypename] = lastMapContact = hContact;
if (mir_strcmpi(skypename, cSkypename.c_str()) == 0)
- return hContact;
+ break;
}
- return NULL;
+ return hContact;
}
MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary)
@@ -66,7 +73,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName);
- contactMap[skypename] = hContact;
+ contactMap[skypename] = lastMapContact = hContact;
setString(hContact, SKYPE_SETTINGS_ID, skypename);
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 0056b2e330..1a5f7e1f71 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -37,11 +37,12 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
// make contact map
+ lastMapContact = NULL;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
{
std::string cSkypename = ptrA(getStringA(hContact, SKYPE_SETTINGS_ID));
if (!contactMap.count(cSkypename))
- contactMap[cSkypename] = hContact;
+ contactMap[cSkypename] = lastMapContact = hContact;
}
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 0d6203655c..005616acc4 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -164,6 +164,7 @@ private: void LoadProfile(const NETLIBHTTPREQUEST *response);
// contacts
+ MCONTACT lastMapContact;
std::map<std::string, MCONTACT> contactMap;
WORD GetContactStatus(MCONTACT hContact);
|