summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp17
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp3
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h1
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);