From dd25f3bf3d7c8f1e21c10955cdeaae588c864bf9 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 11 Jul 2017 10:41:26 +0300 Subject: NewsAggregator: fix for getting some channels --- plugins/NewsAggregator/Src/CheckFeed.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 14a7984c2c..2be3a3d965 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -36,7 +36,19 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) LPCTSTR codepage = NULL; int childcount = 0; HXML node; - if (!mir_wstrcmpi(xmlGetName(hXml), L"xml")) { + HXML tmpnode = xmlGetFirstChild(hXml); + if (!mir_wstrcmpi(xmlGetName(tmpnode), L"xml")) { + int attrcount = xmlGetAttrCount(tmpnode); + for (int i = 0; i < attrcount; i++) { + LPCTSTR szAttrName = xmlGetAttrName(tmpnode, i); + if (!mir_wstrcmpi(szAttrName, L"encoding")) { + codepage = xmlGetAttrValue(tmpnode, szAttrName); + break; + } + } + node = xmlGetChild(tmpnode, childcount); + } + else if (!mir_wstrcmpi(xmlGetName(hXml), L"xml")) { int attrcount = xmlGetAttrCount(hXml); for (int i = 0; i < attrcount; i++) { LPCTSTR szAttrName = xmlGetAttrName(hXml, i); @@ -205,7 +217,19 @@ void CheckCurrentFeed(MCONTACT hContact) LPCTSTR codepage = NULL; int childcount = 0; HXML node; - if (!mir_wstrcmpi(xmlGetName(hXml), L"xml")) { + HXML tmpnode = xmlGetFirstChild(hXml); + if (!mir_wstrcmpi(xmlGetName(tmpnode), L"xml")) { + int attrcount = xmlGetAttrCount(tmpnode); + for (int i = 0; i < attrcount; i++) { + LPCTSTR szAttrName = xmlGetAttrName(tmpnode, i); + if (!mir_wstrcmpi(szAttrName, L"encoding")) { + codepage = xmlGetAttrValue(tmpnode, szAttrName); + break; + } + } + node = xmlGetChild(tmpnode, childcount); + } + else if (!mir_wstrcmpi(xmlGetName(hXml), L"xml")) { int attrcount = xmlGetAttrCount(hXml); for (int i = 0; i < attrcount; i++) { LPCTSTR szAttrName = xmlGetAttrName(hXml, i); -- cgit v1.2.3