summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_proto.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-04-25 16:04:06 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-04-25 16:04:06 +0000
commit3bf8dd214686baa698ec98c16d49f320d6f4eee8 (patch)
treed3786a64c6929919225ed2086deb8e59008f6a8f /protocols/SkypeWeb/src/skype_proto.h
parentab53e157ddc1eddbfa072d43d62d244443f41815 (diff)
SkypeWeb: database optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16765 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_proto.h')
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index b5ce6cf33a..63693910f9 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -89,7 +89,38 @@ private:
LoginInfo li;
-
+ struct contacts_list
+ {
+ CSkypeProto *m_proto;
+ std::map<MCONTACT, char*> m_cache;
+
+ contacts_list(CSkypeProto *ppro) : m_proto(ppro)
+ {}
+
+ ~contacts_list()
+ {
+ for (auto it = m_cache.begin(); it != m_cache.end(); ++it)
+ {
+ mir_free(it->second);
+ }
+ }
+
+ const char* operator[](MCONTACT hContact)
+ {
+ try
+ {
+ return m_cache.at(hContact);
+ }
+ catch (std::out_of_range&)
+ {
+ char *id = m_proto->getStringA(hContact, SKYPE_SETTINGS_ID);
+ m_cache[hContact] = id;
+ return id;
+ }
+ }
+
+ } Contacts;
+
static UINT_PTR m_timer;