From 0b39e2b4ed0b578040a1eb584d045c6202885f7d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 20 Jul 2013 08:44:43 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@5424 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_caps.cpp | 10 +++++----- protocols/JabberG/src/jabber_list.h | 18 ++---------------- protocols/JabberG/src/jabber_userinfo.cpp | 27 ++++++++++++++------------- 3 files changed, 21 insertions(+), 34 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 8833030c5c..a8719a4c63 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -116,19 +116,19 @@ void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo* pInfo) if (r->pSoftwareInfo) { TCHAR *szTmp = XPath(xform, _T("field[@var='os']/value")); if (szTmp) - r->pSoftwareInfo->szOs = mir_tstrdup(szTmp); + r->pSoftwareInfo->tszOs = mir_tstrdup(szTmp); szTmp = XPath(xform, _T("field[@var='os_version']/value")); if (szTmp) - r->pSoftwareInfo->szOsVersion = mir_tstrdup(szTmp); + r->pSoftwareInfo->tszOsVersion = mir_tstrdup(szTmp); szTmp = XPath(xform, _T("field[@var='software']/value")); if (szTmp) - r->pSoftwareInfo->szSoftware = mir_tstrdup(szTmp); + r->pSoftwareInfo->tszSoftware = mir_tstrdup(szTmp); szTmp = XPath(xform, _T("field[@var='software_version']/value")); if (szTmp) - r->pSoftwareInfo->szSoftwareVersion = mir_tstrdup(szTmp); + r->pSoftwareInfo->tszSoftwareVersion = mir_tstrdup(szTmp); szTmp = XPath(xform, _T("field[@var='x-miranda-core-version']/value")); if (szTmp) - r->pSoftwareInfo->szXMirandaCoreVersion = mir_tstrdup(szTmp); + r->pSoftwareInfo->tszXMirandaCoreVersion = mir_tstrdup(szTmp); szTmp = XPath(xform, _T("field[@var='x-miranda-core-is-unicode']/value")); if ( !szTmp) // old deprecated format szTmp = XPath(xform, _T("field[@var='x-miranda-is-unicode']/value")); diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index e79da7d995..c2c7ad151e 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -68,26 +68,12 @@ typedef enum { // initial default to RSMODE_LASTSEEN } JABBER_RESOURCE_MODE; -struct JABBER_XEP0232_SOFTWARE_INFO +struct JABBER_XEP0232_SOFTWARE_INFO : public MZeroedObject { - TCHAR* szOs; - TCHAR* szOsVersion; - TCHAR* szSoftware; - TCHAR* szSoftwareVersion; - TCHAR* szXMirandaCoreVersion; + ptrT tszOs, tszOsVersion, tszSoftware, tszSoftwareVersion, tszXMirandaCoreVersion; BOOL bXMirandaIsUnicode; BOOL bXMirandaIsAlpha; BOOL bXMirandaIsDebug; - JABBER_XEP0232_SOFTWARE_INFO() { - ZeroMemory(this, sizeof(JABBER_XEP0232_SOFTWARE_INFO)); - } - ~JABBER_XEP0232_SOFTWARE_INFO() { - mir_free(szOs); - mir_free(szOsVersion); - mir_free(szSoftware); - mir_free(szSoftwareVersion); - mir_free(szXMirandaCoreVersion); - } }; struct JABBER_RESOURCE_STATUS diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 14a39aea14..c3d0a9fde5 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -299,19 +299,20 @@ static void sttFillResourceInfo(CJabberProto* ppro, HWND hwndTree, HTREEITEM hti if (res->pSoftwareInfo) { HTREEITEM htiSoftwareInfo = sttFillInfoLine(hwndTree, htiResource, ppro->LoadIconEx("main"), NULL, TranslateT("Software information"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION)); int nLineId = 0; - if (res->pSoftwareInfo->szOs) - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Operating system"), res->pSoftwareInfo->szOs, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); - if (res->pSoftwareInfo->szOsVersion) - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Operating system version"), res->pSoftwareInfo->szOsVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); - if (res->pSoftwareInfo->szSoftware) - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Software"), res->pSoftwareInfo->szSoftware, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); - if (res->pSoftwareInfo->szSoftwareVersion) - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Software version"), res->pSoftwareInfo->szSoftwareVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); - if (res->pSoftwareInfo->szXMirandaCoreVersion) { - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Miranda NG core version"), res->pSoftwareInfo->szXMirandaCoreVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Unicode build"), res->pSoftwareInfo->bXMirandaIsUnicode ? TranslateT("Yes") : TranslateT("No"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Alpha build"), res->pSoftwareInfo->bXMirandaIsAlpha ? TranslateT("Yes") : TranslateT("No"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); - sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Debug build"), res->pSoftwareInfo->bXMirandaIsDebug ? TranslateT("Yes") : TranslateT("No"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + JABBER_XEP0232_SOFTWARE_INFO *p = res->pSoftwareInfo; + if (p->tszOs) + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Operating system"), p->tszOs, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + if (p->tszOsVersion) + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Operating system version"), p->tszOsVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + if (p->tszSoftware) + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Software"), p->tszSoftware, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + if (p->tszSoftwareVersion) + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Software version"), p->tszSoftwareVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + if (p->tszXMirandaCoreVersion) { + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Miranda NG core version"), p->tszXMirandaCoreVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Unicode build"), p->bXMirandaIsUnicode ? TranslateT("Yes") : TranslateT("No"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Alpha build"), p->bXMirandaIsAlpha ? TranslateT("Yes") : TranslateT("No"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); + sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Debug build"), p->bXMirandaIsDebug ? TranslateT("Yes") : TranslateT("No"), sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); } } } -- cgit v1.2.3