summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/import.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/import.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/import.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 3d71b9052a..6e6d8aa155 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -110,16 +110,20 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
DBVARIANT dbv;
// Readup FirstName
- if (!db_get_s(hContact, gg->m_szModuleName, "FirstName", &dbv, DBVT_ASCIIZ))
+ if (!db_get_s(hContact, gg->m_szModuleName, GG_KEY_PD_FIRSTNAME, &dbv, DBVT_WCHAR))
{
+ char* pszValA = mir_t2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
+ mir_free(pszValA);
DBFreeVariant(&dbv);
}
string_append_c(s, ';');
// Readup LastName
- if (!db_get_s(hContact, gg->m_szModuleName, "LastName", &dbv, DBVT_ASCIIZ))
+ if (!db_get_s(hContact, gg->m_szModuleName, GG_KEY_PD_LASTNAME, &dbv, DBVT_WCHAR))
{
+ char* pszValA = mir_t2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
+ mir_free(pszValA);
DBFreeVariant(&dbv);
}
string_append_c(s, ';');
@@ -129,9 +133,11 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
{
char* dbvA = mir_t2a(dbv.ptszVal);
DBVARIANT dbv2;
- if (!db_get_s(hContact, gg->m_szModuleName, "NickName", &dbv2, DBVT_ASCIIZ))
+ if (!db_get_s(hContact, gg->m_szModuleName, GG_KEY_PD_NICKNAME, &dbv2, DBVT_WCHAR))
{
- string_append(s, dbv2.pszVal);
+ char* pszValA = mir_t2a(dbv2.ptszVal);
+ string_append(s, pszValA);
+ mir_free(pszValA);
DBFreeVariant(&dbv2);
} else {
string_append(s, dbvA);
@@ -293,8 +299,16 @@ void GGPROTO::parsecontacts(char *contacts)
db_set_s(hContact, "CList", "Group", CreateGroup(strGroup));
// Write misc data
- if (hContact && strFirstName) db_set_s(hContact, m_szModuleName, "FirstName", strFirstName);
- if (hContact && strLastName) db_set_s(hContact, m_szModuleName, "LastName", strLastName);
+ if (hContact && strFirstName){
+ TCHAR *tstrFirstName = mir_a2t(strFirstName);
+ db_set_ts(hContact, m_szModuleName, GG_KEY_PD_FIRSTNAME, tstrFirstName);
+ mir_free(tstrFirstName);
+ }
+ if (hContact && strLastName){
+ TCHAR *tstrLastName = mir_a2t(strLastName);
+ db_set_ts(hContact, m_szModuleName, GG_KEY_PD_LASTNAME, tstrLastName);
+ mir_free(tstrLastName);
+ }
if (hContact && strPhone) db_set_s(hContact, "UserInfo", "MyPhone0", strPhone); // Store now in User Info
if (hContact && strMail) db_set_s(hContact, "UserInfo", "Mye-mail0", strMail); // Store now in User Info
}
@@ -440,7 +454,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam)
return 0;
*pfilter = '\0';
- *str = _T('\0');
+ *str = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
@@ -607,11 +621,11 @@ void GGPROTO::import_init(HGENMENU hRoot)
createObjService(service, &GGPROTO::import_server);
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE;
+ mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.hParentMenu = hRoot;
mi.position = 2000500001;
mi.icolibItem = iconList[1].hIcolib;
- mi.pszName = LPGEN("Import List From &Server");
+ mi.ptszName = LPGENT("Import List From &Server");
mi.pszService = service;
hMainMenu[2] = Menu_AddProtoMenuItem(&mi);
@@ -621,7 +635,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
mi.position = 2000500002;
mi.icolibItem = iconList[2].hIcolib;
- mi.pszName = LPGEN("Import List From &Text File...");
+ mi.ptszName = LPGENT("Import List From &Text File...");
mi.pszService = service;
hMainMenu[3] = Menu_AddProtoMenuItem(&mi);
@@ -631,7 +645,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
mi.position = 2000500003;
mi.icolibItem = iconList[3].hIcolib;
- mi.pszName = LPGEN("&Remove List From Server");
+ mi.ptszName = LPGENT("&Remove List From Server");
mi.pszService = service;
hMainMenu[4] = Menu_AddProtoMenuItem(&mi);
@@ -641,7 +655,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
mi.position = 2005000001;
mi.icolibItem = iconList[4].hIcolib;
- mi.pszName = LPGEN("Export List To &Server");
+ mi.ptszName = LPGENT("Export List To &Server");
mi.pszService = service;
hMainMenu[5] = Menu_AddProtoMenuItem(&mi);
@@ -651,7 +665,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
mi.position = 2005000002;
mi.icolibItem = iconList[5].hIcolib;
- mi.pszName = LPGEN("Export List To &Text File...");
+ mi.ptszName = LPGENT("Export List To &Text File...");
mi.pszService = service;
hMainMenu[6] = Menu_AddProtoMenuItem(&mi);
}