summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--louloulibs/network/tcp_socket_handler.hpp2
-rw-r--r--louloulibs/utils/timed_events.cpp11
-rw-r--r--louloulibs/utils/timed_events.hpp18
-rw-r--r--src/bridge/bridge.hpp2
-rw-r--r--src/xmpp/biboumi_component.cpp4
-rw-r--r--src/xmpp/biboumi_component.hpp2
6 files changed, 15 insertions, 24 deletions
diff --git a/louloulibs/network/tcp_socket_handler.hpp b/louloulibs/network/tcp_socket_handler.hpp
index dd4e82e..55f4113 100644
--- a/louloulibs/network/tcp_socket_handler.hpp
+++ b/louloulibs/network/tcp_socket_handler.hpp
@@ -180,7 +180,7 @@ private:
/**
* Where data is added, when we want to send something to the client.
*/
- std::list<std::string> out_buf;
+ std::vector<std::string> out_buf;
/**
* DNS resolver
*/
diff --git a/louloulibs/utils/timed_events.cpp b/louloulibs/utils/timed_events.cpp
index 930380b..6b936c4 100644
--- a/louloulibs/utils/timed_events.cpp
+++ b/louloulibs/utils/timed_events.cpp
@@ -20,15 +20,6 @@ TimedEvent::TimedEvent(std::chrono::milliseconds&& duration,
{
}
-TimedEvent::TimedEvent(TimedEvent&& other):
- time_point(std::move(other.time_point)),
- callback(std::move(other.callback)),
- repeat(other.repeat),
- repeat_delay(std::move(other.repeat_delay)),
- name(std::move(other.name))
-{
-}
-
bool TimedEvent::is_after(const TimedEvent& other) const
{
return this->is_after(other.time_point);
@@ -47,7 +38,7 @@ std::chrono::milliseconds TimedEvent::get_timeout() const
return std::chrono::duration_cast<std::chrono::milliseconds>(this->time_point - now);
}
-void TimedEvent::execute()
+void TimedEvent::execute() const
{
this->callback();
}
diff --git a/louloulibs/utils/timed_events.hpp b/louloulibs/utils/timed_events.hpp
index c3dfc40..70e2eff 100644
--- a/louloulibs/utils/timed_events.hpp
+++ b/louloulibs/utils/timed_events.hpp
@@ -4,7 +4,7 @@
#include <functional>
#include <string>
#include <chrono>
-#include <list>
+#include <vector>
using namespace std::literals::chrono_literals;
@@ -30,12 +30,12 @@ public:
explicit TimedEvent(std::chrono::milliseconds&& duration,
std::function<void()> callback, const std::string& name="");
- explicit TimedEvent(TimedEvent&&);
+ explicit TimedEvent(TimedEvent&&) = default;
+ TimedEvent& operator=(TimedEvent&&) = default;
~TimedEvent() = default;
TimedEvent(const TimedEvent&) = delete;
TimedEvent& operator=(const TimedEvent&) = delete;
- TimedEvent& operator=(TimedEvent&&) = delete;
/**
* Whether or not this event happens after the other one.
@@ -48,7 +48,7 @@ public:
* returned value is 0 instead. The value cannot then be negative.
*/
std::chrono::milliseconds get_timeout() const;
- void execute();
+ void execute() const;
const std::string& get_name() const;
private:
@@ -59,22 +59,22 @@ private:
/**
* The function to execute.
*/
- const std::function<void()> callback;
+ std::function<void()> callback;
/**
* Whether or not this events repeats itself until it is destroyed.
*/
- const bool repeat;
+ bool repeat;
/**
* This value is added to the time_point each time the event is executed,
* if repeat is true. Otherwise it is ignored.
*/
- const std::chrono::milliseconds repeat_delay;
+ std::chrono::milliseconds repeat_delay;
/**
* A name that is used to identify that event. If you want to find your
* event (for example if you want to cancel it), the name should be
* unique.
*/
- const std::string name;
+ std::string name;
};
/**
@@ -128,7 +128,7 @@ public:
std::size_t size() const;
private:
- std::list<TimedEvent> events;
+ std::vector<TimedEvent> events;
explicit TimedEventsManager() = default;
};
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index b852a30..469a959 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -250,7 +250,7 @@ private:
* request and we need a response from IRC to be able to provide the
* response iq.
*/
- std::list<irc_responder_callback_t> waiting_irc;
+ std::vector<irc_responder_callback_t> waiting_irc;
/**
* Keep track of which resource is in which channel.
*/
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index 6dae92c..e5aee9a 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -532,9 +532,9 @@ Bridge* BiboumiComponent::find_user_bridge(const std::string& full_jid)
}
}
-std::list<Bridge*> BiboumiComponent::get_bridges() const
+std::vector<Bridge*> BiboumiComponent::get_bridges() const
{
- std::list<Bridge*> res;
+ std::vector<Bridge*> res;
for (auto it = this->bridges.begin(); it != this->bridges.end(); ++it)
res.push_back(it->second.get());
return res;
diff --git a/src/xmpp/biboumi_component.hpp b/src/xmpp/biboumi_component.hpp
index 25982f2..0eb3bc4 100644
--- a/src/xmpp/biboumi_component.hpp
+++ b/src/xmpp/biboumi_component.hpp
@@ -39,7 +39,7 @@ public:
/**
* Return a list of all the managed bridges.
*/
- std::list<Bridge*> get_bridges() const;
+ std::vector<Bridge*> get_bridges() const;
/**
* Send a "close" message to all our connected peers. That message