diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-12-20 19:10:47 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-12-20 19:10:47 +0000 |
commit | 58e5ea7bf98f8468f869522c89ffe961112bd98d (patch) | |
tree | 69cd89a853c4f315247e5724c6005a3d9e5d1e4e /protocols/FacebookRM/src/proto.cpp | |
parent | 9f98d623506e7b7a86561152807526aeb2bb5be3 (diff) |
Facebook: Various code improvements (as reported by Coverity analyser); version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@11546 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/proto.cpp')
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 94fc964b18..aacb6f08a7 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -35,9 +35,13 @@ PROTO<FacebookProto>(proto_name, username) facy.send_message_lock_ = CreateMutex(NULL, FALSE, NULL); facy.fcb_conn_lock_ = CreateMutex(NULL, FALSE, NULL); facy.notifications_lock_ = CreateMutex(NULL, FALSE, NULL); + facy.cookies_lock_ = CreateMutex(NULL, FALSE, NULL); + + m_hMenuRoot = m_hMenuServicesRoot = m_hStatusMind = NULL; m_invisible = false; m_signingOut = false; + m_enableChat = DEFAULT_ENABLE_CHATS; // Load custom locale, if set ptrA locale(getStringA(FACEBOOK_KEY_LOCALE)); @@ -118,6 +122,7 @@ FacebookProto::~FacebookProto() WaitForSingleObject(facy.buddies_lock_, IGNORE); WaitForSingleObject(facy.send_message_lock_, IGNORE); WaitForSingleObject(facy.notifications_lock_, IGNORE); + WaitForSingleObject(facy.cookies_lock_, IGNORE); CloseHandle(signon_lock_); CloseHandle(avatar_lock_); @@ -127,6 +132,7 @@ FacebookProto::~FacebookProto() CloseHandle(facy.send_message_lock_); CloseHandle(facy.fcb_conn_lock_); CloseHandle(facy.notifications_lock_); + CloseHandle(facy.cookies_lock_); } ////////////////////////////////////////////////////////////////////////////// @@ -864,20 +870,20 @@ void FacebookProto::ReadNotificationWorker(void *p) if (p == NULL) return; + std::string *id = (std::string*)p; + if (isOffline()) { - delete (std::string*)p; + delete id; return; } - std::string *id = static_cast<std::string*>(p); - std::string data = "seen=0&asyncSignal=&__dyn=&__req=a&alert_ids%5B0%5D=" + utils::url::encode(*id); data += "&fb_dtsg=" + facy.dtsg_; data += "&__user=" + facy.self_.user_id; facy.flap(REQUEST_NOTIFICATIONS_READ, NULL, &data); - delete p; + delete id; } /** @@ -982,8 +988,8 @@ void FacebookProto::InitPopups() void FacebookProto::InitHotkeys() { char text[200]; - strcpy(text, m_szModuleName); - char* tDest = text + strlen(text); + mir_strncpy(text, m_szModuleName, 100); + char *tDest = text + strlen(text); HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = text; |