This commit is contained in:
HanzZ 2011-02-14 12:43:02 +01:00
parent e494f49684
commit 271a7134db
5 changed files with 36 additions and 12 deletions

View file

@ -26,8 +26,6 @@ int main(void)
std::cout << "Can't connect to database.\n";
}
transport.setStorageBackend(&sql);
UserManager userManager(&transport);
UserRegistration userRegistration(&transport, &userManager, &sql);

View file

@ -38,6 +38,7 @@ namespace Transport {
typedef boost::program_options::variables_map Variables;
/// Class used to load.
class Config {
public:
Config() {}

View file

@ -33,13 +33,23 @@ class Component;
class StorageBackend;
class UserRegistration;
/// Basic logging class which logs various data into std::out (standard output).
class Logger
{
public:
/// Creates new Logger class instance.
/// \param component component instance
Logger(Component *component);
/// Logger destructor.
~Logger();
/// Starts logging data related to StorageBackend class.
/// \param storage storage class
void setStorageBackend(StorageBackend *storage);
/// Starts logging data related to UserRegistration class.
/// \param userRegistration userRegistration class
void setUserRegistration(UserRegistration *userRegistration);
private:

View file

@ -42,24 +42,44 @@ namespace Transport {
// CLIENT_FEATURE_CHATSTATES = 16
// } SpectrumImportantFeatures;
//
// class SpectrumDiscoInfoResponder;
// class SpectrumRegisterHandler;
class StorageBackend;
class DiscoInfoResponder;
/// Represents one transport instance.
/// It's used to connect
/// the Jabber server and provides transaction layer between Jabber server
/// and other classes.
class Component {
public:
/// Creates new Component instance.
/// \param loop main event loop
/// \param config cofiguration, this class uses following Config values:
/// - service.jid
/// - service.password
/// - service.server
/// - service.port
Component(Swift::EventLoop *loop, Config *config);
/// Component destructor.
~Component();
// Connect to server
/// Connects the Jabber server.
/// \see Component()
void connect();
void setStorageBackend(StorageBackend *backend);
/// Sets disco#info features which are sent as answer to
/// disco#info IQ-get. This sets features of transport contact (For example "j2j.domain.tld").
/// \param features list of features as sent in disco#info response
void setTransportFeatures(std::list<std::string> &features);
/// Sets disco#info features which are sent as answer to
/// disco#info IQ-get. This sets features of legacy network buddies (For example "me\40gmail.com@j2j.domain.tld").
/// \param features list of features as sent in disco#info response
void setBuddyFeatures(std::list<std::string> &features);
/// Returns Jabber ID of this transport.
/// \return Jabber ID of this transport
Swift::JID &getJID() { return m_jid; }
boost::signal<void (const Swift::ComponentError&)> onConnectionError;

View file

@ -31,7 +31,6 @@ namespace Transport {
Component::Component(Swift::EventLoop *loop, Config *config) {
m_reconnectCount = 0;
m_config = config;
m_storageBackend = NULL;
m_jid = Swift::JID(CONFIG_STRING(m_config, "service.jid"));
@ -75,10 +74,6 @@ Component::~Component() {
delete m_factories;
}
void Component::setStorageBackend(StorageBackend *backend) {
m_storageBackend = backend;
}
void Component::setTransportFeatures(std::list<std::string> &features) {
m_discoInfoResponder->setTransportFeatures(features);
}