summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_util.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-04-13 17:54:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-04-13 17:54:12 +0300
commitccd1d2cf194034faa91ee353e544a9337d3fa993 (patch)
tree8721417a5d7217a0b71200a5f142507c5b3f0983 /protocols/JabberG/src/jabber_util.cpp
parentfee3a74e7429552ebbfe7ae9c14a4f6c25156fb6 (diff)
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
Diffstat (limited to 'protocols/JabberG/src/jabber_util.cpp')
-rwxr-xr-xprotocols/JabberG/src/jabber_util.cpp11
1 files changed, 5 insertions, 6 deletions
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);
}