summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-17 14:07:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-17 14:07:44 +0000
commit122baf7f7465e0b5b890729d65914f527db1ca26 (patch)
tree117f5fe7914b636a5d99577235e58727c8ddedb3 /protocols/IcqOscarJ
parent5b68af4bce0056e373e69bf16fb7d3bdfac96dd8 (diff)
Unicode ACKTYPE_AWAYMSG broadcast
git-svn-id: http://svn.miranda-ng.org/main/trunk@458 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r--protocols/IcqOscarJ/fam_03buddy.cpp20
-rw-r--r--protocols/IcqOscarJ/icq_proto.cpp26
2 files changed, 15 insertions, 31 deletions
diff --git a/protocols/IcqOscarJ/fam_03buddy.cpp b/protocols/IcqOscarJ/fam_03buddy.cpp
index b551066248..3819972a8b 100644
--- a/protocols/IcqOscarJ/fam_03buddy.cpp
+++ b/protocols/IcqOscarJ/fam_03buddy.cpp
@@ -760,20 +760,12 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, HANDLE hContact, oscar
deleteSetting(hContact, DBSETTING_STATUS_NOTE);
setSettingDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS);
- { // Broadcast a notification
- int nNoteLen = strlennull(szStatusNote);
- char *szNoteAnsi = NULL;
-
- if (nNoteLen)
- { // the broadcast does not support unicode
- szNoteAnsi = (char*)_alloca(nNoteLen + 1);
- utf8_decode_static(szStatusNote, szNoteAnsi, strlennull(szStatusNote) + 1);
- }
- if (getContactXStatus(hContact) != 0 || !CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES))
- {
- setStatusMsgVar(hContact, szStatusNote, false);
- BroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)szNoteAnsi);
- }
+ if (getContactXStatus(hContact) != 0 || !CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES)) {
+ setStatusMsgVar(hContact, szStatusNote, false);
+
+ TCHAR* tszNote = mir_utf8decodeT(szStatusNote);
+ BroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszNote);
+ mir_free(tszNote);
}
}
SAFE_FREE(&szStatusNote);
diff --git a/protocols/IcqOscarJ/icq_proto.cpp b/protocols/IcqOscarJ/icq_proto.cpp
index 685c3142a5..342153e976 100644
--- a/protocols/IcqOscarJ/icq_proto.cpp
+++ b/protocols/IcqOscarJ/icq_proto.cpp
@@ -2130,26 +2130,21 @@ struct status_message_thread_data
void __cdecl CIcqProto::GetAwayMsgThread( void *pStatusData )
{
status_message_thread_data *pThreadData = (status_message_thread_data*)pStatusData;
-
- if (pThreadData)
- {
- char *szAnsiMsg = NULL;
-
+ if (pThreadData) {
// wait a little
Sleep(100);
setStatusMsgVar(pThreadData->hContact, pThreadData->szMessage, false);
- if (utf8_decode(pThreadData->szMessage, &szAnsiMsg))
- BroadcastAck(pThreadData->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, pThreadData->hProcess, (LPARAM)szAnsiMsg);
+ TCHAR *tszMsg = mir_utf8decodeT(pThreadData->szMessage);
+ BroadcastAck(pThreadData->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, pThreadData->hProcess, (LPARAM)tszMsg);
+ mir_free(tszMsg);
- SAFE_FREE(&szAnsiMsg);
SAFE_FREE(&pThreadData->szMessage);
SAFE_FREE((void**)&pThreadData);
}
}
-
////////////////////////////////////////////////////////////////////////////////////////
// PS_GetAwayMsg - returns a contact's away message
@@ -2249,19 +2244,16 @@ HANDLE __cdecl CIcqProto::GetAwayMsg( HANDLE hContact )
int __cdecl CIcqProto::RecvAwayMsg( HANDLE hContact, int statusMode, PROTORECVEVENT* evt )
{
- if (evt->flags & PREF_UTF)
- {
+ if (evt->flags & PREF_UTF) {
setStatusMsgVar(hContact, evt->szMessage, false);
- char* pszMsg = NULL;
- utf8_decode(evt->szMessage, &pszMsg);
+ TCHAR* pszMsg = mir_utf8decodeT(evt->szMessage);
BroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)pszMsg);
- SAFE_FREE(&pszMsg);
+ mir_free(pszMsg);
}
- else
- {
+ else {
setStatusMsgVar(hContact, evt->szMessage, true);
- BroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)evt->szMessage);
+ BroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)evt->lParam, (LPARAM)(TCHAR*)_A2T(evt->szMessage));
}
return 0;
}