Files
@ 0729d364ca25
Branch filter:
Location: libtransport.git/include/transport/Frontend.h
0729d364ca25
4.0 KiB
text/plain
Fix double free in DummyConnectionServer
Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
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 | /**
* XMPP - libpurple transport
*
* Copyright (C) 2009, Jan Kaluza <hanzz@soc.pidgin.im>
*
* 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 <string>
#include <algorithm>
#include <Swiften/EventLoop/EventLoop.h>
#include <Swiften/Network/NetworkFactories.h>
#include "Swiften/Elements/RosterPayload.h"
#include "Swiften/Elements/VCard.h"
#include "Swiften/Elements/Message.h"
#include "Swiften/Elements/IQ.h"
#include "Swiften/Elements/DiscoInfo.h"
#include "Swiften/Elements/Presence.h"
#include "Swiften/SwiftenCompat.h"
#include <boost/signal.hpp>
namespace Transport {
class Config;
class UserRegistry;
class Component;
class User;
class Buddy;
class RosterManager;
class UserManager;
class StorageBackend;
class Frontend;
struct UserInfo;
class FrontendPlugin {
public:
virtual std::string name() const = 0;
virtual Frontend *createFrontend() = 0;
virtual ~FrontendPlugin() {};
};
class Frontend {
public:
Frontend() {}
virtual ~Frontend() {}
virtual void init(Component *component, Swift::EventLoop *loop, Swift::NetworkFactories *factories, Config *config, UserRegistry *userRegistry) = 0;
virtual void connectToServer() = 0;
virtual void disconnectFromServer() = 0;
virtual void sendPresence(Swift::Presence::ref presence) = 0;
virtual void sendVCard(Swift::VCard::ref vcard, Swift::JID to) = 0;
virtual void sendRosterRequest(Swift::RosterPayload::ref, Swift::JID to) = 0;
virtual void sendMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> message) = 0;
virtual void sendIQ(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::IQ>) = 0;
virtual SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DiscoInfo> sendCapabilitiesRequest(Swift::JID to) = 0;
virtual void reconnectUser(const std::string &user) = 0;
virtual RosterManager *createRosterManager(User *user, Component *component) = 0;
virtual User *createUser(const Swift::JID &jid, UserInfo &userInfo, Component *component, UserManager *userManager) = 0;
virtual UserManager *createUserManager(Component *component, UserRegistry *userRegistry, StorageBackend *storageBackend = NULL) = 0;
virtual void clearRoomList() = 0;
virtual void addRoomToRoomList(const std::string &handle, const std::string &name) = 0;
virtual std::string setOAuth2Code(const std::string &code, const std::string &state) { return "OAuth2 code is not needed for this frontend."; }
virtual std::string getOAuth2URL(const std::vector<std::string> &args) { return ""; }
virtual std::string getRegistrationFields() { return "Jabber ID\n3rd-party network username\n3rd-party network password"; }
virtual bool isRawXMLEnabled() { return false; }
boost::signal<void (User *, const std::string &name, unsigned int id)> onVCardRequired;
boost::signal<void (User *, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::VCard> vcard)> onVCardUpdated;
boost::signal<void (Buddy *, const Swift::RosterItemPayload &item)> onBuddyUpdated;
boost::signal<void (Buddy *)> onBuddyRemoved;
boost::signal<void (Buddy *, const Swift::RosterItemPayload &item)> onBuddyAdded;
boost::signal<void (Swift::Message::ref message)> onMessageReceived;
boost::signal<void (bool /* isAvailable */)> onAvailableChanged;
boost::signal<void (SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Presence>) > onPresenceReceived;
boost::signal<void (const Swift::JID& jid, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DiscoInfo> info)> onCapabilitiesReceived;
};
}
|