summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp/xmpp_component.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-08-25 19:43:51 +0200
committerlouiz’ <louiz@louiz.org>2016-08-28 22:42:50 +0200
commit7536a1b3f38fbf093c1629b0db209754ada0c906 (patch)
tree6d5f8f9d8ba3aa7274b75cc733dabdd89f20f29d /louloulibs/xmpp/xmpp_component.cpp
parentb59fc2a834dccb35f12dcfec624b6181e4e2fbe9 (diff)
downloadbiboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.tar.gz
biboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.tar.bz2
biboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.tar.xz
biboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.zip
Respond to MAM requests on a channel JID
At the moment, result-set-management is not implemented, the whole history (well, at most 1024 messages) is returned.
Diffstat (limited to 'louloulibs/xmpp/xmpp_component.cpp')
-rw-r--r--louloulibs/xmpp/xmpp_component.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/louloulibs/xmpp/xmpp_component.cpp b/louloulibs/xmpp/xmpp_component.cpp
index 07d2408..5db857c 100644
--- a/louloulibs/xmpp/xmpp_component.cpp
+++ b/louloulibs/xmpp/xmpp_component.cpp
@@ -7,22 +7,10 @@
#include <config/config.hpp>
#include <xmpp/jid.hpp>
#include <utils/sha1.hpp>
-
-#include <stdexcept>
-#include <iostream>
-#include <set>
-
-#include <stdio.h>
+#include <utils/time.hpp>
#include <uuid.h>
-#include <cstdlib>
-
-#include <louloulibs.h>
-#ifdef SYSTEMD_FOUND
-# include <systemd/sd-daemon.h>
-#endif
-
using namespace std::string_literals;
static std::set<std::string> kickable_errors{
@@ -443,12 +431,9 @@ void XmppComponent::send_history_message(const std::string& muc_name, const std:
message.add_child(std::move(body));
XmlNode delay("delay");
- delay["xmlns"] = "urn:xmpp:delay";
+ delay["xmlns"] = DELAY_NS;
delay["from"] = muc_name + "@" + this->served_hostname;
- constexpr std::size_t stamp_size = 20;
- char date_buf[stamp_size];
- std::strftime(date_buf, stamp_size, "%FT%TZ", std::gmtime(&timestamp));
- delay["stamp"] = date_buf;
+ delay["stamp"] = utils::to_string(timestamp);
message.add_child(std::move(delay));
this->send_stanza(message);