From e2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 22 May 2015 16:04:17 +0000 Subject: T2Utf - handy replacement for ptrA git-svn-id: http://svn.miranda-ng.org/main/trunk@13758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Yahoo/src/yahoo.cpp | 46 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) (limited to 'protocols/Yahoo/src/yahoo.cpp') diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 3f70ae957a..58c9089d4d 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -200,56 +200,28 @@ void CYahooProto::logout() void CYahooProto::AddBuddy(MCONTACT hContact, const char *group, const TCHAR *msg) { - DBVARIANT dbv; - char *fname=NULL, *lname=NULL, *ident=NULL, *who, *u_msg; - int protocol; - /* We adding a buddy to our list. 2 Stages. 1. We send add buddy packet. 2. We get a packet back from the server confirming add. No refresh needed. */ - - if (!getString(hContact, YAHOO_LOGINID, &dbv)) - { - who = strdup(dbv.pszVal); - db_free(&dbv); - } - else - return; - - protocol = getWord(hContact, "yprotoid", 0); - u_msg = mir_utf8encodeT(msg); - if (!getString(hContact, "MyIdentity", &dbv)) - { - ident = strdup(dbv.pszVal); - db_free(&dbv); - } + ptrA who(getStringA(hContact, YAHOO_LOGINID)); + if (who == NULL) + return; - if (!GetStringUtf(NULL, "FirstName", &dbv)) - { - fname = strdup(dbv.pszVal); - db_free(&dbv); - } + int protocol = getWord(hContact, "yprotoid", 0); + T2Utf u_msg(msg); - if (!GetStringUtf(NULL, "LastName", &dbv)) - { - lname = strdup(dbv.pszVal); - db_free(&dbv); - } + ptrA ident(getStringA(hContact, "MyIdentity")); + ptrT fname(getTStringA(NULL, "FirstName")); + ptrT lname(getTStringA(NULL, "LastName")); SetStringUtf(hContact, "YGroup", group); debugLogA("Adding Permanently %s to list. Auth: %s", who, u_msg ? u_msg : ""); - yahoo_add_buddy(m_id, ident, fname, lname, who, protocol, group, u_msg); - - free(fname); - free(lname); - free(ident); - free(who); - mir_free(u_msg); + yahoo_add_buddy(m_id, ident, T2Utf(fname), T2Utf(lname), who, protocol, group, u_msg); } MCONTACT CYahooProto::getbuddyH(const char *yahoo_id) -- cgit v1.2.3