spectrum2/include/transport/LocalBuddy.h

74 lines
2.2 KiB
C
Raw Permalink Normal View History

2011-05-11 09:20:35 +02:00
/**
* 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
*/
#ifndef SPECTRUM_BUDDY_H
#define SPECTRUM_BUDDY_H
#include <string>
#include <algorithm>
#include "transport/Buddy.h"
2011-05-11 09:20:35 +02:00
namespace Transport {
class LocalBuddy : public Buddy {
public:
2012-08-09 11:21:01 +02:00
LocalBuddy(RosterManager *rosterManager, long id, const std::string &name, const std::string &alias = "", const std::vector<std::string> &groups = std::vector<std::string>(), BuddyFlag flags = BUDDY_NO_FLAG);
2011-05-11 09:20:35 +02:00
virtual ~LocalBuddy();
std::string getAlias() { return m_alias; }
2011-06-19 21:40:03 +02:00
void setAlias(const std::string &alias);
2011-05-11 09:20:35 +02:00
std::string getName() { return m_name; }
bool setName(const std::string &name);
2011-05-11 09:20:35 +02:00
bool getStatus(Swift::StatusShow &status, std::string &statusMessage);
bool isAvailable() {
return m_status.getType() != Swift::StatusShow::None;
2011-05-11 09:20:35 +02:00
}
void setStatus(const Swift::StatusShow &status, const std::string &statusMessage);
2011-05-11 09:20:35 +02:00
std::string getIconHash() { return m_iconHash; }
void setIconHash(const std::string &iconHash);
2011-05-11 09:20:35 +02:00
std::vector<std::string> getGroups() { return m_groups; }
2012-04-10 18:49:40 +02:00
void setGroups(const std::vector<std::string> &groups);
2011-05-11 09:20:35 +02:00
2012-08-09 11:21:01 +02:00
bool isValid() {
2012-08-09 14:57:57 +02:00
std::string safeName = getSafeName();
return m_jid.isValid() && safeName.find("/") == std::string::npos;
2012-08-09 11:21:01 +02:00
}
2011-05-11 09:20:35 +02:00
private:
std::string m_name;
std::string m_alias;
std::vector<std::string> m_groups;
std::string m_statusMessage;
std::string m_iconHash;
Swift::StatusShow m_status;
friend class NetworkPluginServer;
2011-05-11 09:20:35 +02:00
};
}
#endif