diff options
author | Szymon Tokarz <wsx22@o2.pl> | 2013-04-27 09:17:01 +0000 |
---|---|---|
committer | Szymon Tokarz <wsx22@o2.pl> | 2013-04-27 09:17:01 +0000 |
commit | 5aadfaa9bcaa25825e33f75f49f713a43670d925 (patch) | |
tree | 8d594d999d9bc33bed31eabec8d927779bcbd24a /protocols/Tlen/src | |
parent | e4b1413ff3fb8c169e2725c3e7686f47eaf93ec8 (diff) |
Tlen protocol
- fixed crash when contact on list changeed status (introduced in r4481)
- fixes in sending messages and status description support
git-svn-id: http://svn.miranda-ng.org/main/trunk@4549 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tlen/src')
-rw-r--r-- | protocols/Tlen/src/jabber_svc.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp index 79a804cf52..b9daff52ad 100644 --- a/protocols/Tlen/src/jabber_svc.cpp +++ b/protocols/Tlen/src/jabber_svc.cpp @@ -581,14 +581,13 @@ static void __cdecl TlenGetAwayMsgThread(void *ptr) if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(data->proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
db_free(&dbv);
- if (item->statusMessage != NULL) {
- ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)data->msgid, (LPARAM) item->statusMessage);
- return;
- }
+ ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1,
+ item->statusMessage==NULL ? (LPARAM)NULL : (LPARAM)(TCHAR*)_A2T(item->statusMessage));
+ return;
}
else db_free(&dbv);
}
- ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) "");
+ ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)(TCHAR*)TEXT(""));
delete data;
}
@@ -605,7 +604,7 @@ INT_PTR TlenSendAlert(void *ptr, LPARAM wParam, LPARAM lParam) return 0;
}
-int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg)
+int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msgRAW)
{
DBVARIANT dbv;
char *msgEnc;
@@ -617,6 +616,15 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) return 2;
}
+ char* msg;
+ if (flags & PREF_UNICODE)
+ msg = mir_u2a((wchar_t*)&msgRAW[strlen(msgRAW) + 1]);
+ else if (flags & PREF_UTF)
+ msg = mir_utf8decodeA(msgRAW);
+ else
+ msg = mir_strdup(msgRAW);
+
+
int id = JabberSerialNext(this);
if (!strcmp(msg, "<alert>")) {
@@ -657,6 +665,8 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg) }
mir_free(msgEnc);
}
+
+ mir_free(msg);
db_free(&dbv);
return id;
}
@@ -705,10 +715,8 @@ static INT_PTR TlenGetAvatarInfo(void *ptr, LPARAM wParam, LPARAM lParam) HANDLE __cdecl TlenProtocol::GetAwayMsg(HANDLE hContact)
{
- SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
- tdata->proto = this;
- tdata->hContact = hContact;
- JabberForkThread((void (__cdecl *)(void*))TlenGetAwayMsgThread, 0, (void *) tdata);
+ SENDACKTHREADDATA *tdata = new SENDACKTHREADDATA(this, hContact, 0);
+ JabberForkThread((void (__cdecl *)(void*))TlenGetAwayMsgThread, 0, (void*)tdata);
return (HANDLE)1;
}
|