From 518e9a70f554179f344510f594d7d759b56cea58 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 29 Jan 2015 16:24:44 +0000 Subject: fix for the automatic nick name extraction git-svn-id: http://svn.miranda-ng.org/main/trunk@11951 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/contacts.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'protocols/WhatsApp/src/contacts.cpp') diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 0250420ed2..487afc6321 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -28,9 +28,10 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string& jid, BYTE , bool don oldName = dbv.pszVal; db_free(&dbv); } - db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name); if (oldName.compare(string(new_name)) != 0) { + db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name); + CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrT(mir_utf8decodeT(new_name))); this->NotifyEvent(_A2T(oldName.c_str()), tmp, hContact, WHATSAPP_EVENT_OTHER); } @@ -496,13 +497,10 @@ INT_PTR __cdecl WhatsAppProto::OnChangeGroupSubject(WPARAM hContact, LPARAM lPar { input_box* ib = new input_box; - DBVARIANT dbv; - if (getTString(hContact, WHATSAPP_KEY_NICK, &dbv)) - ib->defaultValue = _T(""); - else { - ib->defaultValue = dbv.ptszVal; - db_free(&dbv); - } + ptrT szNick(getTStringA(hContact, WHATSAPP_KEY_NICK)); + if (szNick != NULL) + ib->defaultValue = szNick; + ib->limit = WHATSAPP_GROUP_NAME_LIMIT; ib->text = _T("Enter new group subject"); ib->title = _T("WhatsApp - Change Group Subject"); -- cgit v1.2.3