From 48266e479d1fcf5153b29c612866845990fccad8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 21 May 2015 16:11:58 +0000 Subject: war against atavisms continues - everything that goes to PSS_MESSAGE should be sent as utf8 string; - thus PREF_UNICODE & PREF_UTF support discontinued, these constants are removed; - support for PREF_UNICODE & PREF_UTF in protocols also removed; - PREF_UNICODE used in file transfers (PROTOFILERECVT) replaced with PRFF_UNICODE / PRFF_TCHAR git-svn-id: http://svn.miranda-ng.org/main/trunk@13734 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/core.cpp | 3 +-- protocols/Gadu-Gadu/src/filetransfer.cpp | 2 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 17 ++++------------- protocols/Gadu-Gadu/src/image.cpp | 5 +++-- 4 files changed, 9 insertions(+), 18 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 08dfae9cb7..01452e7a5f 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -848,7 +848,6 @@ retry: PROTORECVEVENT pre = {0}; time_t t = time(NULL); pre.timestamp = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time; - pre.flags = PREF_UTF; pre.szMessage = e->event.msg.message; ProtoChainRecvMsg( getcontact(e->event.msg.sender, 1, 0, NULL), &pre); } @@ -1058,7 +1057,7 @@ retry: TCHAR* filenameT = mir_a2t((char*)dcc7->filename); PROTORECVFILET pre = {0}; - pre.flags = PREF_TCHAR; + pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); pre.tszDescription = filenameT; diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 4426f3c9eb..162c57f27c 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -385,7 +385,7 @@ void __cdecl GGPROTO::dccmainthread(void*) TCHAR* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename); PROTORECVFILET pre = {0}; - pre.flags = PREF_TCHAR; + pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); pre.tszDescription = filenameT; diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 4a55df086f..7d497c7033 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -155,7 +155,7 @@ DWORD_PTR GGPROTO::GetCaps(int type, MCONTACT hContact) case PFLAGNUM_3: return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE; case PFLAGNUM_4: - return PF4_NOCUSTOMAUTH | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE | PF4_IMSENDUTF; + return PF4_NOCUSTOMAUTH | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE; case PFLAGNUM_5: return PF2_LONGAWAY; case PFLAG_UNIQUEIDTEXT: @@ -567,25 +567,17 @@ void __cdecl GGPROTO::sendackthread(void *ack) mir_free(ack); } -int GGPROTO::SendMsg(MCONTACT hContact, int flags, const char *msg) +int GGPROTO::SendMsg(MCONTACT hContact, int, const char *msg) { uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0); if (!isonline() || !uin) return 0; - char* msg_utf8; - if (flags & PREF_UNICODE) - msg_utf8 = mir_utf8encodeW((wchar_t*)&msg[ strlen( msg )+1 ] ); - else if (flags & PREF_UTF) - msg_utf8 = mir_strdup(msg); - else - msg_utf8 = mir_utf8encode(msg); - - if (!msg_utf8) + if (!msg) return 0; gg_EnterCriticalSection(&sess_mutex, "SendMsg", 53, "sess_mutex", 1); - int seq = gg_send_message(sess, GG_CLASS_CHAT, uin, (BYTE*)msg_utf8); + int seq = gg_send_message(sess, GG_CLASS_CHAT, uin, (BYTE*)msg); gg_LeaveCriticalSection(&sess_mutex, "SendMsg", 53, 1, "sess_mutex", 1); if (!getByte(GG_KEY_MSGACK, GG_KEYDEF_MSGACK)) { @@ -601,7 +593,6 @@ int GGPROTO::SendMsg(MCONTACT hContact, int flags, const char *msg) ForkThread(&GGPROTO::sendackthread, ack); } } - mir_free(msg_utf8); return seq; } diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index e0dccada81..61452bb6fc 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -863,11 +863,12 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) mir_sntprintf(image_msg, SIZEOF(image_msg), _T("[img]%s[/img]"), szPath); PROTORECVEVENT pre = {0}; - pre.flags = PREF_TCHAR; pre.timestamp = time(NULL); - pre.tszMessage = image_msg; + pre.szMessage = mir_utf8encodeT(image_msg); ProtoChainRecvMsg(hContact, &pre); debugLog(_T("img_displayasmsg(): Image saved to %s."), szPath); + + mir_free(pre.szMessage); } else { -- cgit v1.2.3