diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-11-26 09:00:49 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-11-26 09:00:49 +0000 |
commit | 0bf2bc15b71b0df5a0cc2d733535c62dfa19748e (patch) | |
tree | 0e32020a7ba506fb1cbc560d70ce87bcacf77154 /protocols/FacebookRM/src | |
parent | c1d2d5892eda3070975bbb82ac4f2e35d7bc139e (diff) |
Facebook: Real fix for corrupted newsfeeds in chatroom
Problem was text.str().c_str() because .str() returns temporary object and c_str() pointer to it, so it was probably destructed before really using it in chatroom.
git-svn-id: http://svn.miranda-ng.org/main/trunk@11084 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r-- | protocols/FacebookRM/src/chat.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 2ceaeec16d..1e81e1ffaa 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -424,14 +424,23 @@ void FacebookProto::PrepareNotificationsChatRoom() { }
void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notification) {
- ScopedLock s(facy.notifications_lock_);
-
if (!getBool(FACEBOOK_KEY_NOTIFICATIONS_CHATROOM, DEFAULT_NOTIFICATIONS_CHATROOM))
return;
- char *name = _T2A(TranslateT("Notification"), CP_UTF8);
-
std::stringstream text;
text << notification->text << "\n\n" << notification->link;
- UpdateChat(_T(FACEBOOK_NOTIFICATIONS_CHATROOM), name /*notification->second->user_id.c_str()*/, name, text.str().c_str(), notification->time, notification->seen);
+
+ std::string smessage = text.str();
+ utils::text::replace_all(&smessage, "%", "%%");
+
+ GCDEST gcd = { m_szModuleName, _T(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.ptszText = _A2T(smessage.c_str(), CP_UTF8);
+ gce.time = notification->time ? notification->time : ::time(NULL);
+ gce.bIsMe = true;
+ gce.dwFlags |= GCEF_ADDTOLOG;
+ gce.ptszNick = TranslateT("Notifications");
+ gce.ptszUID = _T(FACEBOOK_NOTIFICATIONS_CHATROOM);
+
+ CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
\ No newline at end of file |