diff options
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/Tlen/src/tlen_svc.cpp | 8 | ||||
| -rw-r--r-- | protocols/Tlen/src/tlen_thread.cpp | 15 | 
2 files changed, 17 insertions, 6 deletions
| diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index fda51c425e..84755d7291 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -612,18 +612,19 @@ int TlenProtocol::SendMsg(MCONTACT hContact, int, const char* msgRAW)  	TLEN_LIST_ITEM *item;
  	char msgType[16];
 +	char* msg = mir_utf8decodeA(msgRAW);
  	int id = TlenSerialNext(this);
 -	if (!mir_strcmp(msgRAW, "<alert>")) {
 +	if (!mir_strcmp(msg, "<alert>")) {
  		TlenSend(this, "<m tp='a' to='%s'/>", dbv.pszVal);
  		forkthread(TlenSendMessageAckThread, 0, new SENDACKTHREADDATA(this, hContact, id));
  	}
 -	else if (!mir_strcmp(msgRAW, "<image>")) {
 +	else if (!mir_strcmp(msg, "<image>")) {
  		TlenSend(this, "<message to='%s' type='%s' crc='%x' idt='%d'/>", dbv.pszVal, "pic", 0x757f044, id);
  		forkthread(TlenSendMessageAckThread, 0, new SENDACKTHREADDATA(this, hContact, id));
  	}
  	else {
 -		char *msgEnc = TlenTextEncode(msgRAW);
 +		char *msgEnc = TlenTextEncode(msg);
  		if (msgEnc != NULL) {
  			if (TlenListExist(this, LIST_CHATROOM, dbv.pszVal) && strchr(dbv.pszVal, '/') == NULL)
  				mir_strcpy(msgType, "groupchat");
 @@ -651,6 +652,7 @@ int TlenProtocol::SendMsg(MCONTACT hContact, int, const char* msgRAW)  		mir_free(msgEnc);
  	}
 +	mir_free(msg);
  	db_free(&dbv);
  	return id;
  }
 diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 7b0b5ae460..4fdf7c6e80 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -712,11 +712,15 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info)  								msgTime = time(NULL);
  							}
  						}
 +						char* localMessage_Utf8 = mir_utf8encode(localMessage);
 +
  						PROTORECVEVENT recv = { 0 };
  						recv.timestamp = (DWORD) msgTime;
 -						recv.szMessage = localMessage;
 +						recv.szMessage = localMessage_Utf8;
  						recv.lParam = 0;
  						ProtoChainRecvMsg(hContact, &recv);
 +
 +						mir_free(localMessage_Utf8);
  						mir_free(localMessage);
  					}
  				}
 @@ -931,12 +935,14 @@ static void TlenProcessW(XmlNode *node, ThreadData *info)  		TlenStringAppend(&str, &strSize, "\r\n\r\n%s", body);
  		localMessage = TlenTextDecode(str);
 +		char* localMessage_Utf8 = mir_utf8encode(localMessage);
  		PROTORECVEVENT recv = { 0 };
  		recv.timestamp = (DWORD) time(NULL);
 -		recv.szMessage = localMessage;
 +		recv.szMessage = localMessage_Utf8;
  		ProtoChainRecvMsg(hContact, &recv);	
 +		mir_free(localMessage_Utf8);
  		mir_free(localMessage);
  		mir_free(str);
  	}
 @@ -1016,11 +1022,14 @@ static void TlenProcessM(XmlNode *node, ThreadData *info)  						db_set_b(hContact, info->proto->m_szModuleName, "bChat", TRUE);
  						mir_free(str);
  						localMessage = TlenTextDecode(bNode->text);
 +						char* localMessage_Utf8 = mir_utf8encode(localMessage);
  						PROTORECVEVENT recv = { 0 };
  						recv.timestamp = (DWORD) timestamp;
 -						recv.szMessage = localMessage;
 +						recv.szMessage = localMessage_Utf8;
  						ProtoChainRecvMsg(hContact, &recv);
 +
 +						mir_free(localMessage_Utf8);
  						mir_free(localMessage);
  					}
  				}
 | 
