diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-06-12 11:36:25 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-06-12 11:36:25 +0000 |
commit | cc4c50d725df57a51a69fcefa94f5812ab56b6f3 (patch) | |
tree | 997baeee2c7a8d42147c1202a3f5da76664857c5 /protocols/FacebookRM/src/process.cpp | |
parent | 13964bc99fce9d033bd4c87b44a80f96436fca1f (diff) |
Facebook: Correct trimming of messages and not receiving empty ones.
git-svn-id: http://svn.miranda-ng.org/main/trunk@4923 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 0a140724fe..502deaa627 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -369,13 +369,11 @@ void FacebookProto::ProcessUnreadMessage(void *tid_data) std::string::size_type pos3 = messageslist.find("class=\\\"MessagingMessage ", pos2);
std::string messagesgroup = messageslist.substr(pos2, pos3 - pos2);
- DWORD timestamp = utils::conversion::to_timestamp(
- utils::text::source_get_value(&messagesgroup, 2, "data-utime=\\\"", "\\\""));
+ DWORD timestamp = utils::conversion::to_timestamp(utils::text::source_get_value(&messagesgroup, 2, "data-utime=\\\"", "\\\""));
pos3 = 0;
while ((pos3 = messagesgroup.find("class=\\\"content noh", pos3)) != std::string::npos)
{
-
std::string message_attachments = "";
std::string::size_type pos4 = 0;
if ((pos4 = messagesgroup.find("class=\\\"attachments\\\"", pos4)) != std::string::npos) {
@@ -409,9 +407,11 @@ void FacebookProto::ProcessUnreadMessage(void *tid_data) std::string message_text = messagesgroup.substr(pos3, messagesgroup.find("<\\/div", pos3) + 6 - pos3);
message_text = utils::text::source_get_value(&message_text, 2, "\\\">", "<\\/div");
- message_text = utils::text::trim(
- utils::text::special_expressions_decode(
- utils::text::remove_html(message_text)));
+ message_text = utils::text::trim(utils::text::special_expressions_decode(utils::text::remove_html(message_text)), true);
+ pos3++;
+
+ if (message_text.empty())
+ continue;
LOG("Got unread message: \"%s\"", message_text.c_str());
@@ -430,8 +430,6 @@ void FacebookProto::ProcessUnreadMessage(void *tid_data) recv.szMessage = const_cast<char*>(message_text.c_str());
recv.timestamp = timestamp;
ProtoChainRecvMsg(hContact, &recv);
-
- pos3++;
}
}
|