Files
@ 3fc191ceb46b
Branch filter:
Location: libtransport.git/include/transport/user.h - annotation
3fc191ceb46b
4.5 KiB
text/plain
Comment out database stuff
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 137 138 139 140 141 142 | c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa 02b2f22f3e96 2ae880ff94b5 941bba0427fe 8faecb5664c8 c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa 88865c1234e3 76c678dd6f1d 50bcfbf84cb1 2ae880ff94b5 c5edfd19b1aa 2ae880ff94b5 02b2f22f3e96 c5edfd19b1aa 2ae880ff94b5 2ae880ff94b5 2ae880ff94b5 2ae880ff94b5 2ae880ff94b5 50bcfbf84cb1 2ae880ff94b5 2ae880ff94b5 c5edfd19b1aa c5edfd19b1aa 2ae880ff94b5 2ae880ff94b5 c5edfd19b1aa c5edfd19b1aa e2a992466e74 e2a992466e74 e2a992466e74 e2a992466e74 e2a992466e74 02b2f22f3e96 02b2f22f3e96 2ae880ff94b5 2ae880ff94b5 2ae880ff94b5 2ae880ff94b5 88865c1234e3 88865c1234e3 76c678dd6f1d 76c678dd6f1d 132dfb379d42 132dfb379d42 5f017bd15dc7 5f017bd15dc7 5f017bd15dc7 2ae880ff94b5 2ae880ff94b5 2ae880ff94b5 2ae880ff94b5 5797b554ea69 5797b554ea69 e23f8e3c7f9d e23f8e3c7f9d c68479f86d5e c68479f86d5e c68479f86d5e c68479f86d5e c68479f86d5e c68479f86d5e c68479f86d5e c68479f86d5e 2ae880ff94b5 2ae880ff94b5 c5edfd19b1aa c5edfd19b1aa 8faecb5664c8 50bcfbf84cb1 808a9067c5f5 808a9067c5f5 808a9067c5f5 808a9067c5f5 36f4fb8870c9 36f4fb8870c9 36f4fb8870c9 808a9067c5f5 c68479f86d5e c68479f86d5e 808a9067c5f5 808a9067c5f5 808a9067c5f5 808a9067c5f5 5f017bd15dc7 bdc94b104270 196afcf3a36a 1ebe5535c4f3 50bcfbf84cb1 5f017bd15dc7 c5edfd19b1aa 5f017bd15dc7 5f017bd15dc7 c5edfd19b1aa 88865c1234e3 88865c1234e3 50bcfbf84cb1 76c678dd6f1d c5edfd19b1aa c5edfd19b1aa 2ae880ff94b5 5f017bd15dc7 5f017bd15dc7 5f017bd15dc7 c68479f86d5e 5f017bd15dc7 98687145b02a c68479f86d5e e23f8e3c7f9d 941bba0427fe 2b836edd7985 c5edfd19b1aa c5edfd19b1aa c5edfd19b1aa | /**
* 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 <time.h>
#include "Swiften/Swiften.h"
#include "Swiften/Presence/PresenceOracle.h"
#include "Swiften/Disco/EntityCapsManager.h"
#include "Swiften/Disco/EntityCapsProvider.h"
#include "storagebackend.h"
#include <Swiften/FileTransfer/OutgoingFileTransfer.h>
#include "Swiften/Elements/SpectrumErrorPayload.h"
namespace Transport {
class Component;
class RosterManager;
class ConversationManager;
class UserManager;
struct UserInfo;
/// Represents online XMPP user.
class User : public Swift::EntityCapsProvider {
public:
/// Creates new User class.
/// \param jid XMPP JID associated with this user
/// \param userInfo UserInfo struct with informations needed to connect
/// this user to legacy network
/// \param component Component associated with this user
User(const Swift::JID &jid, UserInfo &userInfo, Component * component, UserManager *userManager);
/// Destroyes User.
virtual ~User();
/// Returns JID of XMPP user who is currently connected using this User class.
/// \return full JID
const Swift::JID &getJID();
/// Returns full JID which supports particular feature or invalid JID.
/// \param feature disco#info feature.
/// \return full JID which supports particular feature or invalid JID.
Swift::JID getJIDWithFeature(const std::string &feature);
Swift::DiscoInfo::ref getCaps(const Swift::JID &jid) const;
/// Returns UserInfo struct with informations needed to connect the legacy network.
/// \return UserInfo struct
UserInfo &getUserInfo() { return m_userInfo; }
RosterManager *getRosterManager() { return m_rosterManager; }
ConversationManager *getConversationManager() { return m_conversationManager; }
Component *getComponent() { return m_component; }
void setData(void *data) { m_data = data; }
void *getData() { return m_data; }
/// Handles presence from XMPP JID associated with this user.
/// \param presence Swift::Presence.
void handlePresence(Swift::Presence::ref presence);
void handleSubscription(Swift::Presence::ref presence);
void handleDiscoInfo(const Swift::JID& jid, boost::shared_ptr<Swift::DiscoInfo> info);
time_t &getLastActivity() {
return m_lastActivity;
}
void updateLastActivity() {
m_lastActivity = time(NULL);
}
/// Returns language.
/// \return language
const char *getLang() { return "en"; }
void handleDisconnected(const std::string &error, Swift::SpectrumErrorPayload::Error e = Swift::SpectrumErrorPayload::CONNECTION_ERROR_OTHER_ERROR);
bool isReadyToConnect() {
return m_readyForConnect;
}
void setConnected(bool connected);
void sendCurrentPresence();
void setIgnoreDisconnect(bool ignoreDisconnect);
bool isConnected() {
return m_connected;
}
boost::signal<void ()> onReadyToConnect;
boost::signal<void (Swift::Presence::ref presence)> onPresenceChanged;
boost::signal<void (const Swift::JID &who, const std::string &room, const std::string &nickname, const std::string &password)> onRoomJoined;
boost::signal<void (const std::string &room)> onRoomLeft;
boost::signal<void ()> onDisconnected;
private:
void onConnectingTimeout();
Swift::JID m_jid;
Component *m_component;
RosterManager *m_rosterManager;
UserManager *m_userManager;
ConversationManager *m_conversationManager;
Swift::EntityCapsManager *m_entityCapsManager;
Swift::PresenceOracle *m_presenceOracle;
UserInfo m_userInfo;
void *m_data;
bool m_connected;
bool m_readyForConnect;
bool m_ignoreDisconnect;
Swift::Timer::ref m_reconnectTimer;
boost::shared_ptr<Swift::Connection> connection;
time_t m_lastActivity;
std::map<Swift::JID, Swift::DiscoInfo::ref> m_legacyCaps;
std::vector<boost::shared_ptr<Swift::OutgoingFileTransfer> > m_filetransfers;
int m_resources;
};
}
|