From 82d166baff3cf2926cf8e95c8b41a43cae612c0a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Sep 2023 10:31:03 +0300 Subject: code cleaning --- protocols/JabberG/src/jabber_proto.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index c0b8d4b93c..993e0faf2f 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -441,23 +441,13 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) debugLogA("Entering AuthDeny"); DB::EventInfo dbei(hDbEvent); - if (!dbei) - return 1; - - if (dbei.eventType != EVENTTYPE_AUTHREQUEST) + if (!dbei || dbei.eventType != EVENTTYPE_AUTHREQUEST || mir_strcmp(dbei.szModule, m_szModuleName)) return 1; - if (mir_strcmp(dbei.szModule, m_szModuleName)) - return 1; - - char *nick = (char*)(dbei.pBlob + sizeof(uint32_t) * 2); - char *firstName = nick + mir_strlen(nick) + 1; - char *lastName = firstName + mir_strlen(firstName) + 1; - char *jid = lastName + mir_strlen(lastName) + 1; - - debugLogA("Send 'authorization denied' to %s", jid); + DB::AUTH_BLOB auth(dbei.pBlob); + debugLogA("Send 'authorization denied' to %s", auth.get_email()); - ptrA newJid(dbei.flags & DBEF_UTF ? mir_strdup(jid) : mir_utf8encode(jid)); + ptrA newJid(dbei.flags & DBEF_UTF ? mir_strdup(auth.get_email()) : mir_utf8encode(auth.get_email())); m_ThreadInfo->send(XmlNode("presence") << XATTR("to", newJid) << XATTR("type", "unsubscribed")); return 0; } -- cgit v1.2.3