summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/services.cpp
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2012-12-22 00:30:47 +0000
committerSzymon Tokarz <wsx22@o2.pl>2012-12-22 00:30:47 +0000
commit1b50be65056f9f625a2242b3eab128b2c1c2ad7f (patch)
tree6fd7a6af17c7f78b312e669b24bd10bf85061873 /protocols/Gadu-Gadu/src/services.cpp
parent5d674840ea8cafd9975bd5f1ce7aa13a504891c5 (diff)
Gadu-Gadu protocol:
Change libgadu gg encoding from GG_ENCODING_CP1250 to GG_ENCODING_UTF8 and support it. This is a long-awaited change with introducing UTF-8 support at: - messages - status descriptions (fixes issue #8) - group chats (searching and public directory not support UTF-8 beacouse of libgadu limitations, thats works as previously) Thanks to Tomasz Figa for his path from http://code.google.com/p/miranda/issues/detail?id=1195 git-svn-id: http://svn.miranda-ng.org/main/trunk@2786 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/services.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index 3df7eced87..9d6ae0115f 100644
--- a/protocols/Gadu-Gadu/src/services.cpp
+++ b/protocols/Gadu-Gadu/src/services.cpp
@@ -50,7 +50,7 @@ char *gg_status2db(int status, const char *suffix)
//////////////////////////////////////////////////////////
// gets protocol status
-char* GGPROTO::getstatusmsg(int status)
+TCHAR* GGPROTO::getstatusmsg(int status)
{
switch(status) {
case ID_STATUS_ONLINE:
@@ -100,16 +100,17 @@ int GGPROTO::refreshstatus(int status)
}
else
{
- char *szMsg = NULL;
+ TCHAR *szMsg = NULL;
// Select proper msg
gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 69, "modemsg_mutex", 1);
- szMsg = mir_strdup(getstatusmsg(status));
+ szMsg = getstatusmsg(status);
gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 69, 1, "modemsg_mutex", 1);
- if (szMsg)
+ char *szMsg_utf8 = mir_utf8encodeT(szMsg);
+ if (szMsg_utf8)
{
netlog("refreshstatus(): Setting status and away message.");
gg_EnterCriticalSection(&sess_mutex, "refreshstatus", 70, "sess_mutex", 1);
- gg_change_status_descr(sess, status_m2gg(status, szMsg != NULL), szMsg);
+ gg_change_status_descr(sess, status_m2gg(status, szMsg_utf8 != NULL), szMsg_utf8);
gg_LeaveCriticalSection(&sess_mutex, "refreshstatus", 70, 1, "sess_mutex", 1);
}
else
@@ -122,7 +123,7 @@ int GGPROTO::refreshstatus(int status)
// Change status of the contact with our own UIN (if got yourself added to the contact list)
changecontactstatus( db_get_dw(NULL, m_szModuleName, GG_KEY_UIN, 0), status_m2gg(status, szMsg != NULL), szMsg, 0, 0, 0, 0);
broadcastnewstatus(status);
- mir_free(szMsg);
+ mir_free(szMsg_utf8);
}
return TRUE;
@@ -326,12 +327,12 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam)
INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam)
{
INT_PTR res = 0;
- char *szMsg;
+ TCHAR *szMsg;
gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 72, "modemsg_mutex", 1);
szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus);
if (isonline() && szMsg)
- res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_a2u(szMsg) : (INT_PTR)mir_strdup(szMsg);
+ res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szMsg) : (INT_PTR)mir_t2a(szMsg);
gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 72, 1, "modemsg_mutex", 1);
return res;
}