summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-05-30 13:39:00 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-05-30 13:39:00 +0200
commita63faf6fa95017dbbfeaf0ff43fdb526c4ae7068 (patch)
tree42ee1836e80d6bbbc9cb2b2cff2b39116320c7da /src/xmpp
parent8eb9e535a3514a7d9254819f499dcb169c56b51e (diff)
downloadbiboumi-a63faf6fa95017dbbfeaf0ff43fdb526c4ae7068.tar.gz
biboumi-a63faf6fa95017dbbfeaf0ff43fdb526c4ae7068.tar.bz2
biboumi-a63faf6fa95017dbbfeaf0ff43fdb526c4ae7068.tar.xz
biboumi-a63faf6fa95017dbbfeaf0ff43fdb526c4ae7068.zip
Use libuuid to generate unique IDs for iq and adhoc sessions
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/xmpp_component.cpp10
-rw-r--r--src/xmpp/xmpp_component.hpp2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index 4c62aa7..9547e3a 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -13,14 +13,14 @@
#include <config.h>
+#include <uuid.h>
+
#ifdef SYSTEMDDAEMON_FOUND
# include <systemd/sd-daemon.h>
#endif
using namespace std::string_literals;
-unsigned long XmppComponent::current_id = 0;
-
static std::set<std::string> kickable_errors{
"gone",
"internal-server-error",
@@ -934,5 +934,9 @@ void XmppComponent::send_iq_version_request(const std::string& from,
std::string XmppComponent::next_id()
{
- return std::to_string(XmppComponent::current_id++);
+ char uuid_str[37];
+ uuid_t uuid;
+ uuid_generate(uuid);
+ uuid_unparse(uuid, uuid_str);
+ return uuid_str;
}
diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp
index b234d76..e3e24e0 100644
--- a/src/xmpp/xmpp_component.hpp
+++ b/src/xmpp/xmpp_component.hpp
@@ -235,8 +235,6 @@ private:
*/
std::unordered_map<std::string, std::unique_ptr<Bridge>> bridges;
- static unsigned long current_id;
-
AdhocCommandsHandler adhoc_commands_handler;
XmppComponent(const XmppComponent&) = delete;
XmppComponent(XmppComponent&&) = delete;