summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/gg_proto.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
commite2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 (patch)
treeba79bdcede96f80039f8b88d2791f198b9ec2981 /protocols/Gadu-Gadu/src/gg_proto.cpp
parentf8e34b5f83f3ce5f39d541e9068b6b8cb6d92acd (diff)
T2Utf - handy replacement for ptrA<mir_utf8decodeT()>
git-svn-id: http://svn.miranda-ng.org/main/trunk@13758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/gg_proto.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 6c532d195b..2b6d0db04a 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -277,14 +277,10 @@ HANDLE GGPROTO::SearchBasic(const PROTOCHAR *id)
return (HANDLE)1;
}
- char *id_utf8 = mir_utf8encodeT(id);
-
// Add uin and search it
- gg_pubdir50_add(req, GG_PUBDIR50_UIN, id_utf8);
+ gg_pubdir50_add(req, GG_PUBDIR50_UIN, T2Utf(id));
gg_pubdir50_seq_set(req, GG_SEQ_SEARCH);
- mir_free(id_utf8);
-
gg_EnterCriticalSection(&sess_mutex, "SearchBasic", 50, "sess_mutex", 1);
if (!gg_pubdir50(sess, req))
{
@@ -330,28 +326,25 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName,
// Add nick,firstName,lastName and search it
if (nick)
{
- char *nick_utf8 = mir_utf8encodeT(nick);
+ T2Utf nick_utf8(nick);
gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nick_utf8);
strncat(data, nick_utf8, sizeof(data) - mir_strlen(data));
- mir_free(nick_utf8);
}
strncat(data, ".", sizeof(data) - mir_strlen(data));
if (firstName)
{
- char *firstName_utf8 = mir_utf8encodeT(firstName);
+ T2Utf firstName_utf8(firstName);
gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8);
strncat(data, firstName_utf8, sizeof(data) - mir_strlen(data));
- mir_free(firstName_utf8);
}
strncat(data, ".", sizeof(data) - mir_strlen(data));
if (lastName)
{
- char *lastName_utf8 = mir_utf8encodeT(lastName);
+ T2Utf lastName_utf8(lastName);
gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8);
strncat(data, lastName_utf8, sizeof(data) - mir_strlen(data));
- mir_free(lastName_utf8);
}
strncat(data, ".", sizeof(data) - mir_strlen(data));
@@ -407,40 +400,36 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text));
if (mir_tstrlen(text))
{
- char *firstName_utf8 = mir_utf8encodeT(text);
+ T2Utf firstName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8);
strncat(data, firstName_utf8, sizeof(data) - mir_strlen(data));
- mir_free(firstName_utf8);
}
/* 1 */ strncat(data, ".", sizeof(data) - mir_strlen(data));
GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text));
if (mir_tstrlen(text))
{
- char *lastName_utf8 = mir_utf8encodeT(text);
+ T2Utf lastName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8);
strncat(data, lastName_utf8, sizeof(data) - mir_strlen(data));
- mir_free(lastName_utf8);
}
/* 2 */ strncat(data, ".", sizeof(data) - mir_strlen(data));
GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text));
if (mir_tstrlen(text))
{
- char *nickName_utf8 = mir_utf8encodeT(text);
+ T2Utf nickName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8);
strncat(data, nickName_utf8, sizeof(data) - mir_strlen(data));
- mir_free(nickName_utf8);
}
/* 3 */ strncat(data, ".", sizeof(data) - mir_strlen(data));
GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text));
if (mir_tstrlen(text))
{
- char *city_utf8 = mir_utf8encodeT(text);
+ T2Utf city_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8);
strncat(data, city_utf8, sizeof(data) - mir_strlen(data));
- mir_free(city_utf8);
}
/* 4 */ strncat(data, ".", sizeof(data) - mir_strlen(data));
@@ -468,10 +457,9 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
yearFrom = ay - yearFrom;
mir_sntprintf(text, SIZEOF(text), _T("%d %d"), yearFrom, yearTo);
- char *age_utf8 = mir_utf8encodeT(text);
+ T2Utf age_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, age_utf8);
strncat(data, age_utf8, sizeof(data) - mir_strlen(data));
- mir_free(age_utf8);
}
/* 5 */ strncat(data, ".", sizeof(data) - mir_strlen(data));