From 08770934c167a28d64d8462b78410c43aee04348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 11 Oct 2013 17:12:43 +0000 Subject: Facebook: Cleanup also old LOG macro git-svn-id: http://svn.miranda-ng.org/main/trunk@6446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/avatars.cpp | 10 +++--- protocols/FacebookRM/src/chat.cpp | 4 +-- protocols/FacebookRM/src/connection.cpp | 28 +++++++-------- protocols/FacebookRM/src/process.cpp | 60 ++++++++++++++++----------------- protocols/FacebookRM/src/proto.cpp | 6 ++-- protocols/FacebookRM/src/utils.cpp | 21 ------------ protocols/FacebookRM/src/utils.h | 5 --- 7 files changed, 54 insertions(+), 80 deletions(-) diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 16b2218e68..73170da803 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -97,7 +97,7 @@ void FacebookProto::UpdateAvatarWorker(void *) { HANDLE nlc = NULL; - LOG("***** UpdateAvatarWorker"); + debugLogA("***** UpdateAvatarWorker"); for (;;) { @@ -107,13 +107,13 @@ void FacebookProto::UpdateAvatarWorker(void *) if (Miranda_Terminated()) { - LOG("***** Terminating avatar update early: %s", url.c_str()); + debugLogA("***** Terminating avatar update early: %s", url.c_str()); break; } if (GetDbAvatarInfo(ai, &url)) { - LOG("***** Updating avatar: %s", url.c_str()); + debugLogA("***** Updating avatar: %s", url.c_str()); bool success = facy.save_url(url, ai.filename, nlc); if (ai.hContact) @@ -192,7 +192,7 @@ INT_PTR FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (needLoad) { - LOG("***** Starting avatar request thread for %s", _T2A(AI->filename)); + debugLogA("***** Starting avatar request thread for %s", _T2A(AI->filename)); ScopedLock s(avatar_lock_); if (std::find(avatar_queue.begin(), avatar_queue.end(), AI->hContact) == avatar_queue.end()) @@ -213,7 +213,7 @@ INT_PTR FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) INT_PTR FacebookProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) { - LOG("***** GetMyAvatar"); + debugLogA("***** GetMyAvatar"); if (!wParam || !lParam) return -3; diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index ea635c4a53..e480814f49 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -88,7 +88,7 @@ int FacebookProto::OnGCEvent(WPARAM wParam,LPARAM lParam) std::string chat_id = ptrA( mir_t2a_cp(hook->pDest->ptszID,CP_UTF8)); if (isOnline()) { - LOG("**Chat - Outgoing message: %s", msg.c_str()); + debugLogA("**Chat - Outgoing message: %s", msg.c_str()); ForkThread(&FacebookProto::SendChatMsgWorker, new send_chat(chat_id, msg)); } @@ -225,7 +225,7 @@ char *FacebookProto::GetChatUsers(const char *chat_id) gci.pszID = tid; CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci); - LOG("**Chat - Users in chat %s: %s", chat_id, gci.pszUsers); + debugLogA("**Chat - Users in chat %s: %s", chat_id, gci.pszUsers); // mir_free(gci.pszUsers); return gci.pszUsers; diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index d4f255de95..abfb0a607b 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -32,7 +32,7 @@ void FacebookProto::ChangeStatus(void*) if (new_status == ID_STATUS_OFFLINE) { // Logout - LOG("##### Beginning SignOff process"); + debugLogA("##### Beginning SignOff process"); m_iStatus = facy.self_.status_id = ID_STATUS_OFFLINE; SetEvent(update_loop_lock_); @@ -59,7 +59,7 @@ void FacebookProto::ChangeStatus(void*) Netlib_CloseHandle(facy.hMsgCon); facy.hMsgCon = NULL; - LOG("##### SignOff complete"); + debugLogA("##### SignOff complete"); return; } @@ -69,7 +69,7 @@ void FacebookProto::ChangeStatus(void*) GetLocalTime(&t); debugLogA("[%d.%d.%d] Using Facebook Protocol RM %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING); - LOG("***** Beginning SignOn process"); + debugLogA("***** Beginning SignOn process"); m_iStatus = facy.self_.status_id = ID_STATUS_CONNECTING; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); @@ -111,13 +111,13 @@ void FacebookProto::ChangeStatus(void*) m_iStatus = m_iDesiredStatus = facy.self_.status_id = ID_STATUS_OFFLINE; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); - LOG("***** SignOn failed"); + debugLogA("***** SignOn failed"); return; } ToggleStatusMenuItems(true); - LOG("***** SignOn complete"); + debugLogA("***** SignOn complete"); } else if (new_status == ID_STATUS_INVISIBLE) { @@ -131,13 +131,13 @@ void FacebookProto::ChangeStatus(void*) m_iStatus = facy.self_.status_id = m_iDesiredStatus; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); - LOG("***** ChangeStatus complete"); + debugLogA("***** ChangeStatus complete"); } /** Return true on success, false on error. */ bool FacebookProto::NegotiateConnection() { - LOG("***** Negotiating connection with Facebook"); + debugLogA("***** Negotiating connection with Facebook"); DBVARIANT dbv = {0}; @@ -173,7 +173,7 @@ bool FacebookProto::NegotiateConnection() void FacebookProto::UpdateLoop(void *) { time_t tim = ::time(NULL); - LOG(">>>>> Entering Facebook::UpdateLoop[%d]", tim); + debugLogA(">>>>> Entering Facebook::UpdateLoop[%d]", tim); for (int i = -1; !isOffline(); i = ++i % 50) { @@ -189,29 +189,29 @@ void FacebookProto::UpdateLoop(void *) if (i == 49) ForkThread(&FacebookProto::ProcessFriendRequests, NULL); - LOG("***** FacebookProto::UpdateLoop[%d] going to sleep...", tim); + debugLogA("***** FacebookProto::UpdateLoop[%d] going to sleep...", tim); if (WaitForSingleObjectEx(update_loop_lock_, GetPollRate() * 1000, true) != WAIT_TIMEOUT) break; - LOG("***** FacebookProto::UpdateLoop[%d] waking up...", tim); + debugLogA("***** FacebookProto::UpdateLoop[%d] waking up...", tim); } ResetEvent(update_loop_lock_); - LOG("<<<<< Exiting FacebookProto::UpdateLoop[%d]", tim); + debugLogA("<<<<< Exiting FacebookProto::UpdateLoop[%d]", tim); } void FacebookProto::MessageLoop(void *) { time_t tim = ::time(NULL); - LOG(">>>>> Entering Facebook::MessageLoop[%d]", tim); + debugLogA(">>>>> Entering Facebook::MessageLoop[%d]", tim); while (facy.channel()) { if (isOffline()) break; - LOG("***** FacebookProto::MessageLoop[%d] refreshing...", tim); + debugLogA("***** FacebookProto::MessageLoop[%d] refreshing...", tim); } - LOG("<<<<< Exiting FacebookProto::MessageLoop[%d]", tim); + debugLogA("<<<<< Exiting FacebookProto::MessageLoop[%d]", tim); } BYTE FacebookProto::GetPollRate() diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 97ca204e9e..21ea7fa2d5 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -34,7 +34,7 @@ void FacebookProto::ProcessBuddyList(void* data) if (isOffline()) goto exit; - LOG("***** Starting processing buddy list"); + debugLogA("***** Starting processing buddy list"); CODE_BLOCK_TRY @@ -63,7 +63,7 @@ void FacebookProto::ProcessBuddyList(void* data) fbu->status_id = ID_STATUS_OFFLINE; break; } - LOG(" Now %s: %s", status, fbu->user_id.c_str()); + debugLogA(" Now %s: %s", status, fbu->user_id.c_str()); if (!fbu->deleted) { @@ -125,11 +125,11 @@ void FacebookProto::ProcessBuddyList(void* data) } } - LOG("***** Buddy list processed"); + debugLogA("***** Buddy list processed"); CODE_BLOCK_CATCH - LOG("***** Error processing buddy list: %s", e.what()); + debugLogA("***** Error processing buddy list: %s", e.what()); CODE_BLOCK_END @@ -144,7 +144,7 @@ void FacebookProto::ProcessFriendList(void* data) std::string* resp = (std::string*)data; - LOG("***** Starting processing friend list"); + debugLogA("***** Starting processing friend list"); CODE_BLOCK_TRY @@ -252,11 +252,11 @@ void FacebookProto::ProcessFriendList(void* data) friends.clear(); - LOG("***** Friend list processed"); + debugLogA("***** Friend list processed"); CODE_BLOCK_CATCH - LOG("***** Error processing friend list: %s", e.what()); + debugLogA("***** Error processing friend list: %s", e.what()); CODE_BLOCK_END @@ -291,11 +291,11 @@ void FacebookProto::ProcessUnreadMessages(void*) ForkThread(&FacebookProto::ProcessUnreadMessage, new std::vector(threads)); - LOG("***** Unread threads list processed"); + debugLogA("***** Unread threads list processed"); CODE_BLOCK_CATCH - LOG("***** Error processing unread threads list: %s", e.what()); + debugLogA("***** Error processing unread threads list: %s", e.what()); CODE_BLOCK_END @@ -384,10 +384,10 @@ void FacebookProto::ProcessUnreadMessage(void *p) for (std::vector::size_type i = 0; i < messages.size(); i++) { if (messages[i]->isChat) { - LOG(" Got chat message: %s", messages[i]->message_text.c_str()); + debugLogA(" Got chat message: %s", messages[i]->message_text.c_str()); UpdateChat(messages[i]->thread_id.c_str(), messages[i]->user_id.c_str(), messages[i]->sender_name.c_str(), messages[i]->message_text.c_str(), local_timestamp || !messages[i]->time ? ::time(NULL) : messages[i]->time); } else if (messages[i]->user_id != facy.self_.user_id) { - LOG(" Got message: %s", messages[i]->message_text.c_str()); + debugLogA(" Got message: %s", messages[i]->message_text.c_str()); facebook_user fbu; fbu.user_id = messages[i]->user_id; fbu.real_name = messages[i]->sender_name; @@ -423,11 +423,11 @@ void FacebookProto::ProcessUnreadMessage(void *p) } messages.clear(); - LOG("***** Unread messages processed"); + debugLogA("***** Unread messages processed"); CODE_BLOCK_CATCH - LOG("***** Error processing unread messages: %s", e.what()); + debugLogA("***** Error processing unread messages: %s", e.what()); CODE_BLOCK_END @@ -453,7 +453,7 @@ void FacebookProto::ProcessMessages(void* data) if (isOffline()) goto exit; - LOG("***** Starting processing messages"); + debugLogA("***** Starting processing messages"); CODE_BLOCK_TRY @@ -470,7 +470,7 @@ void FacebookProto::ProcessMessages(void* data) { if (messages[i]->user_id != facy.self_.user_id) { - LOG(" Got message: %s", messages[i]->message_text.c_str()); + debugLogA(" Got message: %s", messages[i]->message_text.c_str()); facebook_user fbu; fbu.user_id = messages[i]->user_id; fbu.real_name = messages[i]->sender_name; @@ -507,7 +507,7 @@ void FacebookProto::ProcessMessages(void* data) for(std::vector::size_type i=0; itext.c_str()); + debugLogA(" Got notification: %s", notifications[i]->text.c_str()); ptrT szTitle( mir_utf8decodeT(this->m_szModuleName)); ptrT szText( mir_utf8decodeT(notifications[i]->text.c_str())); NotifyEvent(szTitle, szText, ContactIDToHContact(notifications[i]->user_id), FACEBOOK_EVENT_NOTIFICATION, ¬ifications[i]->link, ¬ifications[i]->id); @@ -515,11 +515,11 @@ void FacebookProto::ProcessMessages(void* data) } notifications.clear(); - LOG("***** Messages processed"); + debugLogA("***** Messages processed"); CODE_BLOCK_CATCH - LOG("***** Error processing messages: %s", e.what()); + debugLogA("***** Error processing messages: %s", e.what()); CODE_BLOCK_END @@ -547,7 +547,7 @@ void FacebookProto::ProcessNotifications(void*) // Process notifications - LOG("***** Starting processing notifications"); + debugLogA("***** Starting processing notifications"); CODE_BLOCK_TRY @@ -559,7 +559,7 @@ void FacebookProto::ProcessNotifications(void*) for(std::vector::size_type i=0; itext.c_str()); + debugLogA(" Got notification: %s", notifications[i]->text.c_str()); ptrT szTitle( mir_utf8decodeT(this->m_szModuleName)); ptrT szText( mir_utf8decodeT(notifications[i]->text.c_str())); NotifyEvent(szTitle, szText, ContactIDToHContact(notifications[i]->user_id), FACEBOOK_EVENT_NOTIFICATION, ¬ifications[i]->link, ¬ifications[i]->id); @@ -567,11 +567,11 @@ void FacebookProto::ProcessNotifications(void*) } notifications.clear(); - LOG("***** Notifications processed"); + debugLogA("***** Notifications processed"); CODE_BLOCK_CATCH - LOG("***** Error processing notifications: %s", e.what()); + debugLogA("***** Error processing notifications: %s", e.what()); CODE_BLOCK_END } @@ -650,13 +650,13 @@ void FacebookProto::ProcessFriendRequests(void*) db_event_add(0, &dbei); - LOG(" (New) Friendship request from: %s (%s) [%s]", fbu->real_name.c_str(), fbu->user_id.c_str(), time.c_str()); + debugLogA(" (New) Friendship request from: %s (%s) [%s]", fbu->real_name.c_str(), fbu->user_id.c_str(), time.c_str()); } else { - LOG(" (Old) Friendship request from: %s (%s) [%s]", fbu->real_name.c_str(), fbu->user_id.c_str(), time.c_str()); + debugLogA(" (Old) Friendship request from: %s (%s) [%s]", fbu->real_name.c_str(), fbu->user_id.c_str(), time.c_str()); } } else { - LOG(" !!! Wrong friendship request"); - LOG(req.c_str()); + debugLogA(" !!! Wrong friendship request"); + debugLogA(req.c_str()); } } @@ -675,7 +675,7 @@ void FacebookProto::ProcessFeeds(void* data) CODE_BLOCK_TRY - LOG("***** Starting processing feeds"); + debugLogA("***** Starting processing feeds"); std::vector< facebook_newsfeed* > news; @@ -747,7 +747,7 @@ void FacebookProto::ProcessFeeds(void* data) for(std::vector::size_type i=0; ititle.c_str(), news[i]->text.c_str()); + debugLogA(" Got newsfeed: %s %s", news[i]->title.c_str(), news[i]->text.c_str()); ptrT szTitle( mir_utf8decodeT(news[i]->title.c_str())); ptrT szText( mir_utf8decodeT(news[i]->text.c_str())); NotifyEvent(szTitle,szText,this->ContactIDToHContact(news[i]->user_id),FACEBOOK_EVENT_NEWSFEED, &news[i]->link); @@ -757,11 +757,11 @@ void FacebookProto::ProcessFeeds(void* data) this->facy.last_feeds_update_ = ::time(NULL); - LOG("***** Feeds processed"); + debugLogA("***** Feeds processed"); CODE_BLOCK_CATCH - LOG("***** Error processing feeds: %s", e.what()); + debugLogA("***** Error processing feeds: %s", e.what()); CODE_BLOCK_END diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index ceaca0e8e3..0ffac08490 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -141,7 +141,7 @@ DWORD_PTR FacebookProto::GetCaps(int type, HANDLE hContact) int FacebookProto::SetStatus(int new_status) { - LOG("===== Beginning SetStatus process"); + debugLogA("===== Beginning SetStatus process"); // Routing statuses not supported by Facebook switch (new_status) @@ -163,12 +163,12 @@ int FacebookProto::SetStatus(int new_status) } if (new_status != ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_CONNECTING) { - LOG("===== Status is already connecting, no change"); + debugLogA("===== Status is already connecting, no change"); return 0; } if (m_iStatus == m_iDesiredStatus) { - LOG("===== Statuses are same, no change"); + debugLogA("===== Statuses are same, no change"); return 0; } diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index c9b6eb561a..d3f5d4680e 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -470,24 +470,3 @@ int utils::number::random() srand(::time(NULL)); return rand(); } - -/* -int utils::debug::log(std::string file_name, std::string text) -{ - char szFile[MAX_PATH]; - GetModuleFileNameA(g_hInstance, szFile, SIZEOF(szFile)); - std::string path = szFile; - path = path.substr(0, path.rfind("\\")); - path = path.substr(0, path.rfind("\\") + 1); - path = path + file_name.c_str() + ".txt"; - - SYSTEMTIME time; - GetLocalTime(&time); - - std::ofstream out(path.c_str(), std::ios_base::out | std::ios_base::app | std::ios_base::ate); - out << "[" << (time.wHour < 10 ? "0" : "") << time.wHour << ":" << (time.wMinute < 10 ? "0" : "") << time.wMinute << ":" << (time.wSecond < 10 ? "0" : "") << time.wSecond << "] " << text << std::endl; - out.close(); - - return EXIT_SUCCESS; -} -*/ \ No newline at end of file diff --git a/protocols/FacebookRM/src/utils.h b/protocols/FacebookRM/src/utils.h index 5be3bdb0c9..35f043410b 100644 --- a/protocols/FacebookRM/src/utils.h +++ b/protocols/FacebookRM/src/utils.h @@ -80,11 +80,6 @@ namespace utils return !(iss >> f >> t).fail(); } }; - - namespace debug - { - //int log(std::string file_name, std::string text); - }; }; class ScopedLock -- cgit v1.2.3