From d4c7112ac94d71397957c2bab796167cc91532fd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 27 Sep 2013 21:40:31 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@6255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_menu.cpp | 45 +++++++++++++-------------------- protocols/JabberG/src/jabber_misc.cpp | 3 +-- protocols/JabberG/src/jabber_thread.cpp | 15 ++++------- 3 files changed, 24 insertions(+), 39 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index f15770ead0..2c9fef4f4e 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -534,43 +534,34 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM wParam, LPARAM) { - HANDLE hContact; - DBVARIANT dbv; - - if ((hContact=(HANDLE)wParam) != NULL && m_bJabberOnline) { - if ( !getTString(hContact, "jid", &dbv)) { - m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribe"))); - db_free(&dbv); - } } - + HANDLE hContact = (HANDLE)wParam; + if (hContact != NULL && m_bJabberOnline) { + ptrT jid( getTStringA(hContact, "jid")); + if (jid != NULL) + m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), jid) << XATTR(_T("type"), _T("subscribe"))); + } return 0; } INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM wParam, LPARAM) { - HANDLE hContact; - DBVARIANT dbv; - - if ((hContact=(HANDLE)wParam) != NULL && m_bJabberOnline) { - if ( !getTString(hContact, "jid", &dbv)) { - m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("subscribed"))); - db_free(&dbv); - } } - + HANDLE hContact = (HANDLE)wParam; + if (hContact != NULL && m_bJabberOnline) { + ptrT jid( getTStringA(hContact, "jid")); + if (jid != NULL) + m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), jid) << XATTR(_T("type"), _T("subscribed"))); + } return 0; } INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM wParam, LPARAM) { - HANDLE hContact; - DBVARIANT dbv; - - if ((hContact=(HANDLE)wParam) != NULL && m_bJabberOnline) { - if ( !getTString(hContact, "jid", &dbv)) { - m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), dbv.ptszVal) << XATTR(_T("type"), _T("unsubscribed"))); - db_free(&dbv); - } } - + HANDLE hContact = (HANDLE)wParam; + if (hContact != NULL && m_bJabberOnline) { + ptrT jid( getTStringA(hContact, "jid")); + if (jid != NULL) + m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), jid) << XATTR(_T("type"), _T("unsubscribed"))); + } return 0; } diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index eef1de05ab..819250ba3f 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -69,9 +69,8 @@ int JabberCompareJids(const TCHAR *jid1, const TCHAR *jid2) void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) { - HANDLE hContact = DBCreateContact(jid, NULL, TRUE, TRUE); + HANDLE hContact = DBCreateContact(jid, nick, TRUE, TRUE); delSetting(hContact, "Hidden"); - //setTString(hContact, "Nick", nick); char* szJid = mir_utf8encodeT(jid); char* szNick = mir_utf8encodeT(nick); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 64428e6671..48a14ebc1d 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1732,7 +1732,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) RebuildInfoFrame(); } else { - HXML n = xmlGetChild(node , "nick"); + HXML n = xmlGetChild(node, "nick"); nick = (n == NULL) ? JabberNickFromJID(from) : mir_tstrdup(xmlGetText(n)); if (nick != NULL) { Log("%S (%S) requests authorization", nick, from); @@ -1742,24 +1742,19 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) return; } - if ( !_tcscmp(type, _T("unsubscribe"))) { + if ( !_tcscmp(type, _T("unsubscribe"))) if (hContact = HContactFromJID(from)) AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBE); - } - if ( !_tcscmp(type, _T("unsubscribed"))) { + if ( !_tcscmp(type, _T("unsubscribed"))) if (hContact = HContactFromJID(from)) AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBED); - } - if ( !_tcscmp(type, _T("error"))) { - if (hContact = HContactFromJID(from)) { + if ( !_tcscmp(type, _T("error"))) + if (hContact = HContactFromJID(from)) AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_ERROR); - } - } if ( !_tcscmp(type, _T("subscribed"))) { - if (hContact = HContactFromJID(from)) AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_SUBSCRIBED); -- cgit v1.2.3