diff options
Diffstat (limited to 'protocols/FacebookRM/src')
| -rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 2 | ||||
| -rw-r--r-- | protocols/FacebookRM/src/json.cpp | 18 | 
2 files changed, 12 insertions, 8 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 53e2bd08a8..9308be3ed8 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1147,6 +1147,8 @@ bool facebook_client::channel()  bool facebook_client::send_message(std::string message_recipient, std::string message_text, std::string *error_text, MessageMethod method)
  {
 +	ScopedLock s(send_message_lock_);
 +
  	handle_entry("send_message");
  	http::response resp;
 diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index f7f3bc7100..ac53334fe5 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -262,6 +262,8 @@ int facebook_json_parser::parse_notifications(void *data, std::vector< facebook_  bool ignore_duplicits(FacebookProto *proto, std::string mid, std::string text)
  {
 +	ScopedLock s(proto->facy.send_message_lock_);
 +
  	std::map<std::string, bool>::iterator it = proto->facy.messages_ignore.find(mid);
  	if (it != proto->facy.messages_ignore.end()) {
  		proto->debugLogA("????? Ignoring duplicit/sent message\n%s", text.c_str());
 @@ -353,6 +355,14 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, JSONNODE  int facebook_json_parser::parse_messages(void* data, std::vector< facebook_message* >* messages, std::vector< facebook_notification* >* notifications, bool inboxOnly)
  {
 +	// remove old received messages from map		
 +	for (std::map<std::string, bool>::iterator it = proto->facy.messages_ignore.begin(); it != proto->facy.messages_ignore.end();) {
 +		if (it->second)
 +			it = proto->facy.messages_ignore.erase(it);
 +		else
 +			++it;
 +	}
 +
  	std::string jsonData = static_cast< std::string* >(data)->substr(9);
  	JSONNODE *root = json_parse(jsonData.c_str());
 @@ -723,14 +733,6 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa  			continue;
  	}
 -	// remove received messages from map		
 -	for (std::map<std::string, bool>::iterator it = proto->facy.messages_ignore.begin(); it != proto->facy.messages_ignore.end(); ) {
 -		if (it->second)
 -			it = proto->facy.messages_ignore.erase(it);
 -		else
 -			++it;
 -	}
 -
  	json_delete(root);
  	return EXIT_SUCCESS;
  }
  | 
