From f3d6f64091b91b28775e72aad9abf39e6f50f9e4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 6 Jul 2014 17:49:20 +0000 Subject: fix for adding contacts in Twitter git-svn-id: http://svn.miranda-ng.org/main/trunk@9714 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Twitter/src/contacts.cpp | 38 +++++++++++++++++--------------------- protocols/Twitter/src/proto.cpp | 2 +- protocols/Twitter/src/stubs.cpp | 2 +- 3 files changed, 19 insertions(+), 23 deletions(-) (limited to 'protocols/Twitter') diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 9b74284170..483c140781 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -106,46 +106,42 @@ struct search_query void TwitterProto::DoSearch(void *p) { - if(p == 0) + if (p == 0) return; search_query *query = static_cast(p); twitter_user info; bool found = false; - try - { - char* p = mir_utf8encodeT( query->query.c_str()); + try { + char *p = mir_utf8encodeT(query->query.c_str()); ScopedLock s(twitter_lock_); - if(query->by_email) - found = twit_.get_info_by_email(p,&info); + if (query->by_email) + found = twit_.get_info_by_email(p, &info); else - found = twit_.get_info(p,&info); - mir_free( p ); + found = twit_.get_info(p, &info); + mir_free(p); } - catch(const std::exception &e) - { - ShowPopup( (std::string("While searching for contacts, an error occurred: ") + e.what()).c_str()); - debugLogA( _T("***** Error searching for contacts: %s"), e.what()); + catch (const std::exception &e) { + ShowPopup((std::string("While searching for contacts, an error occurred: ") + e.what()).c_str()); + debugLogA(_T("***** Error searching for contacts: %s"), e.what()); found = false; } - if(found) { - PROTOSEARCHRESULT psr = {sizeof(psr)}; - psr.nick = mir_a2t(info.username. c_str()); + if (found) { + PROTOSEARCHRESULT psr = { sizeof(psr) }; + psr.flags = PSR_TCHAR; + psr.nick = mir_a2t(info.username.c_str()); psr.firstName = mir_a2t(info.real_name.c_str()); - ProtoBroadcastAck(0,ACKTYPE_SEARCH,ACKRESULT_DATA,(HANDLE)1, (LPARAM)&psr); - ProtoBroadcastAck(0,ACKTYPE_SEARCH,ACKRESULT_SUCCESS,(HANDLE)1,0); + ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); + ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); mir_free(psr.nick); mir_free(psr.firstName); } - else - { - ProtoBroadcastAck(0,ACKTYPE_SEARCH,ACKRESULT_SUCCESS,(HANDLE)1,0); - } + else ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); delete query; } diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index f90f6b504c..83f5982c81 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -508,4 +508,4 @@ INT_PTR TwitterProto::GetAvatar(WPARAM,LPARAM) INT_PTR TwitterProto::SetAvatar(WPARAM,LPARAM) { return 0; -} \ No newline at end of file +} diff --git a/protocols/Twitter/src/stubs.cpp b/protocols/Twitter/src/stubs.cpp index d40d814521..7a61276701 100644 --- a/protocols/Twitter/src/stubs.cpp +++ b/protocols/Twitter/src/stubs.cpp @@ -126,4 +126,4 @@ int TwitterProto::SetAwayMsg(int status,const TCHAR *msg) int TwitterProto::UserIsTyping(MCONTACT hContact,int type) { return 1; -} \ No newline at end of file +} -- cgit v1.2.3