summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/chat.cpp3
-rw-r--r--protocols/FacebookRM/src/json.cpp22
-rw-r--r--protocols/FacebookRM/src/version.h2
3 files changed, 12 insertions, 15 deletions
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index 30db7ca1dd..2cbc2423d4 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -209,7 +209,7 @@ char *FacebookProto::GetChatUsers(const char *chat_id)
{
ptrW ptszChatID(mir_a2u(chat_id));
- GC_INFO gci = { 0 };
+ GC_INFO gci = {};
gci.Flags = GCF_USERS;
gci.pszModule = m_szModuleName;
gci.pszID = ptszChatID;
@@ -379,7 +379,6 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat
gce.dwFlags = GCEF_UTF8 + GCEF_ADDTOLOG;
gce.pszNick.a = TranslateU("Notifications");
gce.pszUID.a = FACEBOOK_NOTIFICATIONS_CHATROOM;
-
Chat_Event(&gce);
}
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 2ff53ff346..de642b4186 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -226,15 +226,18 @@ int FacebookProto::ParseNotifications(std::string *data, std::map< std::string,
if (!text_ || !state_ || state_.as_string() == "SEEN_AND_READ" || !time_)
continue;
- facebook_notification *notification = new facebook_notification();
-
- notification->id = id_.as_string();
-
// Fix notification ID
- std::string::size_type pos = notification->id.find(":");
+ std::string msgid = id_.as_string();
+ std::string::size_type pos = msgid.find(":");
if (pos != std::string::npos)
- notification->id = notification->id.substr(pos + 1);
+ msgid = msgid.substr(pos + 1);
+
+ // Skip duplicate notifications
+ if (notifications->find(msgid) != notifications->end())
+ continue;
+ facebook_notification *notification = new facebook_notification();
+ notification->id = msgid;
notification->link = url_.as_string();
notification->text = utils::text::html_entities_decode(utils::text::slashu_to_utf8(text_.as_string()));
notification->time = utils::time::from_string(time_.as_string());
@@ -242,12 +245,7 @@ int FacebookProto::ParseNotifications(std::string *data, std::map< std::string,
// Write notification to chatroom
UpdateNotificationsChatRoom(notification);
-
- // If it's unseen, remember it, otherwise forget it
- if (notifications->find(notification->id) == notifications->end())
- notifications->insert(std::make_pair(notification->id, notification));
- else
- delete notification;
+ notifications->insert(std::make_pair(notification->id, notification));
}
return EXIT_SUCCESS;
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index 959774602e..4274001872 100644
--- a/protocols/FacebookRM/src/version.h
+++ b/protocols/FacebookRM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 4
#define __RELEASE_NUM 2
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>