From 2c6dba2732e338fbadd569d5d2ede6009f41c9c2 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 30 Dec 2012 05:55:23 +0200 Subject: fixed #77 #72 --- src/messages.cpp | 10 +--------- src/utilities.cpp | 25 +++++++++++++++++++++++++ src/utilities.h | 5 +++-- 3 files changed, 29 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/messages.cpp b/src/messages.cpp index 5e3e609..37d67ca 100755 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -650,15 +650,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) } if(bStripTags && bAppendTags) { - std::wstring::size_type p; - for(p = str.find(inopentag); p != std::wstring::npos; p = str.find(inopentag)) - str.erase(p, _tcslen(inopentag)); - for(p = str.find(inclosetag); p != std::wstring::npos; p = str.find(inclosetag)) - str.erase(p, _tcslen(inclosetag)); - for(p = str.find(outopentag); p != std::wstring::npos; p = str.find(outopentag)) - str.erase(p, _tcslen(outopentag)); - for(p = str.find(outclosetag); p != std::wstring::npos; p = str.find(outclosetag)) - str.erase(p, _tcslen(outclosetag)); + strip_tags(str); } /* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1)) str.replace(i, 2, _T("\n")); */ diff --git a/src/utilities.cpp b/src/utilities.cpp index cbddeb1..84bcfca 100755 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -1939,3 +1939,28 @@ void strip_line_term(std::string &s) for(std::string::size_type i = s.find("\n"); i != std::string::npos; i = s.find("\n", i+1)) s.erase(i, 1); } + +void strip_tags(std::wstring &str) +{ + std::wstring::size_type p; + if(_tcslen(inopentag)) + { + for(p = str.find(inopentag); p != std::wstring::npos; p = str.find(inopentag)) + str.erase(p, _tcslen(inopentag)); + } + if(_tcslen(inclosetag)) + { + for(p = str.find(inclosetag); p != std::wstring::npos; p = str.find(inclosetag)) + str.erase(p, _tcslen(inclosetag)); + } + if(_tcslen(outopentag)) + { + for(p = str.find(outopentag); p != std::wstring::npos; p = str.find(outopentag)) + str.erase(p, _tcslen(outopentag)); + } + if(_tcslen(outclosetag)) + { + for(p = str.find(outclosetag); p != std::wstring::npos; p = str.find(outclosetag)) + str.erase(p, _tcslen(outclosetag)); + } +} \ No newline at end of file diff --git a/src/utilities.h b/src/utilities.h index 739495a..508a241 100755 --- a/src/utilities.h +++ b/src/utilities.h @@ -43,7 +43,7 @@ public: { eventType = EVENTTYPE_MESSAGE; flags = 0; - timestamp = 0; + timestamp = time(0); szModule = 0; cbSize = 0; cbBlob = strlen(msg)+1; @@ -81,7 +81,7 @@ public: eventType = type; else eventType = EVENTTYPE_MESSAGE; - timestamp = 0; + timestamp = time(0); szModule = 0; cbSize = 0; } @@ -104,5 +104,6 @@ void fix_line_term(std::string &s); void fix_line_term(std::wstring &s); void strip_line_term(std::wstring &s); void strip_line_term(std::string &s); +void strip_tags(std::wstring &s); #endif -- cgit v1.2.3