From cc6abc9eed963a2659c121ddec136f1ab4256535 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 25 Jun 2015 19:22:17 +0000 Subject: - Set wparam and lParam to 0 as default arg in CallService and others, to simplify some code git-svn-id: http://svn.miranda-ng.org/main/trunk@14385 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_database.h | 2 +- protocols/Yahoo/src/chat.cpp | 6 +++--- protocols/Yahoo/src/proto.cpp | 4 ++-- protocols/Yahoo/src/server.cpp | 2 +- protocols/Yahoo/src/services.cpp | 27 ++++++++++----------------- protocols/Yahoo/src/yahoo.cpp | 8 ++++---- 6 files changed, 21 insertions(+), 28 deletions(-) diff --git a/include/m_database.h b/include/m_database.h index 1d032b044f..b1041ca429 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -289,7 +289,7 @@ MIR_CORE_DLL(MEVENT) db_event_prev(MCONTACT hContact, MEVENT hDbEvent); MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue = 0); MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue = 0); -MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue); +MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue = 0); MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting); MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting); diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index f1a576055f..07c8fb6d10 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -289,7 +289,7 @@ int __cdecl CYahooProto::OnGCEventHook(WPARAM, LPARAM lParam) break; case GC_USER_PRIVMESS: - CallService(MS_MSG_SENDMESSAGE, (WPARAM)getbuddyH(who), 0); + CallService(MS_MSG_SENDMESSAGE, (WPARAM)getbuddyH(who)); break; case GC_USER_LOGMENU: @@ -308,11 +308,11 @@ int __cdecl CYahooProto::OnGCEventHook(WPARAM, LPARAM lParam) case GC_USER_NICKLISTMENU: switch (gch->dwData) { case 10: - CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)getbuddyH(who), 0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)getbuddyH(who)); break; case 20: - CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)getbuddyH(who), 0); + CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)getbuddyH(who)); break; case 110: diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 2c2d9a42ea..faab974481 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -117,7 +117,7 @@ MCONTACT CYahooProto::AddToList(int flags, PROTOSEARCHRESULT *psr) char *id = psr->flags & PSR_UNICODE ? mir_utf8encodeW((wchar_t*)psr->id.t) : mir_utf8encode((char*)psr->id.t); MCONTACT hContact = getbuddyH(id); if (hContact != NULL) { - if (db_get_b(hContact, "CList", "NotOnList", 0)) { + if (db_get_b(hContact, "CList", "NotOnList")) { debugLogA("[YahooAddToList] Temporary Buddy:%s already on our buddy list", id); //return 0; } @@ -256,7 +256,7 @@ int CYahooProto::AuthDeny(MEVENT hdbe, const TCHAR *reason) debugLogA("Rejecting buddy:%s msg: %s", who, u_reason); reject(myid, who, getWord(hContact, "yprotoid", 0), u_reason); - CallService(MS_DB_CONTACT_DELETE, hContact, 0); + CallService(MS_DB_CONTACT_DELETE, hContact); } } return 0; diff --git a/protocols/Yahoo/src/server.cpp b/protocols/Yahoo/src/server.cpp index c9b742fb2a..385eed93ba 100644 --- a/protocols/Yahoo/src/server.cpp +++ b/protocols/Yahoo/src/server.cpp @@ -110,7 +110,7 @@ void __cdecl CYahooProto::server_main(void *empty) debugLogA("Last connection closed."); break; } - recvResult = CallService(MS_NETLIB_SELECTEX, (WPARAM)0, (LPARAM)&nls); + recvResult = CallService(MS_NETLIB_SELECTEX, 0, (LPARAM)&nls); /* do the timer check */ if (m_id > 0) { diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 2ffd9f32d8..644de2d398 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -89,7 +89,7 @@ int __cdecl CYahooProto::OnContactDeleted(WPARAM hContact, LPARAM lParam) } // he is not a permanent contact! - if (db_get_b(hContact, "CList", "NotOnList", 0) != 0) { + if (db_get_b(hContact, "CList", "NotOnList") != 0) { debugLogA("[YahooContactDeleted] Not a permanent buddy!!!"); return 0; } @@ -265,7 +265,7 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR __cdecl CYahooProto::OnEditMyProfile(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CYahooProto::OnEditMyProfile(WPARAM, LPARAM) { OpenURL("http://edit.yahoo.com/config/eval_profile", 1); return 0; @@ -274,7 +274,7 @@ INT_PTR __cdecl CYahooProto::OnEditMyProfile(WPARAM wParam, LPARAM lParam) //======================================================= //Show My profile //======================================================= -INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand(WPARAM, LPARAM) { DBVARIANT dbv; @@ -294,23 +294,19 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand(WPARAM wParam, LPARAM lParam //======================================================= //Show Goto mailbox //======================================================= -INT_PTR __cdecl CYahooProto::OnGotoMailboxCommand(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CYahooProto::OnGotoMailboxCommand(WPARAM, LPARAM) { - if (getByte("YahooJapan", 0)) - OpenURL("http://mail.yahoo.co.jp/", 1); - else - OpenURL("http://mail.yahoo.com/", 1); - + OpenURL(getByte("YahooJapan", 0) ? "http://mail.yahoo.co.jp/" : "http://mail.yahoo.com/", 1); return 0; } -INT_PTR __cdecl CYahooProto::OnABCommand(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CYahooProto::OnABCommand(WPARAM, LPARAM) { OpenURL("http://address.yahoo.com/yab/", 1); return 0; } -INT_PTR __cdecl CYahooProto::OnCalendarCommand(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CYahooProto::OnCalendarCommand(WPARAM, LPARAM) { OpenURL("http://calendar.yahoo.com/", 1); return 0; @@ -319,7 +315,7 @@ INT_PTR __cdecl CYahooProto::OnCalendarCommand(WPARAM wParam, LPARAM lParam) //======================================================= //Refresh Yahoo //======================================================= -INT_PTR __cdecl CYahooProto::OnRefreshCommand(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CYahooProto::OnRefreshCommand(WPARAM, LPARAM) { if (!m_bLoggedIn) { ShowNotification(TranslateT("Yahoo Error"), TranslateT("You need to be connected to refresh your buddy list"), NIIF_ERROR); @@ -353,12 +349,9 @@ int __cdecl CYahooProto::OnIdleEvent(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR __cdecl CYahooProto::GetUnreadEmailCount(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CYahooProto::GetUnreadEmailCount(WPARAM, LPARAM) { - if (!m_bLoggedIn) - return 0; - - return m_unreadMessages; + return m_bLoggedIn ? m_unreadMessages : 0; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 1975b778be..0a08837a8c 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -261,7 +261,7 @@ MCONTACT CYahooProto::add_buddy(const char *yahoo_id, const char *yahoo_name, in //not already there: add LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags)); - hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD); Proto_AddToContact(hContact, m_szModuleName); setString(hContact, YAHOO_LOGINID, yid); Set_Protocol(hContact, protocol); @@ -666,7 +666,7 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) * Make sure the contact is temporary so we could delete it w/o extra traffic */ db_set_b(hContact, "CList", "NotOnList", 1); - CallService(MS_DB_CONTACT_DELETE, hContact, 0); + CallService(MS_DB_CONTACT_DELETE, hContact); } else LOG(("[ext_rejected] Buddy not on our buddy list")); @@ -698,7 +698,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status ShowPopup(TranslateT("Invalid Contact"), TranslateT("The ID you tried to add is invalid."), NULL); /* Make it TEMP first, we don't want to send any extra packets for FALSE ids */ db_set_b(hContact, "CList", "NotOnList", 1); - CallService(MS_DB_CONTACT_DELETE, hContact, 0); + CallService(MS_DB_CONTACT_DELETE, hContact); } break; @@ -708,7 +708,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status ShowPopup(TranslateT("Invalid Contact"), TranslateT("Unknown Error."), NULL); /* Make it TEMP first, we don't want to send any extra packets for FALSE ids */ db_set_b(hContact, "CList", "NotOnList", 1); - CallService(MS_DB_CONTACT_DELETE, hContact, 0); + CallService(MS_DB_CONTACT_DELETE, hContact); } break; -- cgit v1.2.3