summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp/roster.hpp
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2016-12-21 21:25:09 +0100
committerJonas Smedegaard <dr@jones.dk>2016-12-21 21:25:09 +0100
commitf820d86aadb7a5473bcc0a0a3669732ab0182555 (patch)
treea6a673c444ea3df75fe0a5d53e905030c2f617ce /louloulibs/xmpp/roster.hpp
parenteda4b75b1cff83336e87da90efca9fd6b4ced2c7 (diff)
parent9634cdaba2e5d2343fcbc1f07264d55609640273 (diff)
downloadbiboumi-9ecc1a5683ed74151dbfb6f3aa2b1a2787148d8a.tar.gz
biboumi-9ecc1a5683ed74151dbfb6f3aa2b1a2787148d8a.tar.bz2
biboumi-9ecc1a5683ed74151dbfb6f3aa2b1a2787148d8a.tar.xz
biboumi-9ecc1a5683ed74151dbfb6f3aa2b1a2787148d8a.zip
New upstream version 4.0upstream/4.0
Diffstat (limited to 'louloulibs/xmpp/roster.hpp')
-rw-r--r--louloulibs/xmpp/roster.hpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/louloulibs/xmpp/roster.hpp b/louloulibs/xmpp/roster.hpp
deleted file mode 100644
index aa1b449..0000000
--- a/louloulibs/xmpp/roster.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#pragma once
-
-
-#include <algorithm>
-#include <string>
-#include <vector>
-
-class RosterItem
-{
-public:
- RosterItem(const std::string& jid, const std::string& name,
- std::vector<std::string>& groups);
- RosterItem(const std::string& jid, const std::string& name);
- RosterItem() = default;
- ~RosterItem() = default;
- RosterItem(const RosterItem&) = default;
- RosterItem(RosterItem&&) = default;
- RosterItem& operator=(const RosterItem&) = default;
- RosterItem& operator=(RosterItem&&) = default;
-
- std::string jid;
- std::string name;
- std::vector<std::string> groups;
-
-private:
-};
-
-/**
- * Keep track of the last known stat of a JID's roster
- */
-class Roster
-{
-public:
- Roster() = default;
- ~Roster() = default;
-
- void clear();
-
- template <typename... ArgsType>
- RosterItem* add_item(ArgsType&&... args)
- {
- this->items.emplace_back(std::forward<ArgsType>(args)...);
- auto it = this->items.end() - 1;
- return &*it;
- }
- RosterItem* get_item(const std::string& jid)
- {
- auto it = std::find_if(this->items.begin(), this->items.end(),
- [this, &jid](const auto& item)
- {
- return item.jid == jid;
- });
- if (it != this->items.end())
- return &*it;
- return nullptr;
- }
- const std::vector<RosterItem>& get_items() const
- {
- return this->items;
- }
-
-private:
- std::vector<RosterItem> items;
-
- Roster(const Roster&) = delete;
- Roster(Roster&&) = delete;
- Roster& operator=(const Roster&) = delete;
- Roster& operator=(Roster&&) = delete;
-};
-
-