diff --git a/spectrum/src/frontends/slack/SlackIdManager.h b/spectrum/src/frontends/slack/SlackIdManager.h new file mode 100644 index 0000000000000000000000000000000000000000..edcbfd590601734b2c8b3178612c90dd877bfc39 --- /dev/null +++ b/spectrum/src/frontends/slack/SlackIdManager.h @@ -0,0 +1,101 @@ +/** + * Spectrum 2 Slack Frontend + * + * Copyright (C) 2015, Jan Kaluza + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#pragma once + +#include "SlackAPI.h" + +#include "transport/StorageBackend.h" +#include "rapidjson/document.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Swiften/Network/Timer.h" +#include "Swiften/Version.h" + +#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000) + +#if HAVE_SWIFTEN_3 +#include +#endif + +#include +#include +#include + +#include + +namespace Transport { + +class SlackIdManager { + public: + SlackIdManager(); + + virtual ~SlackIdManager(); + + std::map &getUsers() { + return m_users; + } + + std::map &getChannels() { + return m_channels; + } + + std::map &getIMs() { + return m_ims; + } + + const std::string &getName(const std::string &id); + const std::string &getId(const std::string &name); + + bool hasMember(const std::string &channelId, const std::string &userId); + + const std::string &getSelfName() { + return m_selfName; + } + + const std::string &getSelfId() { + return m_selfId; + } + + void setSelfName(const std::string &name) { + m_selfName = name; + } + + void setSelfId(const std::string &id) { + m_selfId = id; + } + + private: + std::map m_channels; + std::map m_ims; + std::map m_users; + std::string m_selfName; + std::string m_selfId; +}; + +}