Files
@ 512571a406bb
Branch filter:
Location: libtransport.git/spectrum/src/frontends/xmpp/XMPPFrontend.h
512571a406bb
4.6 KiB
text/plain
Fix slack test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | /**
* libtransport -- C++ library for easy XMPP Transports development
*
* Copyright (C) 2011, Jan Kaluza <hanzz.k@gmail.com>
*
* 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 "transport/Frontend.h"
#include <vector>
#include <Swiften/Version.h>
#define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000)
#include "Swiften/Server/Server.h"
#include "Swiften/Disco/GetDiscoInfoRequest.h"
#include "Swiften/Disco/EntityCapsManager.h"
#include "Swiften/Disco/CapsManager.h"
#include "Swiften/Disco/CapsMemoryStorage.h"
#include "Swiften/Network/BoostTimerFactory.h"
#include "Swiften/Network/BoostIOServiceThread.h"
#include "Swiften/Server/UserRegistry.h"
#include "Swiften/Base/SafeByteArray.h"
#include "Swiften/Queries/IQHandler.h"
#include "Swiften/Component/ComponentError.h"
#include "Swiften/Component/Component.h"
#include "Swiften/Queries/IQHandler.h"
#include "Swiften/Elements/Presence.h"
#include <boost/bind.hpp>
#include <Swiften/Network/BoostConnectionServer.h>
namespace Transport {
class UserRegistry;
class Frontend;
class Config;
class DiscoItemsResponder;
class VCardResponder;
class XMPPFrontend : public Frontend, Swift::IQHandler {
public:
XMPPFrontend();
virtual ~XMPPFrontend();
virtual void init(Component *component, Swift::EventLoop *loop, Swift::NetworkFactories *factories, Config *config, UserRegistry *userRegistry);
virtual void connectToServer();
virtual void disconnectFromServer();
virtual void sendPresence(Swift::Presence::ref presence);
virtual void sendVCard(Swift::VCard::ref vcard, Swift::JID to);
virtual void sendRosterRequest(Swift::RosterPayload::ref, Swift::JID to);
virtual void sendMessage(boost::shared_ptr<Swift::Message> message);
virtual void sendIQ(boost::shared_ptr<Swift::IQ>);
virtual void reconnectUser(const std::string &user);
virtual RosterManager *createRosterManager(User *user, Component *component);
virtual User *createUser(const Swift::JID &jid, UserInfo &userInfo, Component *component, UserManager *userManager);
virtual UserManager *createUserManager(Component *component, UserRegistry *userRegistry, StorageBackend *storageBackend = NULL);
virtual boost::shared_ptr<Swift::DiscoInfo> sendCapabilitiesRequest(Swift::JID to);
virtual void clearRoomList();
virtual void addRoomToRoomList(const std::string &handle, const std::string &name);
void handleMessage(boost::shared_ptr<Swift::Message> message);
Swift::StanzaChannel *getStanzaChannel();
Swift::IQRouter *getIQRouter() { return m_iqRouter; }
bool inServerMode() { return m_server != NULL; }
bool isRawXMLEnabled() {
return m_rawXML;
}
DiscoItemsResponder *getDiscoItemsResponder() {
return m_discoItemsResponder;
}
private:
void handleConnected();
void handleConnectionError(const Swift::ComponentError &error);
void handleServerStopped(boost::optional<Swift::BoostConnectionServer::Error> e);
void handleGeneralPresence(Swift::Presence::ref presence);
void handleDataRead(const Swift::SafeByteArray &data);
void handleDataWritten(const Swift::SafeByteArray &data);
void handleDiscoInfoResponse(boost::shared_ptr<Swift::DiscoInfo> info, Swift::ErrorPayload::ref error, const Swift::JID& jid);
void handleCapsChanged(const Swift::JID& jid);
void handleBackendConfigChanged();
bool handleIQ(boost::shared_ptr<Swift::IQ>);
Swift::NetworkFactories *m_factories;
Swift::Component *m_component;
Swift::Server *m_server;
Swift::EntityCapsManager *m_entityCapsManager;
Swift::CapsManager *m_capsManager;
Swift::CapsMemoryStorage *m_capsMemoryStorage;
Swift::StanzaChannel *m_stanzaChannel;
Swift::IQRouter *m_iqRouter;
DiscoItemsResponder *m_discoItemsResponder;
VCardResponder *m_vcardResponder;
Config* m_config;
Swift::JID m_jid;
bool m_rawXML;
Component *m_transport;
friend class XMPPUser;
friend class UserRegistration;
friend class NetworkPluginServer;
};
}
|