From bfb6e607aa1c602e43267c5c43657c886bfad631 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Jun 2016 12:37:22 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@16962 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_iqid.cpp | 37 ++++++++++++++++++++------------- protocols/JabberG/src/jabber_menu.cpp | 2 +- protocols/JabberG/src/jabber_proto.h | 6 +++--- protocols/JabberG/src/jabber_search.cpp | 8 +++---- protocols/JabberG/src/jabber_thread.cpp | 2 +- 5 files changed, 32 insertions(+), 23 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index aa46c9e544..fdba87e6cf 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -52,7 +52,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) if (!mir_tstrcmp(tmp.category, _T("pubsub")) && !mir_tstrcmp(tmp.type, _T("pep"))) { m_bPepSupported = true; - EnableMenuItems(TRUE); + EnableMenuItems(true); RebuildInfoFrame(); continue; } @@ -82,10 +82,10 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInfo) { const TCHAR *szGroupDelimeter = NULL; - BOOL bPrivateStorageSupport = FALSE; + bool bPrivateStorageSupport = false; if (iqNode && pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) { - bPrivateStorageSupport = TRUE; + bPrivateStorageSupport = true; szGroupDelimeter = XPathFmt(iqNode, _T("query[@xmlns='%s']/roster[@xmlns='%s']"), JABBER_FEAT_PRIVATE_STORAGE, JABBER_FEAT_NESTED_ROSTER_GROUPS); if (szGroupDelimeter && !szGroupDelimeter[0]) szGroupDelimeter = NULL; // "" as roster delimeter is not supported :) @@ -371,7 +371,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) OBJLIST *httpavatars = new OBJLIST(20, JABBER_HTTP_AVATARS::compare); for (int i = 0;; i++) { - BOOL bIsTransport = FALSE; + bool bIsTransport = false; HXML itemNode = XmlGetChild(queryNode, i); if (!itemNode) @@ -393,7 +393,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (jid == NULL) continue; if (_tcschr(jid, '@') == NULL) - bIsTransport = TRUE; + bIsTransport = true; const TCHAR *name = XmlGetAttrValue(itemNode, _T("name")); TCHAR *nick = (name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid); @@ -473,9 +473,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (hContact != NULL) { if (bIsTransport) - setByte(hContact, "IsTransport", TRUE); + setByte(hContact, "IsTransport", true); else - setByte(hContact, "IsTransport", FALSE); + setByte(hContact, "IsTransport", false); } const TCHAR *imagepath = XmlGetAttrValue(itemNode, _T("vz:img")); @@ -501,7 +501,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) } } - EnableMenuItems(TRUE); + EnableMenuItems(true); debugLogA("Status changed via THREADSTART"); SetServerStatus(m_iDesiredStatus); @@ -560,7 +560,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) if (!mir_tstrcmp(type, _T("result"))) { MCONTACT hContact = HContactFromJID(from); if (hContact != NULL) - setByte(hContact, "IsTransport", TRUE); + setByte(hContact, "IsTransport", true); if (m_hwndRegProgress) SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)TranslateT("Registration successful")); @@ -615,7 +615,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP debugLogA("%d bytes written", nWritten); if (hContact == NULL) { - hasPhoto = TRUE; + hasPhoto = true; CallService(MS_AV_SETMYAVATART, (WPARAM)m_szModuleName, (LPARAM)szAvatarFileName); debugLog(_T("My picture saved to %s"), szAvatarFileName); @@ -630,7 +630,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP item->bUseResource = true; } if (item != NULL) { - hasPhoto = TRUE; + hasPhoto = true; if (item->photoFileName && mir_tstrcmp(item->photoFileName, szAvatarFileName)) DeleteFile(item->photoFileName); replaceStrT(item->photoFileName, szAvatarFileName); @@ -1121,7 +1121,16 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) delSetting(hContact, "CompanyPosition"); if (!hasDesc) delSetting(hContact, "About"); + if (!hasPhoto) { + debugLogA("Has no avatar"); + delSetting(hContact, "AvatarHash"); + if (ptrT(getTStringA(hContact, "AvatarSaved")) != NULL) { + delSetting(hContact, "AvatarSaved"); + ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, NULL); + } + } + if (id == m_ThreadInfo->resolveID) { const TCHAR *p = _tcschr(jid, '@'); ResolveTransportNicks((p != NULL) ? p + 1 : jid); @@ -1468,7 +1477,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) if (!mir_tstrcmp(type, _T("result"))) { if (m_ThreadInfo && !(m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) { m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PRIVATE_STORAGE; - EnableMenuItems(TRUE); + EnableMenuItems(true); } if (HXML storageNode = XPathT(iqNode, "query/storage[@xmlns='storage:bookmarks']")) { @@ -1499,14 +1508,14 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) } UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_REFRESH); - m_ThreadInfo->bBookmarksLoaded = TRUE; + m_ThreadInfo->bBookmarksLoaded = true; OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_BOOKMARKS); } } else if (!mir_tstrcmp(type, _T("error"))) { if (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE) { m_ThreadInfo->jabberServerCaps &= ~JABBER_CAPS_PRIVATE_STORAGE; - EnableMenuItems(TRUE); + EnableMenuItems(true); UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_ACTIVATE); } } diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 6f5be21d83..4a20f0dc88 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -881,7 +881,7 @@ void CJabberProto::GlobalMenuUninit() m_nMenuResourceItems = 0; } -void CJabberProto::EnableMenuItems(BOOL bEnable) +void CJabberProto::EnableMenuItems(bool bEnable) { m_menuItemsStatus = bEnable; CheckMenuItems(); diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 0cdc87a234..a594a451a4 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -642,7 +642,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo *pInfo); int SearchRenewFields(HWND hwndDlg, JabberSearchData * dat); - void SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFromDB = TRUE); + void SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFromDB); void SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog = NULL); //---- jabber_std.cpp ---------------------------------------------- @@ -651,7 +651,7 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_svc.c ------------------------------------------------------------------ void CheckMenuItems(); - void EnableMenuItems(BOOL bEnable); + void EnableMenuItems(bool bEnable); INT_PTR __cdecl JabberGetAvatar(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl JabberGetAvatarCaps(WPARAM wParam, LPARAM lParam); @@ -818,7 +818,7 @@ private: LONG m_nSerial; HGENMENU m_hPrivacyMenuRoot; - BOOL m_menuItemsStatus; + bool m_menuItemsStatus; LIST m_hPrivacyMenuItems; int m_nMenuResourceItems; diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 3025d4a400..fde6109462 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -401,7 +401,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) SearchReturnResults((HANDLE)id, (void*)&SearchResults, (U_TCHAR_MAP *)&mColumnsNames); for (int i = 0; i < SearchResults.getCount(); i++) - delete ((U_TCHAR_MAP *)SearchResults[i]); + delete ((U_TCHAR_MAP*)SearchResults[i]); //send success to finish searching ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0); @@ -488,9 +488,9 @@ static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const TCHAR *szAddr) SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szAddr); } -void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFromDB) +void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFromDB) { - //search in recent + // search in recent for (int i = 0; i < 10; i++) { char key[30]; mir_snprintf(key, "RecentlySearched_%d", i); @@ -520,7 +520,7 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) { char key[30]; - SearchDeleteFromRecent(szAddr); + SearchDeleteFromRecent(szAddr, true); for (int j = 9; j > 0; j--) { mir_snprintf(key, "RecentlySearched_%d", j - 1); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index f4e012174f..64d43d4404 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -499,7 +499,7 @@ recvRest: m_iqManager.ExpireAll(); m_bJabberOnline = false; info.zlibUninit(); - EnableMenuItems(FALSE); + EnableMenuItems(false); RebuildInfoFrame(); if (m_hwndJabberChangePassword) // Since this is a different thread, simulate the click on the cancel button instead -- cgit v1.2.3