From ccd1d2cf194034faa91ee353e544a9337d3fa993 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 13 Apr 2019 17:54:12 +0300 Subject: Jabber: - Miranda to generate globally unique packet ids; - unused member IJabberInterface::AddTemporaryIqHandler removed; - two rarely used params removed from CJabberProto::AddIQ && CJabberIqManager::AddHandler - code cleaning --- protocols/JabberG/src/jabber_util.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'protocols/JabberG/src/jabber_util.cpp') diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 1d569e09a6..b1169e26ab 100755 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -514,12 +514,11 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) /////////////////////////////////////////////////////////////////////////////// // JabberGetPacketID - converts the xml id attribute into an integer -int JabberGetPacketID(const TiXmlElement *n) +int JabberGetPacketID(const char *str) { - const char *str = XmlGetAttr(n, "id"); - if (str) - if (!strncmp(str, JABBER_IQID, _countof(JABBER_IQID) - 1)) - return atoi(str + _countof(JABBER_IQID) - 1); + if (mir_strlen(str) >= 20) + if (!memcmp(str, "mir", 3) && !memcmp(g_plugin.szRandom, str+3, 16) && str[19] == '_') + return atoi(str + 20); return -1; } @@ -527,7 +526,7 @@ int JabberGetPacketID(const TiXmlElement *n) char* JabberId2string(int id) { char text[100]; - mir_snprintf(text, JABBER_IQID "%d", id); + mir_snprintf(text, "mir%s_%d", g_plugin.szRandom, id); return mir_strdup(text); } -- cgit v1.2.3