2008-03-03 22:52:07 +00:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// Blabber [UserID.h]
|
|
|
|
// Encapsulates user data for any account,
|
|
|
|
// Jabber or otherwise.
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef USER_ID_H
|
|
|
|
#define USER_ID_H
|
|
|
|
|
2019-06-04 19:31:00 +00:00
|
|
|
#include <gloox/gloox.h>
|
2019-07-13 13:44:27 +00:00
|
|
|
#include <gloox/jid.h>
|
2019-06-04 19:31:00 +00:00
|
|
|
|
2008-04-07 19:32:07 +00:00
|
|
|
#include <string>
|
2008-03-03 22:52:07 +00:00
|
|
|
|
|
|
|
class UserID {
|
|
|
|
public:
|
|
|
|
enum online_status {UNKNOWN, UNACCEPTED, OFFLINE, ONLINE, TRANSPORT_ONLINE};
|
2021-10-18 17:57:40 +00:00
|
|
|
enum user_type {INVALID, JABBER, TRANSPORT};
|
2008-04-07 19:32:07 +00:00
|
|
|
|
2008-03-03 22:52:07 +00:00
|
|
|
public:
|
|
|
|
virtual ~UserID();
|
2008-04-07 19:32:07 +00:00
|
|
|
|
2019-06-04 17:35:35 +00:00
|
|
|
user_type UserType() const;
|
2008-04-07 19:32:07 +00:00
|
|
|
const std::string Handle() const;
|
|
|
|
const std::string FriendlyName() const;
|
2019-09-28 20:54:27 +00:00
|
|
|
const gloox::JID& JID() const { return _handle; }
|
2008-03-03 22:52:07 +00:00
|
|
|
|
2019-06-04 17:35:35 +00:00
|
|
|
online_status OnlineStatus() const;
|
2008-04-07 19:32:07 +00:00
|
|
|
const std::string ExactOnlineStatus() const;
|
|
|
|
const std::string MoreExactOnlineStatus() const;
|
2019-06-04 19:31:00 +00:00
|
|
|
gloox::SubscriptionType SubscriptionStatus() const;
|
2008-03-03 22:52:07 +00:00
|
|
|
|
|
|
|
bool HaveSubscriptionTo() const;
|
|
|
|
bool IsUser() const;
|
|
|
|
|
|
|
|
// Jabber
|
2008-04-07 19:32:07 +00:00
|
|
|
const std::string JabberHandle() const; // xxx@yyy
|
|
|
|
const std::string JabberCompleteHandle() const; // xxx@yyy/zzz
|
|
|
|
const std::string JabberUsername() const; // xxx
|
|
|
|
const std::string JabberServer() const; // yyy
|
|
|
|
const std::string JabberResource() const; // zzz
|
2008-03-03 22:52:07 +00:00
|
|
|
|
2008-04-07 19:32:07 +00:00
|
|
|
const std::string TransportID() const;
|
|
|
|
const std::string TransportUsername() const;
|
|
|
|
const std::string TransportPassword() const;
|
2008-03-03 22:52:07 +00:00
|
|
|
|
2019-09-30 14:44:01 +00:00
|
|
|
static std::string WhyNotValidJabberHandle(std::string jidCandidate);
|
2008-04-07 19:32:07 +00:00
|
|
|
|
2008-03-03 22:52:07 +00:00
|
|
|
// MANIPULATORS
|
2008-04-07 19:32:07 +00:00
|
|
|
void SetFriendlyName(std::string friendly_name);
|
2008-03-03 22:52:07 +00:00
|
|
|
|
2008-04-07 19:32:07 +00:00
|
|
|
void SetOnlineStatus(online_status status);
|
|
|
|
void SetExactOnlineStatus(std::string exact_status);
|
|
|
|
void SetMoreExactOnlineStatus(std::string exact_status);
|
2019-06-04 19:31:00 +00:00
|
|
|
void SetSubscriptionStatus(gloox::SubscriptionType status);
|
2008-03-03 22:52:07 +00:00
|
|
|
|
|
|
|
private:
|
2019-09-30 14:44:01 +00:00
|
|
|
UserID(gloox::JID username);
|
|
|
|
UserID(const UserID &copied_userid);
|
|
|
|
UserID &operator=(const UserID &rhs);
|
|
|
|
friend class JRoster; // Ony JRoster is allowed to create/copy UserIDs
|
|
|
|
|
2019-09-30 10:21:20 +00:00
|
|
|
void SetHandle(gloox::JID handle);
|
2008-03-03 22:52:07 +00:00
|
|
|
|
|
|
|
// identification
|
2019-09-30 10:21:20 +00:00
|
|
|
gloox::JID _handle; // RosterItem
|
2008-04-07 19:32:07 +00:00
|
|
|
|
2019-09-30 10:21:20 +00:00
|
|
|
// Things tracked by JRoster (handlePresence, etc)
|
2008-04-07 19:32:07 +00:00
|
|
|
online_status _status;
|
|
|
|
std::string _exact_status;
|
|
|
|
std::string _more_exact_status;
|
2019-06-04 19:31:00 +00:00
|
|
|
gloox::SubscriptionType _subscription_status;
|
2008-04-07 19:32:07 +00:00
|
|
|
|
2008-03-03 22:52:07 +00:00
|
|
|
// split into pieces
|
2008-04-07 19:32:07 +00:00
|
|
|
user_type _user_type;
|
2008-03-03 22:52:07 +00:00
|
|
|
|
2008-04-07 19:32:07 +00:00
|
|
|
std::string _transport_id;
|
|
|
|
std::string _transport_username;
|
|
|
|
std::string _transport_password;
|
2008-03-03 22:52:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|