summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/groupchat.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/groupchat.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/groupchat.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index e742263aae..a0768e238f 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -65,7 +65,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
char service[64];
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE;
+ mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.hParentMenu = hRoot;
// Conferencing
@@ -73,7 +73,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
createObjService(service, &GGPROTO::gc_openconf);
mi.position = 2000050001;
mi.icolibItem = iconList[14].hIcolib;
- mi.pszName = LPGEN("Open &conference...");
+ mi.ptszName = LPGENT("Open &conference...");
mi.pszService = service;
hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
@@ -82,7 +82,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
createObjService(service, &GGPROTO::gc_clearignored);
mi.position = 2000050002;
mi.icolibItem = iconList[15].hIcolib;
- mi.pszName = LPGEN("&Clear ignored conferences");
+ mi.ptszName = LPGENT("&Clear ignored conferences");
mi.pszService = service;
hMainMenu[1] = Menu_AddProtoMenuItem(&mi);
}
@@ -186,19 +186,19 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam)
// Get rid of CRLF at back
lc = (int)_tcslen(gch->ptszText) - 1;
while(lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r')) gch->ptszText[lc --] = 0;
- char* pszText = mir_t2a(gch->ptszText);
gcevent.time = time(NULL);
gcevent.bIsMe = 1;
gcevent.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- netlog("gc_event(): Sending conference message to room %S, \"%s\".", gch->pDest->ptszID, pszText);
+ netlog("gc_event(): Sending conference message to room %S, \"%S\".", gch->pDest->ptszID, gch->ptszText);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
mir_free(nickT);
+ char* pszText_utf8 = mir_utf8encodeT(gch->ptszText);
gg_EnterCriticalSection(&sess_mutex, "gc_event", 57, "sess_mutex", 1);
- gg_send_message_confer(sess, GG_CLASS_CHAT, chat->recipients_count, chat->recipients, (BYTE*)pszText);
+ gg_send_message_confer(sess, GG_CLASS_CHAT, chat->recipients_count, chat->recipients, (BYTE*)pszText_utf8);
gg_LeaveCriticalSection(&sess_mutex, "gc_event", 57, 1, "sess_mutex", 1);
- mir_free(pszText);
+ mir_free(pszText_utf8);
return 1;
}
@@ -210,9 +210,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam)
if ((uin = _ttoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL)))
CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
}
- char* pszText = mir_t2a(gch->ptszText);
- netlog("gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->pDest->iType, chat, uin, pszText);
- mir_free(pszText);
+ netlog("gc_event(): Unhandled event %d, chat %x, uin %d, text \"%S\".", gch->pDest->iType, chat, uin, gch->ptszText);
return 0;
}
@@ -401,7 +399,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count
CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gcevent);
CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gcevent);
- netlog("gc_getchat(): Returning new chat window %s, count %d.", chat->id, chat->recipients_count);
+ netlog("gc_getchat(): Returning new chat window %S, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
return chat->id;
}
@@ -517,6 +515,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
gcdest.ptszID = chat;
gcdest.iType = GC_EVENT_CONTROL;
GCEVENT gcevent = {sizeof(GCEVENT), &gcdest};
+ gcevent.dwFlags = GC_TCHAR;
CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gcevent);
}
free(participants);
@@ -683,7 +682,7 @@ int GGPROTO::gc_changenick(HANDLE hContact, TCHAR *ptszNick)
gce.dwFlags = GC_TCHAR;
gce.ptszText = ptszNick;
- netlog("gc_changenick(): Found room %S with uin %d, sending nick change %s.", chat->id, uin, id);
+ netlog("gc_changenick(): Found room %S with uin %d, sending nick change %S.", chat->id, uin, id);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
break;