summaryrefslogtreecommitdiff
path: root/plugins/NewsAggregator/Src/CheckFeed.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-04-24 09:32:54 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-04-24 09:32:54 +0000
commit5cf0f0757def7cadf17f9d66de9dd56e2031a999 (patch)
treee6609d9b24252eb24345844b747a1684f4eb7679 /plugins/NewsAggregator/Src/CheckFeed.cpp
parent729e6fd4c3ba9c37ee5001c56ebb165f4d5cefe2 (diff)
fixed substring replacement
git-svn-id: http://svn.miranda-ng.org/main/trunk@13075 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/CheckFeed.cpp')
-rw-r--r--plugins/NewsAggregator/Src/CheckFeed.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp
index 08888867a9..7daad6dc2f 100644
--- a/plugins/NewsAggregator/Src/CheckFeed.cpp
+++ b/plugins/NewsAggregator/Src/CheckFeed.cpp
@@ -80,44 +80,44 @@ TCHAR* CheckFeed(TCHAR *tszURL, HWND hwndDlg)
static void XmlToMsg(MCONTACT hContact, CMString &title, CMString &link, CMString &descr, CMString &author, CMString &comments, CMString &guid, CMString &category, time_t stamp)
{
- TCHAR *message = db_get_tsa(hContact, MODULE, "MsgFormat");
+ CMString message = db_get_tsa(hContact, MODULE, "MsgFormat");
if (!message)
message = mir_tstrdup(TAGSDEFAULT);
if (title.IsEmpty())
- StrReplace(_T("#<title>#"), TranslateT("empty"), message);
+ message.Replace(_T("#<title>#"), TranslateT("empty"));
else
- StrReplace(_T("#<title>#"), title, message);
+ message.Replace(_T("#<title>#"), title);
if (link.IsEmpty())
- StrReplace(_T("#<link>#"), TranslateT("empty"), message);
+ message.Replace(_T("#<link>#"), TranslateT("empty"));
else
- StrReplace(_T("#<link>#"), link, message);
+ message.Replace(_T("#<link>#"), link);
if (descr.IsEmpty())
- StrReplace(_T("#<description>#"), TranslateT("empty"), message);
+ message.Replace(_T("#<description>#"), TranslateT("empty"));
else
- StrReplace(_T("#<description>#"), descr, message);
+ message.Replace(_T("#<description>#"), descr);
if (author.IsEmpty())
- StrReplace(_T("#<author>#"), TranslateT("empty"), message);
+ message.Replace(_T("#<author>#"), TranslateT("empty"));
else
- StrReplace(_T("#<author>#"), author, message);
+ message.Replace(_T("#<author>#"), author);
if (comments.IsEmpty())
- StrReplace(_T("#<comments>#"), TranslateT("empty"), message);
+ message.Replace(_T("#<comments>#"), TranslateT("empty"));
else
- StrReplace(_T("#<comments>#"), comments, message);
+ message.Replace(_T("#<comments>#"), comments);
if (guid.IsEmpty())
- StrReplace(_T("#<guid>#"), TranslateT("empty"), message);
+ message.Replace(_T("#<guid>#"), TranslateT("empty"));
else
- StrReplace(_T("#<guid>#"), guid, message);
+ message.Replace(_T("#<guid>#"), guid);
if (category.IsEmpty())
- StrReplace(_T("#<category>#"), TranslateT("empty"), message);
+ message.Replace(_T("#<category>#"), TranslateT("empty"));
else
- StrReplace(_T("#<category>#"), category, message);
+ message.Replace(_T("#<category>#"), category);
DBEVENTINFO olddbei = { 0 };
olddbei.cbSize = sizeof(olddbei);
@@ -151,10 +151,9 @@ static void XmlToMsg(MCONTACT hContact, CMString &title, CMString &link, CMStrin
PROTORECVEVENT recv = { 0 };
recv.flags = PREF_TCHAR;
recv.timestamp = (DWORD)stamp;
- recv.tszMessage = message;
+ recv.tszMessage = (TCHAR*)message.c_str();
ProtoChainRecvMsg(hContact, &recv);
}
- mir_free(message);
}
void CheckCurrentFeed(MCONTACT hContact)
@@ -266,9 +265,9 @@ void CheckCurrentFeed(MCONTACT hContact)
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
pai.format = ProtoGetAvatarFormat(url);
- TCHAR *filename = szNick;
- StrReplace(_T("/"), _T("_"), filename);
- mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
+ CMString filename = szNick;
+ filename.Replace(_T("/"), _T("_"));
+ mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext);
CreateDirectoryTreeT(tszRoot);
if (DownloadFile(url, pai.filename)) {
db_set_ts(hContact, MODULE, "ImagePath", pai.filename);