diff options
Diffstat (limited to 'Swift/Controllers/Chat/Chattables.cpp')
-rw-r--r-- | Swift/Controllers/Chat/Chattables.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/Chattables.cpp b/Swift/Controllers/Chat/Chattables.cpp new file mode 100644 index 0000000..b75e18d --- /dev/null +++ b/Swift/Controllers/Chat/Chattables.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#include <Swift/Controllers/Chat/Chattables.h> + +namespace Swift { + +const std::vector<JID>& Chattables::get() const { + return list_; +} + +const Chattables::State& Chattables::getState(const JID& jid) const { + auto it = states_.find(jid); + return it != states_.end() ? it->second : unknown_; +} + +void Chattables::addJID(const JID& jid, State::Type type) { + State state; + state.type = type; + state.jid = jid; + list_.push_back(jid); + states_[jid] = state; + onAdded(jid); +} + +void Chattables::setState(const JID& jid, State state) { + states_[jid] = state; + onChanged(jid); +} + +} |