summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-08-20 17:06:15 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-08-20 17:06:15 +0000
commitd2923a79102483b203b841926981c436aebaa3f6 (patch)
tree0ed0077b8ee744505ba59db7e24c9c505f5e8019 /protocols
parentd55bb61e287b9e5c659d08c7d0f7fa952814ff29 (diff)
SkypeWeb: code optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@14998 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp8
-rw-r--r--protocols/SkypeWeb/src/skype_dialogs.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_menus.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h7
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp6
6 files changed, 11 insertions, 16 deletions
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index b4207df6ab..3444845d76 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -283,16 +283,12 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response)
{
LIST<char> users(1);
for (; i < skypenames.getCount() && users.getCount() <= 50; i++)
- users.insert(mir_strdup(skypenames[i]));
-
+ users.insert(skypenames[i]);
PushRequest(new GetContactsInfoRequest(li, users), &CSkypeProto::LoadContactsInfo);
-
- FreeCharList(users);
- users.destroy();
}
while(i < skypenames.getCount());
- FreeCharList(skypenames);
+ FreeList(skypenames);
skypenames.destroy();
}
PushRequest(new GetContactsAuthRequest(li), &CSkypeProto::LoadContactsAuth);
diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp
index 3e35bb1909..7a96c07736 100644
--- a/protocols/SkypeWeb/src/skype_dialogs.cpp
+++ b/protocols/SkypeWeb/src/skype_dialogs.cpp
@@ -64,7 +64,7 @@ CSkypeGCCreateDlg::CSkypeGCCreateDlg(CSkypeProto *proto) :
}
CSkypeGCCreateDlg::~CSkypeGCCreateDlg()
{
- CSkypeProto::FreeCharList(m_ContactsList);
+ CSkypeProto::FreeList(m_ContactsList);
m_ContactsList.destroy();
}
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index 9ce5262488..3db5b33aaf 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -252,7 +252,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response)
skypenames.insert(getStringA(hContact, SKYPE_SETTINGS_ID));
}
SendRequest(new CreateContactsSubscriptionRequest(skypenames, li));
- FreeCharList(skypenames);
+ FreeList(skypenames);
skypenames.destroy();
m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, 0, NULL);
diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp
index 4c5c1c3049..43ea7639a4 100644
--- a/protocols/SkypeWeb/src/skype_menus.cpp
+++ b/protocols/SkypeWeb/src/skype_menus.cpp
@@ -27,7 +27,7 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
if (m_iStatus < ID_STATUS_ONLINE)
return 0;
- if (this->isChatRoom(hContact))
+ if (isChatRoom(hContact))
{
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 69051e4afb..1b3a9d9d38 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -302,7 +302,12 @@ private:
void ProcessThreadUpdate (const JSONNode &node);
// utils
- static void FreeCharList(const LIST<char> &lst);
+ template <typename T>
+ __inline static void FreeList(const LIST<T> &lst)
+ {
+ for (int i = 0; i < lst.getCount(); i++)
+ mir_free(lst[i]);
+ }
__forceinline bool IsOnline()
{ return (m_iStatus > ID_STATUS_OFFLINE && m_hPollingThread);
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp
index 72e912cd61..ab8b614131 100644
--- a/protocols/SkypeWeb/src/skype_utils.cpp
+++ b/protocols/SkypeWeb/src/skype_utils.cpp
@@ -19,12 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma warning(disable:4566)
-void CSkypeProto::FreeCharList(const LIST<char> &lst)
-{
- for (int i = 0; i < lst.getCount(); i++)
- mir_free(lst[i]);
-}
-
time_t CSkypeProto::IsoToUnixTime(const char *stamp)
{
char date[9];