diff options
| author | Robert Pösel <robyer@seznam.cz> | 2014-04-21 14:50:36 +0000 | 
|---|---|---|
| committer | Robert Pösel <robyer@seznam.cz> | 2014-04-21 14:50:36 +0000 | 
| commit | 4a1eb5200ee36228ded5cd9a005c7d19d2bba142 (patch) | |
| tree | 4d4978adb172e23bf496f96a928e5ca97b5ba27c /protocols/FacebookRM/src | |
| parent | f387d8ef278a623e141153c6c87e5c4efa3bd917 (diff) | |
Facebook: Support for sending typing notifications from chatrooms (not supported in *SRMM yet)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9008 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src')
| -rw-r--r-- | protocols/FacebookRM/src/messages.cpp | 17 | 
1 files changed, 11 insertions, 6 deletions
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 1478aab8ca..31ffbc4c28 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -24,7 +24,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  int FacebookProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
  {
 -	//ForkThread(&FacebookProto::ReadMessageWorker, (void*)hContact);
  	CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
  	return Proto_RecvMessage(hContact, pre);
 @@ -126,7 +125,7 @@ int FacebookProto::UserIsTyping(MCONTACT hContact,int type)  void FacebookProto::SendTypingWorker(void *p)
  {
 -	if(p == NULL)
 +	if (p == NULL)
  		return;
  	send_typing *typing = static_cast<send_typing*>(p);
 @@ -147,16 +146,22 @@ void FacebookProto::SendTypingWorker(void *p)  		return;
  	}
 -	ptrA id( getStringA(typing->hContact, FACEBOOK_KEY_ID));
 +	const char *value = (isChatRoom(typing->hContact) ? FACEBOOK_KEY_TID : FACEBOOK_KEY_ID);
 +	ptrA id( getStringA(typing->hContact, value));
  	if (id != NULL) {
  		std::string data = "&source=mercury-chat";
 -		data += (typing->status == PROTOTYPE_SELFTYPING_ON ? "&typ=1" : "&typ=0"); // PROTOTYPE_SELFTYPING_OFF
 -		data += "&to=" + utils::url::encode(std::string(id));
 +		data += (typing->status == PROTOTYPE_SELFTYPING_ON ? "&typ=1" : "&typ=0");
 +		
 +		data += "&to=";
 +		if (isChatRoom(typing->hContact))
 +			data += "&thread=";
 +		data += utils::url::encode(std::string(id));
 +
  		data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
  		data += "&lsd=&phstamp=0&__user=" + facy.self_.user_id;
  		http::response resp = facy.flap(REQUEST_TYPING_SEND, &data);
 -	}		
 +	}
  	delete typing;
  }
  | 
