From 8ae3679aa1339ce9abee53adb69902bd6b7513dc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Jul 2016 10:31:04 +0000 Subject: hello, Unix. phase 1: removing _T() git-svn-id: http://svn.miranda-ng.org/main/trunk@17127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewsAggregator/Src/CheckFeed.cpp | 194 ++++++++++++++-------------- plugins/NewsAggregator/Src/ExportImport.cpp | 82 ++++++------ plugins/NewsAggregator/Src/Options.cpp | 62 ++++----- plugins/NewsAggregator/Src/Services.cpp | 8 +- plugins/NewsAggregator/Src/Utils.cpp | 76 +++++------ plugins/NewsAggregator/Src/stdafx.h | 2 +- 6 files changed, 212 insertions(+), 212 deletions(-) (limited to 'plugins/NewsAggregator/Src') diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index d152cca932..c9967ba341 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) { - Netlib_LogfT(hNetlibUser, _T("Started validating feed %s."), tszURL); + Netlib_LogfT(hNetlibUser, L"Started validating feed %s.", tszURL); char *szData = NULL; GetNewsData(tszURL, &szData, NULL, hwndDlg); if (szData) { @@ -36,11 +36,11 @@ LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) LPCTSTR codepage = NULL; int childcount = 0; HXML node; - if (!mir_tstrcmpi(xmlGetName(hXml), _T("xml"))) { + if (!mir_tstrcmpi(xmlGetName(hXml), L"xml")) { int attrcount = xmlGetAttrCount(hXml); for (int i = 0; i < attrcount; i++) { LPCTSTR szAttrName = xmlGetAttrName(hXml, i); - if (!mir_tstrcmpi(szAttrName, _T("encoding"))) { + if (!mir_tstrcmpi(szAttrName, L"encoding")) { codepage = xmlGetAttrValue(hXml, szAttrName); break; } @@ -51,15 +51,15 @@ LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) node = hXml; while (node) { LPCTSTR szNodeName = xmlGetName(node); - if (!mir_tstrcmpi(szNodeName, _T("rss")) || !mir_tstrcmpi(szNodeName, _T("rdf"))) { + if (!mir_tstrcmpi(szNodeName, L"rss") || !mir_tstrcmpi(szNodeName, L"rdf")) { HXML chan = xmlGetChild(node, 0); for (int j = 0; j < xmlGetChildCount(chan); j++) { HXML child = xmlGetChild(chan, j); - if (!mir_tstrcmpi(xmlGetName(child), _T("title"))) { + if (!mir_tstrcmpi(xmlGetName(child), L"title")) { TCHAR mes[MAX_PATH]; mir_sntprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION); - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); return mir_tstrdup(buf); @@ -69,14 +69,14 @@ LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) } } } - else if (!mir_tstrcmpi(szNodeName, _T("feed"))) { + else if (!mir_tstrcmpi(szNodeName, L"feed")) { for (int j = 0; j < xmlGetChildCount(node); j++) { HXML child = xmlGetChild(node, j); - if (!mir_tstrcmpi(xmlGetName(child), _T("title"))) { + if (!mir_tstrcmpi(xmlGetName(child), L"title")) { TCHAR mes[MAX_PATH]; mir_sntprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION); - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); return mir_tstrdup(buf); @@ -91,7 +91,7 @@ LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) } xmlDestroyNode(hXml); } - Netlib_LogfT(hNetlibUser, _T("%s is not a valid feed's address."), tszURL); + Netlib_LogfT(hNetlibUser, L"%s is not a valid feed's address.", tszURL); TCHAR mes[MAX_PATH]; mir_sntprintf(mes, TranslateT("%s\nis not a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR); @@ -105,39 +105,39 @@ static void XmlToMsg(MCONTACT hContact, CMString &title, CMString &link, CMStrin message = TAGSDEFAULT; if (title.IsEmpty()) - message.Replace(_T("##"), TranslateT("empty")); + message.Replace(L"#<title>#", TranslateT("empty")); else - message.Replace(_T("#<title>#"), title); + message.Replace(L"#<title>#", title); if (link.IsEmpty()) - message.Replace(_T("#<link>#"), TranslateT("empty")); + message.Replace(L"#<link>#", TranslateT("empty")); else - message.Replace(_T("#<link>#"), link); + message.Replace(L"#<link>#", link); if (descr.IsEmpty()) - message.Replace(_T("#<description>#"), TranslateT("empty")); + message.Replace(L"#<description>#", TranslateT("empty")); else - message.Replace(_T("#<description>#"), descr); + message.Replace(L"#<description>#", descr); if (author.IsEmpty()) - message.Replace(_T("#<author>#"), TranslateT("empty")); + message.Replace(L"#<author>#", TranslateT("empty")); else - message.Replace(_T("#<author>#"), author); + message.Replace(L"#<author>#", author); if (comments.IsEmpty()) - message.Replace(_T("#<comments>#"), TranslateT("empty")); + message.Replace(L"#<comments>#", TranslateT("empty")); else - message.Replace(_T("#<comments>#"), comments); + message.Replace(L"#<comments>#", comments); if (guid.IsEmpty()) - message.Replace(_T("#<guid>#"), TranslateT("empty")); + message.Replace(L"#<guid>#", TranslateT("empty")); else - message.Replace(_T("#<guid>#"), guid); + message.Replace(L"#<guid>#", guid); if (category.IsEmpty()) - message.Replace(_T("#<category>#"), TranslateT("empty")); + message.Replace(L"#<category>#", TranslateT("empty")); else - message.Replace(_T("#<category>#"), category); + message.Replace(L"#<category>#", category); DBEVENTINFO olddbei = { 0 }; olddbei.cbSize = sizeof(olddbei); @@ -187,7 +187,7 @@ void CheckCurrentFeed(MCONTACT hContact) if (szURL == NULL) return; - Netlib_LogfT(hNetlibUser, _T("Started checking feed %s."), szURL); + Netlib_LogfT(hNetlibUser, L"Started checking feed %s.", szURL); char *szData = NULL; GetNewsData(szURL, &szData, hContact, NULL); @@ -207,11 +207,11 @@ void CheckCurrentFeed(MCONTACT hContact) LPCTSTR codepage = NULL; int childcount = 0; HXML node; - if (!mir_tstrcmpi(xmlGetName(hXml), _T("xml"))) { + if (!mir_tstrcmpi(xmlGetName(hXml), L"xml")) { int attrcount = xmlGetAttrCount(hXml); for (int i = 0; i < attrcount; i++) { LPCTSTR szAttrName = xmlGetAttrName(hXml, i); - if (!mir_tstrcmpi(szAttrName, _T("encoding"))) { + if (!mir_tstrcmpi(szAttrName, L"encoding")) { codepage = xmlGetAttrValue(hXml, szAttrName); break; } @@ -222,29 +222,29 @@ void CheckCurrentFeed(MCONTACT hContact) node = hXml; while (node) { LPCTSTR szNodeName = xmlGetName(node); - bool isRSS = !mir_tstrcmpi(szNodeName, _T("rss")), isAtom = !mir_tstrcmpi(szNodeName, _T("rdf")); + bool isRSS = !mir_tstrcmpi(szNodeName, L"rss"), isAtom = !mir_tstrcmpi(szNodeName, L"rdf"); if (isRSS || isAtom) { if (isRSS) { for (int i = 0; i < xmlGetAttrCount(node); i++) { LPCTSTR szAttrName = xmlGetAttrName(node, i); - if (!mir_tstrcmpi(szAttrName, _T("version"))) { + if (!mir_tstrcmpi(szAttrName, L"version")) { TCHAR ver[MAX_PATH]; - mir_sntprintf(ver, _T("RSS %s"), xmlGetAttrValue(node, szAttrName)); + mir_sntprintf(ver, L"RSS %s", xmlGetAttrValue(node, szAttrName)); db_set_ts(hContact, MODULE, "MirVer", ver); break; } } } else if (isAtom) - db_set_ts(hContact, MODULE, "MirVer", _T("RSS 1.0")); + db_set_ts(hContact, MODULE, "MirVer", L"RSS 1.0"); HXML chan = xmlGetChild(node, 0); for (int j = 0; j < xmlGetChildCount(chan); j++) { HXML child = xmlGetChild(chan, j); LPCTSTR childName = xmlGetName(child); - if (!mir_tstrcmpi(childName, _T("title"))) { + if (!mir_tstrcmpi(childName, L"title")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -254,9 +254,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) db_set_ts(hContact, MODULE, "FirstName", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(childName, _T("link"))) { + else if (!mir_tstrcmpi(childName, L"link")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -266,9 +266,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) db_set_ts(hContact, MODULE, "Homepage", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(childName, _T("description"))) { + else if (!mir_tstrcmpi(childName, L"description")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -281,9 +281,9 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ts(hContact, "CList", "StatusMsg", szValue); } } - else if (!mir_tstrcmpi(childName, _T("language"))) { + else if (!mir_tstrcmpi(childName, L"language")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -293,9 +293,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) db_set_ts(hContact, MODULE, "Language1", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(childName, _T("managingEditor"))) { + else if (!mir_tstrcmpi(childName, L"managingEditor")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -305,9 +305,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) db_set_ts(hContact, MODULE, "e-mail", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(childName, _T("category"))) { + else if (!mir_tstrcmpi(childName, L"category")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -317,9 +317,9 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) db_set_ts(hContact, MODULE, "Interest0Text", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(childName, _T("copyright"))) { + else if (!mir_tstrcmpi(childName, L"copyright")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -329,10 +329,10 @@ void CheckCurrentFeed(MCONTACT hContact) if (szChildText) db_set_s(hContact, "UserInfo", "MyNotes", _T2A(ClearText(szValue, szChildText))); } - else if (!mir_tstrcmpi(childName, _T("image"))) { + else if (!mir_tstrcmpi(childName, L"image")) { for (int x = 0; x < xmlGetChildCount(child); x++) { HXML imageval = xmlGetChild(child, x); - if (!mir_tstrcmpi(xmlGetName(imageval), _T("url"))) { + if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) { LPCTSTR url = xmlGetText(imageval); db_set_ts(hContact, MODULE, "ImageURL", url); @@ -345,8 +345,8 @@ void CheckCurrentFeed(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(url); CMString filename = szNick; - filename.Replace(_T("/"), _T("_")); - mir_sntprintf(ai.filename, _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext); + filename.Replace(L"/", L"_"); + mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename.c_str(), ext); CreateDirectoryTreeT(tszRoot); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); @@ -359,9 +359,9 @@ void CheckCurrentFeed(MCONTACT hContact) } } } - else if (!mir_tstrcmpi(childName, _T("lastBuildDate"))) { + else if (!mir_tstrcmpi(childName, L"lastBuildDate")) { LPCTSTR szChildText = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; @@ -379,14 +379,14 @@ void CheckCurrentFeed(MCONTACT hContact) } } } - else if (!mir_tstrcmpi(childName, _T("item"))) { + else if (!mir_tstrcmpi(childName, L"item")) { CMString title, link, descr, author, comments, guid, category; time_t stamp = 0; for (int z = 0; z < xmlGetChildCount(child); z++) { HXML itemval = xmlGetChild(child, z); LPCTSTR itemName = xmlGetName(itemval); LPCTSTR value = NULL; - if (!mir_tstrcmpi(codepage, _T("koi8-r"))) { + if (!mir_tstrcmpi(codepage, L"koi8-r")) { TCHAR buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(itemval)), -1, buf, _countof(buf)); value = buf; @@ -395,29 +395,29 @@ void CheckCurrentFeed(MCONTACT hContact) value = xmlGetText(itemval); // We only use the first tag for now and ignore the rest. - if (!mir_tstrcmpi(itemName, _T("title"))) + if (!mir_tstrcmpi(itemName, L"title")) ClearText(title, value); - else if (!mir_tstrcmpi(itemName, _T("link"))) + else if (!mir_tstrcmpi(itemName, L"link")) ClearText(link, value); - else if (!mir_tstrcmpi(itemName, _T("pubDate")) || !mir_tstrcmpi(itemName, _T("date"))) { + else if (!mir_tstrcmpi(itemName, L"pubDate") || !mir_tstrcmpi(itemName, L"date")) { if (stamp == 0) stamp = DateToUnixTime(value, 0); } - else if (!mir_tstrcmpi(itemName, _T("description")) || !mir_tstrcmpi(itemName, _T("encoded"))) + else if (!mir_tstrcmpi(itemName, L"description") || !mir_tstrcmpi(itemName, L"encoded")) ClearText(descr, value); - else if (!mir_tstrcmpi(itemName, _T("author")) || !mir_tstrcmpi(itemName, _T("creator"))) + else if (!mir_tstrcmpi(itemName, L"author") || !mir_tstrcmpi(itemName, L"creator")) ClearText(author, value); - else if (!mir_tstrcmpi(itemName, _T("comments"))) + else if (!mir_tstrcmpi(itemName, L"comments")) ClearText(comments, value); - else if (!mir_tstrcmpi(itemName, _T("guid"))) + else if (!mir_tstrcmpi(itemName, L"guid")) ClearText(guid, value); - else if (!mir_tstrcmpi(itemName, _T("category"))) + else if (!mir_tstrcmpi(itemName, L"category")) ClearText(category, value); } @@ -425,27 +425,27 @@ void CheckCurrentFeed(MCONTACT hContact) } } } - else if (!mir_tstrcmpi(szNodeName, _T("feed"))) { - db_set_ts(hContact, MODULE, "MirVer", _T("Atom 3")); + else if (!mir_tstrcmpi(szNodeName, L"feed")) { + db_set_ts(hContact, MODULE, "MirVer", L"Atom 3"); for (int j = 0; j < xmlGetChildCount(node); j++) { HXML child = xmlGetChild(node, j); LPCTSTR szChildName = xmlGetName(child); - if (!mir_tstrcmpi(szChildName, _T("title"))) { + if (!mir_tstrcmpi(szChildName, L"title")) { LPCTSTR szChildText = xmlGetText(child); if (szChildText) db_set_ts(hContact, MODULE, "FirstName", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(szChildName, _T("link"))) { + else if (!mir_tstrcmpi(szChildName, L"link")) { for (int x = 0; x < xmlGetAttrCount(child); x++) { - if (!mir_tstrcmpi(xmlGetAttrName(child, x), _T("rel"))) - if (!mir_tstrcmpi(xmlGetAttrValue(child, xmlGetAttrName(child, x)), _T("self"))) + if (!mir_tstrcmpi(xmlGetAttrName(child, x), L"rel")) + if (!mir_tstrcmpi(xmlGetAttrValue(child, xmlGetAttrName(child, x)), L"self")) break; - if (!mir_tstrcmpi(xmlGetAttrName(child, x), _T("href"))) + if (!mir_tstrcmpi(xmlGetAttrName(child, x), L"href")) db_set_ts(hContact, MODULE, "Homepage", xmlGetAttrValue(child, xmlGetAttrName(child, x))); } } - else if (!mir_tstrcmpi(szChildName, _T("subtitle"))) { + else if (!mir_tstrcmpi(szChildName, L"subtitle")) { LPCTSTR szChildText = xmlGetText(child); if (szChildText) { ClearText(szValue, szChildText); @@ -453,29 +453,29 @@ void CheckCurrentFeed(MCONTACT hContact) db_set_ts(hContact, "CList", "StatusMsg", szValue); } } - else if (!mir_tstrcmpi(szChildName, _T("language"))) { + else if (!mir_tstrcmpi(szChildName, L"language")) { LPCTSTR szChildText = xmlGetText(child); if (szChildText) db_set_ts(hContact, MODULE, "Language1", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(szChildName, _T("author"))) { + else if (!mir_tstrcmpi(szChildName, L"author")) { for (int x = 0; x < xmlGetChildCount(child); x++) { HXML authorval = xmlGetChild(child, x); - if (!mir_tstrcmpi(xmlGetName(authorval), _T("email"))) { + if (!mir_tstrcmpi(xmlGetName(authorval), L"email")) { db_set_ts(hContact, MODULE, "e-mail", xmlGetText(authorval)); break; } } } - else if (!mir_tstrcmpi(szChildName, _T("category"))) { + else if (!mir_tstrcmpi(szChildName, L"category")) { LPCTSTR szChildText = xmlGetText(child); if (szChildText) db_set_ts(hContact, MODULE, "Interest0Text", ClearText(szValue, szChildText)); } - else if (!mir_tstrcmpi(szChildName, _T("icon"))) { + else if (!mir_tstrcmpi(szChildName, L"icon")) { for (int x = 0; x < xmlGetChildCount(child); x++) { HXML imageval = xmlGetChild(child, x); - if (!mir_tstrcmpi(xmlGetName(imageval), _T("url"))) { + if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) { LPCTSTR url = xmlGetText(imageval); db_set_ts(hContact, MODULE, "ImageURL", url); @@ -487,7 +487,7 @@ void CheckCurrentFeed(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext); TCHAR *filename = szNick; - mir_sntprintf(ai.filename, _T("%s\\%s.%s"), tszRoot, filename, ext); + mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL); @@ -498,7 +498,7 @@ void CheckCurrentFeed(MCONTACT hContact) } } } - else if (!mir_tstrcmpi(szChildName, _T("updated"))) { + else if (!mir_tstrcmpi(szChildName, L"updated")) { LPCTSTR szChildText = xmlGetText(child); if (szChildText) { TCHAR *lastupdtime = (TCHAR *)szChildText; @@ -512,57 +512,57 @@ void CheckCurrentFeed(MCONTACT hContact) } } } - else if (!mir_tstrcmpi(szChildName, _T("entry"))) { + else if (!mir_tstrcmpi(szChildName, L"entry")) { CMString title, link, descr, author, comments, guid, category; time_t stamp = 0; for (int z = 0; z < xmlGetChildCount(child); z++) { HXML itemval = xmlGetChild(child, z); LPCTSTR szItemName = xmlGetName(itemval); - if (!mir_tstrcmpi(szItemName, _T("title"))) { + if (!mir_tstrcmpi(szItemName, L"title")) { LPCTSTR szItemText = xmlGetText(itemval); if (szItemText) ClearText(title, szItemText); } - else if (!mir_tstrcmpi(szItemName, _T("link"))) { + else if (!mir_tstrcmpi(szItemName, L"link")) { for (int x = 0; x < xmlGetAttrCount(itemval); x++) { - if (!mir_tstrcmpi(xmlGetAttrName(itemval, x), _T("href"))) { + if (!mir_tstrcmpi(xmlGetAttrName(itemval, x), L"href")) { ClearText(link, xmlGetAttrValue(itemval, xmlGetAttrName(itemval, x))); break; } } } - else if (!mir_tstrcmpi(szItemName, _T("updated"))) { + else if (!mir_tstrcmpi(szItemName, L"updated")) { if (stamp == 0) stamp = DateToUnixTime(xmlGetText(itemval), 0); } - else if (!mir_tstrcmpi(szItemName, _T("summary")) || !mir_tstrcmpi(szItemName, _T("content"))) { + else if (!mir_tstrcmpi(szItemName, L"summary") || !mir_tstrcmpi(szItemName, L"content")) { LPCTSTR szItemText = xmlGetText(itemval); if (szItemText) ClearText(descr, szItemText); } - else if (!mir_tstrcmpi(szItemName, _T("author"))) { + else if (!mir_tstrcmpi(szItemName, L"author")) { for (int x = 0; x < xmlGetChildCount(itemval); x++) { HXML authorval = xmlGetChild(itemval, x); - if (!mir_tstrcmpi(xmlGetName(authorval), _T("name")) && xmlGetText(authorval)) { + if (!mir_tstrcmpi(xmlGetName(authorval), L"name") && xmlGetText(authorval)) { ClearText(author, xmlGetText(authorval)); break; } } } - else if (!mir_tstrcmpi(szItemName, _T("comments"))) { + else if (!mir_tstrcmpi(szItemName, L"comments")) { LPCTSTR szItemText = xmlGetText(itemval); if (szItemText) ClearText(comments, szItemText); } - else if (!mir_tstrcmpi(szItemName, _T("id"))) { + else if (!mir_tstrcmpi(szItemName, L"id")) { LPCTSTR szItemText = xmlGetText(itemval); if (szItemText) ClearText(guid, xmlGetText(itemval)); } - else if (!mir_tstrcmpi(szItemName, _T("category"))) { + else if (!mir_tstrcmpi(szItemName, L"category")) { for (int x = 0; x < xmlGetAttrCount(itemval); x++) { LPCTSTR szAttrName = xmlGetAttrName(itemval, x); - if (!mir_tstrcmpi(szAttrName, _T("term")) && xmlGetText(itemval)) { + if (!mir_tstrcmpi(szAttrName, L"term") && xmlGetText(itemval)) { ClearText(category, xmlGetAttrValue(itemval, szAttrName)); break; } @@ -612,14 +612,14 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) HXML node = xmlGetChild(hXml, childcount); while (node) { LPCTSTR szNodeName = xmlGetName(node); - if (!mir_tstrcmpi(szNodeName, _T("rss")) || !mir_tstrcmpi(szNodeName, _T("rdf"))) { + if (!mir_tstrcmpi(szNodeName, L"rss") || !mir_tstrcmpi(szNodeName, L"rdf")) { HXML chan = xmlGetChild(node, 0); for (int j = 0; j < xmlGetChildCount(chan); j++) { HXML child = xmlGetChild(chan, j); - if (!mir_tstrcmpi(xmlGetName(child), _T("image"))) { + if (!mir_tstrcmpi(xmlGetName(child), L"image")) { for (int x = 0; x < xmlGetChildCount(child); x++) { HXML imageval = xmlGetChild(child, x); - if (!mir_tstrcmpi(xmlGetName(imageval), _T("url"))) { + if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) { LPCTSTR url = xmlGetText(imageval); db_set_ts(hContact, MODULE, "ImageURL", url); @@ -632,7 +632,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext); TCHAR *filename = szNick; - mir_sntprintf(ai.filename, _T("%s\\%s.%s"), tszRoot, filename, ext); + mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL); @@ -646,13 +646,13 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) } } } - else if (!mir_tstrcmpi(szNodeName, _T("feed"))) { + else if (!mir_tstrcmpi(szNodeName, L"feed")) { for (int j = 0; j < xmlGetChildCount(node); j++) { HXML child = xmlGetChild(node, j); - if (!mir_tstrcmpi(xmlGetName(child), _T("icon"))) { + if (!mir_tstrcmpi(xmlGetName(child), L"icon")) { for (int x = 0; x < xmlGetChildCount(child); x++) { HXML imageval = xmlGetChild(child, x); - if (!mir_tstrcmpi(xmlGetName(imageval), _T("url"))) { + if (!mir_tstrcmpi(xmlGetName(imageval), L"url")) { LPCTSTR url = xmlGetText(imageval); db_set_ts(hContact, MODULE, "ImageURL", url); @@ -665,7 +665,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) ai.format = ProtoGetAvatarFormat(ext); TCHAR *filename = szNick; - mir_sntprintf(ai.filename, _T("%s\\%s.%s"), tszRoot, filename, ext); + mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL); diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index 7f2f403941..cbaac0f4b3 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -47,16 +47,16 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if(hXml != NULL) { HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); bool isTextUTF = false, isURLUTF = false, isSiteURLUTF = false, isGroupUTF = false; - HXML node = xmlGetChildByPath(hXml, _T("opml/body/outline"), 0); + HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0); if ( !node) - node = xmlGetChildByPath(hXml, _T("body/outline"), 0); + node = xmlGetChildByPath(hXml, L"body/outline", 0); int count = (int)SendMessage(FeedsImportList, LB_GETCOUNT, 0, 0); int DUPES = 0; if (node) { while (node) { int outlineAttr = xmlGetAttrCount(node); int outlineChildsCount = xmlGetChildCount(node); - TCHAR *xmlUrl = (TCHAR *)xmlGetAttrValue(node, _T("xmlUrl")); + TCHAR *xmlUrl = (TCHAR *)xmlGetAttrValue(node, L"xmlUrl"); if (!xmlUrl && !outlineChildsCount) { HXML tmpnode = node; node = xmlGetNextNode(node); @@ -68,7 +68,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM node = xmlGetNextNode(node); if (node) break; - } while (mir_tstrcmpi(xmlGetName(node), _T("body"))); + } while (mir_tstrcmpi(xmlGetName(node), L"body")); } } else if (!xmlUrl && outlineChildsCount) @@ -77,7 +77,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL; BYTE NeedToImport = FALSE; for (int i = 0; i < outlineAttr; i++) { - if (!mir_tstrcmpi(xmlGetAttrName(node, i), _T("text"))) { + if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"text")) { text = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); if (!text) { isTextUTF = 0; @@ -95,7 +95,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } continue; } - if (!mir_tstrcmpi(xmlGetAttrName(node, i), _T("xmlUrl"))) { + if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"xmlUrl")) { url = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); if ( !url) { isURLUTF = false; @@ -108,7 +108,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } continue; } - if (!mir_tstrcmpi(xmlGetAttrName(node, i), _T("htmlUrl"))) { + if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"htmlUrl")) { siteurl = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); if ( !siteurl) { isSiteURLUTF = false; @@ -124,13 +124,13 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (NeedToImport) { HXML parent = xmlGetParent(node); TCHAR tmpgroup[1024]; - while (mir_tstrcmpi(xmlGetName(parent), _T("body"))) { + while (mir_tstrcmpi(xmlGetName(parent), L"body")) { for (int i = 0; i < xmlGetAttrCount(parent); i++) { - if (!mir_tstrcmpi(xmlGetAttrName(parent, i), _T("text"))) { + if (!mir_tstrcmpi(xmlGetAttrName(parent, i), L"text")) { if ( !group) group = (TCHAR *)xmlGetAttrValue(parent, xmlGetAttrName(parent, i)); else { - mir_sntprintf(tmpgroup, _T("%s\\%s"), xmlGetAttrValue(parent, xmlGetAttrName(parent, i)), group); + mir_sntprintf(tmpgroup, L"%s\\%s", xmlGetAttrValue(parent, xmlGetAttrName(parent, i)), group); group = tmpgroup; } break; @@ -183,7 +183,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (node) break; } - while (mir_tstrcmpi(xmlGetName(tmpnode), _T("body"))); + while (mir_tstrcmpi(xmlGetName(tmpnode), L"body")); } } } @@ -209,12 +209,12 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_BROWSEIMPORTFILE: { TCHAR FileName[MAX_PATH]; - VARST tszMirDir(_T("%miranda_path%")); + VARST tszMirDir(L"%miranda_path%"); OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); TCHAR tmp[MAX_PATH]; - mir_sntprintf(tmp, _T("%s (*.opml, *.xml)%c*.opml;*.xml%c%c"), TranslateT("OPML files"), 0, 0, 0); + mir_sntprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; ofn.lpstrFile = FileName; @@ -223,20 +223,20 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.Flags = OFN_HIDEREADONLY; ofn.lpstrInitialDir = tszMirDir; *FileName = '\0'; - ofn.lpstrDefExt = _T(""); + ofn.lpstrDefExt = L""; if (GetOpenFileName(&ofn)) { int bytesParsed = 0; HXML hXml = xmlParseFile(FileName, &bytesParsed, NULL); if(hXml != NULL) { - HXML node = xmlGetChildByPath(hXml, _T("opml/body/outline"), 0); + HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0); if ( !node) - node = xmlGetChildByPath(hXml, _T("body/outline"), 0); + node = xmlGetChildByPath(hXml, L"body/outline", 0); if (node) { while (node) { int outlineAttr = xmlGetAttrCount(node); int outlineChildsCount = xmlGetChildCount(node); - TCHAR *xmlUrl = (TCHAR *)xmlGetAttrValue(node, _T("xmlUrl")); + TCHAR *xmlUrl = (TCHAR *)xmlGetAttrValue(node, L"xmlUrl"); if (!xmlUrl && !outlineChildsCount) { HXML tmpnode = node; node = xmlGetNextNode(node); @@ -248,14 +248,14 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM node = xmlGetNextNode(node); if (node) break; - } while (mir_tstrcmpi(xmlGetName(node), _T("body"))); + } while (mir_tstrcmpi(xmlGetName(node), L"body")); } } else if (!xmlUrl && outlineChildsCount) node = xmlGetFirstChild(node); else if (xmlUrl) { for (int i = 0; i < outlineAttr; i++) { - if (!mir_tstrcmpi(xmlGetAttrName(node, i), _T("text"))) { + if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"text")) { TCHAR *text = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); bool isTextUTF; if (!text) { @@ -282,7 +282,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM node = xmlGetNextNode(node); if (node) break; - } while (mir_tstrcmpi(xmlGetName(tmpnode), _T("body"))); + } while (mir_tstrcmpi(xmlGetName(tmpnode), L"body")); } } } @@ -472,12 +472,12 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDOK: { TCHAR FileName[MAX_PATH]; - VARST tszMirDir(_T("%miranda_path%")); + VARST tszMirDir(L"%miranda_path%"); OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); TCHAR tmp[MAX_PATH]; - mir_sntprintf(tmp, _T("%s (*.opml)%c*.opml%c%c"), TranslateT("OPML files"), 0, 0, 0); + mir_sntprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; ofn.lpstrFile = FileName; @@ -486,14 +486,14 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; ofn.lpstrInitialDir = tszMirDir; *FileName = '\0'; - ofn.lpstrDefExt = _T(""); + ofn.lpstrDefExt = L""; if (GetSaveFileName(&ofn)) { - HXML hXml = xmlCreateNode(_T("opml"), NULL, FALSE); - xmlAddAttr(hXml, _T("version"), _T("1.0")); - HXML header = xmlAddChild(hXml, _T("head"), NULL); - xmlAddChild(header, _T("title"), _T("Miranda NG NewsAggregator plugin export")); - header = xmlAddChild(hXml, _T("body"), NULL); + HXML hXml = xmlCreateNode(L"opml", NULL, FALSE); + xmlAddAttr(hXml, L"version", L"1.0"); + HXML header = xmlAddChild(hXml, L"head", NULL); + xmlAddChild(header, L"title", L"Miranda NG NewsAggregator plugin export"); + header = xmlAddChild(hXml, L"body", NULL); int count = (int)SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0); for (int i = 0; i < count; i++) { @@ -509,29 +509,29 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HXML elem = header; if (group) { - TCHAR *section = _tcstok(group, _T("\\")); + TCHAR *section = _tcstok(group, L"\\"); while (section != NULL) { - HXML existgroup = xmlGetChildByAttrValue(header, _T("outline"), _T("title"), section); + HXML existgroup = xmlGetChildByAttrValue(header, L"outline", L"title", section); if ( !existgroup) { - elem = xmlAddChild(elem, _T("outline"), NULL); - xmlAddAttr(elem, _T("title"), section); - xmlAddAttr(elem, _T("text"), section); + elem = xmlAddChild(elem, L"outline", NULL); + xmlAddAttr(elem, L"title", section); + xmlAddAttr(elem, L"text", section); } else { elem = existgroup; } - section = _tcstok(NULL, _T("\\")); + section = _tcstok(NULL, L"\\"); } - elem = xmlAddChild(elem, _T("outline"), NULL); + elem = xmlAddChild(elem, L"outline", NULL); } else - elem = xmlAddChild(elem, _T("outline"), NULL); - xmlAddAttr(elem, _T("text"), title); - xmlAddAttr(elem, _T("title"), title); - xmlAddAttr(elem, _T("type"), _T("rss")); - xmlAddAttr(elem, _T("xmlUrl"), url); - xmlAddAttr(elem, _T("htmlUrl"), siteurl); + elem = xmlAddChild(elem, L"outline", NULL); + xmlAddAttr(elem, L"text", title); + xmlAddAttr(elem, L"title", title); + xmlAddAttr(elem, L"type", L"rss"); + xmlAddAttr(elem, L"xmlUrl", url); + xmlAddAttr(elem, L"htmlUrl", siteurl); mir_free(title); mir_free(url); diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index 9420c88f79..74fdfc6f71 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -26,7 +26,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); SetWindowText(hwndDlg, TranslateT("Add Feed")); - SetDlgItemText(hwndDlg, IDC_FEEDURL, _T("http://")); + SetDlgItemText(hwndDlg, IDC_FEEDURL, L"http://"); SetDlgItemText(hwndDlg, IDC_TAGSEDIT, TAGSDEFAULT); SendDlgItemMessage(hwndDlg, IDC_CHECKTIME, EM_LIMITTEXT, 3, 0); SetDlgItemInt(hwndDlg, IDC_CHECKTIME, DEFAULT_UPDATE_TIME, TRUE); @@ -44,7 +44,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, L"http://") == 0) { MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); break; } @@ -95,14 +95,14 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_TAGHELP: TCHAR tszTagHelp[1024]; - mir_sntprintf(tszTagHelp, _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), - _T("#<title>#"), TranslateT("The title of the item."), - _T("#<description>#"), TranslateT("The item synopsis."), - _T("#<link>#"), TranslateT("The URL of the item."), - _T("#<author>#"), TranslateT("Email address of the author of the item."), - _T("#<comments>#"), TranslateT("URL of a page for comments relating to the item."), - _T("#<guid>#"), TranslateT("A string that uniquely identifies the item."), - _T("#<category>#"), TranslateT("Specify one or more categories that the item belongs to.")); + mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s", + L"#<title>#", TranslateT("The title of the item."), + L"#<description>#", TranslateT("The item synopsis."), + L"#<link>#", TranslateT("The URL of the item."), + L"#<author>#", TranslateT("Email address of the author of the item."), + L"#<comments>#", TranslateT("URL of a page for comments relating to the item."), + L"#<guid>#", TranslateT("A string that uniquely identifies the item."), + L"#<category>#", TranslateT("Specify one or more categories that the item belongs to.")); MessageBox(hwndDlg, tszTagHelp, TranslateT("Feed Tag Help"), MB_OK); break; @@ -116,7 +116,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); TCHAR tszURL[MAX_PATH] = { 0 }; TCHAR *tszTitle = NULL; - if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) + if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) tszTitle = (TCHAR*)CheckFeed(tszURL, hwndDlg); else MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); @@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, L"http://") == 0) { MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); break; } @@ -255,14 +255,14 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TAGHELP: TCHAR tszTagHelp[1024]; - mir_sntprintf(tszTagHelp, _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), - _T("#<title>#"), TranslateT("The title of the item."), - _T("#<description>#"), TranslateT("The item synopsis."), - _T("#<link>#"), TranslateT("The URL of the item."), - _T("#<author>#"), TranslateT("Email address of the author of the item."), - _T("#<comments>#"), TranslateT("URL of a page for comments relating to the item."), - _T("#<guid>#"), TranslateT("A string that uniquely identifies the item."), - _T("#<category>#"), TranslateT("Specify one or more categories that the item belongs to.")); + mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s", + L"#<title>#", TranslateT("The title of the item."), + L"#<description>#", TranslateT("The item synopsis."), + L"#<link>#", TranslateT("The URL of the item."), + L"#<author>#", TranslateT("Email address of the author of the item."), + L"#<comments>#", TranslateT("URL of a page for comments relating to the item."), + L"#<guid>#", TranslateT("A string that uniquely identifies the item."), + L"#<category>#", TranslateT("Specify one or more categories that the item belongs to.")); MessageBox(hwndDlg, tszTagHelp, TranslateT("Feed Tag Help"), MB_OK); break; @@ -273,7 +273,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DISCOVERY: TCHAR tszURL[MAX_PATH] = { 0 }; - if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) { + if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) { EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); TCHAR *tszTitle = (TCHAR*)CheckFeed(tszURL, hwndDlg); @@ -361,7 +361,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK); break; } - if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, _T("http://")) == 0) { + if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_tstrcmp(str, L"http://") == 0) { MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); break; } @@ -411,14 +411,14 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TAGHELP: TCHAR tszTagHelp[1024]; - mir_sntprintf(tszTagHelp, _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), - _T("#<title>#"), TranslateT("The title of the item."), - _T("#<description>#"), TranslateT("The item synopsis."), - _T("#<link>#"), TranslateT("The URL of the item."), - _T("#<author>#"), TranslateT("Email address of the author of the item."), - _T("#<comments>#"), TranslateT("URL of a page for comments relating to the item."), - _T("#<guid>#"), TranslateT("A string that uniquely identifies the item."), - _T("#<category>#"), TranslateT("Specify one or more categories that the item belongs to.")); + mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s", + L"#<title>#", TranslateT("The title of the item."), + L"#<description>#", TranslateT("The item synopsis."), + L"#<link>#", TranslateT("The URL of the item."), + L"#<author>#", TranslateT("Email address of the author of the item."), + L"#<comments>#", TranslateT("URL of a page for comments relating to the item."), + L"#<guid>#", TranslateT("A string that uniquely identifies the item."), + L"#<category>#", TranslateT("Specify one or more categories that the item belongs to.")); MessageBox(hwndDlg, tszTagHelp, TranslateT("Feed Tag Help"), MB_OK); break; @@ -429,7 +429,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DISCOVERY: TCHAR tszURL[MAX_PATH] = { 0 }; - if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, _T("http://")) != 0) { + if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) { EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); TCHAR *tszTitle = (TCHAR*)CheckFeed(tszURL, hwndDlg); diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index c021e5f6fa..bc2d5dabe6 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -31,16 +31,16 @@ void SetContactStatus(MCONTACT hContact, int nNewStatus) int OnFoldersChanged(WPARAM, LPARAM) { - FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T("")); + FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, L""); return 0; } int NewsAggrInit(WPARAM, LPARAM) { - if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER))) - FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T("")); + if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT L"\\Avatars\\" DEFAULT_AVATARS_FOLDER)) + FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, L""); else - mir_tstrncpy(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\" _T(DEFAULT_AVATARS_FOLDER))), _countof(tszRoot)); + mir_tstrncpy(tszRoot, VARST(L"%miranda_userdata%\\Avatars\\" DEFAULT_AVATARS_FOLDER), _countof(tszRoot)); for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1)) diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 4886377782..d79697cbc4 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -45,14 +45,14 @@ void NetlibUnInit() void GetNewsData(TCHAR *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg) { - Netlib_LogfT(hNetlibUser, _T("Getting feed data %s."), tszUrl); + Netlib_LogfT(hNetlibUser, L"Getting feed data %s.", tszUrl); NETLIBHTTPREQUEST nlhr = { 0 }; // initialize the netlib request nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT; - if (_tcsstr(tszUrl, _T("https://")) != NULL) + if (_tcsstr(tszUrl, L"https://") != NULL) nlhr.flags |= NLHRF_SSL; char *szUrl = mir_t2a(tszUrl); nlhr.szUrl = szUrl; @@ -84,14 +84,14 @@ void GetNewsData(TCHAR *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg) if (nlhrReply) { // if the recieved code is 200 OK if (nlhrReply->resultCode == 200 && nlhrReply->dataLength > 0) { - Netlib_LogfT(hNetlibUser, _T("Code 200: Succeeded getting feed data %s."), tszUrl); + Netlib_LogfT(hNetlibUser, L"Code 200: Succeeded getting feed data %s.", tszUrl); // allocate memory and save the retrieved data *szData = (char *)mir_alloc((size_t)(nlhrReply->dataLength + 2)); memcpy(*szData, nlhrReply->pData, (size_t)nlhrReply->dataLength); (*szData)[nlhrReply->dataLength] = 0; } else if (nlhrReply->resultCode == 401) { - Netlib_LogfT(hNetlibUser, _T("Code 401: feed %s needs auth data."), tszUrl); + Netlib_LogfT(hNetlibUser, L"Code 401: feed %s needs auth data.", tszUrl); ItemInfo SelItem = { 0 }; SelItem.hwndList = hwndDlg; SelItem.hContact = hContact; @@ -99,11 +99,11 @@ void GetNewsData(TCHAR *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg) GetNewsData(tszUrl, szData, hContact, hwndDlg); } else - Netlib_LogfT(hNetlibUser, _T("Code %d: Failed getting feed data %s."), nlhrReply->resultCode, tszUrl); + Netlib_LogfT(hNetlibUser, L"Code %d: Failed getting feed data %s.", nlhrReply->resultCode, tszUrl); CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); } else - Netlib_LogfT(hNetlibUser, _T("Failed getting feed data %s, no response."), tszUrl); + Netlib_LogfT(hNetlibUser, L"Failed getting feed data %s, no response.", tszUrl); mir_free(szUrl); } @@ -193,56 +193,56 @@ time_t __stdcall DateToUnixTime(const TCHAR *stamp, bool FeedType) else { TCHAR *weekday, monthstr[4], timezonesign[2]; int day, month = 0, year, hour, min, sec, timezoneh, timezonem; - if (_tcsstr(p, _T(","))) { - weekday = _tcstok(p, _T(",")); - p = _tcstok(NULL, _T(",")); - _stscanf(p + 1, _T("%d %3s %d %d:%d:%d %1s%02d%02d"), &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); - if (!mir_tstrcmpi(monthstr, _T("Jan"))) + if (_tcsstr(p, L",")) { + weekday = _tcstok(p, L","); + p = _tcstok(NULL, L","); + _stscanf(p + 1, L"%d %3s %d %d:%d:%d %1s%02d%02d", &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); + if (!mir_tstrcmpi(monthstr, L"Jan")) month = 1; - if (!mir_tstrcmpi(monthstr, _T("Feb"))) + if (!mir_tstrcmpi(monthstr, L"Feb")) month = 2; - if (!mir_tstrcmpi(monthstr, _T("Mar"))) + if (!mir_tstrcmpi(monthstr, L"Mar")) month = 3; - if (!mir_tstrcmpi(monthstr, _T("Apr"))) + if (!mir_tstrcmpi(monthstr, L"Apr")) month = 4; - if (!mir_tstrcmpi(monthstr, _T("May"))) + if (!mir_tstrcmpi(monthstr, L"May")) month = 5; - if (!mir_tstrcmpi(monthstr, _T("Jun"))) + if (!mir_tstrcmpi(monthstr, L"Jun")) month = 6; - if (!mir_tstrcmpi(monthstr, _T("Jul"))) + if (!mir_tstrcmpi(monthstr, L"Jul")) month = 7; - if (!mir_tstrcmpi(monthstr, _T("Aug"))) + if (!mir_tstrcmpi(monthstr, L"Aug")) month = 8; - if (!mir_tstrcmpi(monthstr, _T("Sep"))) + if (!mir_tstrcmpi(monthstr, L"Sep")) month = 9; - if (!mir_tstrcmpi(monthstr, _T("Oct"))) + if (!mir_tstrcmpi(monthstr, L"Oct")) month = 10; - if (!mir_tstrcmpi(monthstr, _T("Nov"))) + if (!mir_tstrcmpi(monthstr, L"Nov")) month = 11; - if (!mir_tstrcmpi(monthstr, _T("Dec"))) + if (!mir_tstrcmpi(monthstr, L"Dec")) month = 12; if (year < 2000) year += 2000; - if (!mir_tstrcmp(timezonesign, _T("+"))) - mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, _T("%04d%02d%02dT%02d:%02d:%02d"), year, month, day, hour - timezoneh, min - timezonem, sec); - else if (!mir_tstrcmp(timezonesign, _T("-"))) - mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, _T("%04d%02d%02dT%02d:%02d:%02d"), year, month, day, hour + timezoneh, min + timezonem, sec); + if (!mir_tstrcmp(timezonesign, L"+")) + mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour - timezoneh, min - timezonem, sec); + else if (!mir_tstrcmp(timezonesign, L"-")) + mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour + timezoneh, min + timezonem, sec); else - mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, _T("%04d%02d%02dT%02d:%02d:%02d"), year, month, day, hour, min, sec); + mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec); } - else if (_tcsstr(p, _T("T"))) { - _stscanf(p, _T("%d-%d-%dT%d:%d:%d"), &year, &month, &day, &hour, &min, &sec); - mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, _T("%04d%02d%02dT%02d:%02d:%02d"), year, month, day, hour, min, sec); + else if (_tcsstr(p, L"T")) { + _stscanf(p, L"%d-%d-%dT%d:%d:%d", &year, &month, &day, &hour, &min, &sec); + mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec); } else { - _stscanf(p, _T("%d-%d-%d %d:%d:%d %1s%02d%02d"), &year, &month, &day, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); - if (!mir_tstrcmp(timezonesign, _T("+"))) - mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, _T("%04d%02d%02dT%02d:%02d:%02d"), year, month, day, hour - timezoneh, min - timezonem, sec); - else if (!mir_tstrcmp(timezonesign, _T("-"))) - mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, _T("%04d%02d%02dT%02d:%02d:%02d"), year, month, day, hour + timezoneh, min + timezonem, sec); + _stscanf(p, L"%d-%d-%d %d:%d:%d %1s%02d%02d", &year, &month, &day, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); + if (!mir_tstrcmp(timezonesign, L"+")) + mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour - timezoneh, min - timezonem, sec); + else if (!mir_tstrcmp(timezonesign, L"-")) + mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour + timezoneh, min + timezonem, sec); else - mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, _T("%04d%02d%02dT%02d:%02d:%02d"), year, month, day, hour, min, sec); + mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec); } } // Get the date part @@ -273,7 +273,7 @@ time_t __stdcall DateToUnixTime(const TCHAR *stamp, bool FeedType) for (; *p != '\0' && !isdigit(*p); p++); // Parse time - if (_stscanf(p, _T("%d:%d:%d"), ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3) + if (_stscanf(p, L"%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3) return 0; timestamp.tm_isdst = 0; // DST is already present in _timezone below @@ -453,7 +453,7 @@ HRESULT TestDocumentText(IHTMLDocument3 *pHtmlDoc, BSTR &message) LPCTSTR ClearText(CMString &result, const TCHAR *message) { - BSTR bstrHtml = SysAllocString(message), bstrRes = SysAllocString(_T("")); + BSTR bstrHtml = SysAllocString(message), bstrRes = SysAllocString(L""); HRESULT hr = TestMarkupServices(bstrHtml, &TestDocumentText, bstrRes); if (SUCCEEDED(hr)) result = bstrRes; diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h index d7de67206c..b4787929cb 100644 --- a/plugins/NewsAggregator/Src/stdafx.h +++ b/plugins/NewsAggregator/Src/stdafx.h @@ -50,7 +50,7 @@ Boston, MA 02111-1307, USA. #include "resource.h" #define MODULE "NewsAggregator" -#define TAGSDEFAULT _T("#<title>#\r\n#<link>#\r\n#<description>#") +#define TAGSDEFAULT L"#<title>#\r\n#<link>#\r\n#<description>#" #define DEFAULT_AVATARS_FOLDER "NewsAggregator" #define DEFAULT_UPDATE_TIME 60 -- cgit v1.2.3