Mercurial > bellaciao
diff contact.cpp @ 6:48045176d1c6
ContactT and Ji improvments
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 12 Aug 2011 22:08:37 +0200 |
parents | 220e5619bf87 |
children | 017925589d4c |
line wrap: on
line diff
--- a/contact.cpp Fri Aug 12 22:05:50 2011 +0200 +++ b/contact.cpp Fri Aug 12 22:08:37 2011 +0200 @@ -19,8 +19,8 @@ #include "contact.h" ContactT::ContactT() + :m_connected(false), m_presence_to(false), m_presence_from(false), m_presence_ask(false) { - connected = false; } ContactT::~ContactT() @@ -28,8 +28,38 @@ } -bool ContactT::isConnected() { - return connected; +void ContactT::setProfile(const QString& profile) { + m_profile = profile; +} + +const QString& ContactT::getProfile() const { + return m_profile; +} + +void ContactT::setAttributes(const QHash<QString, QString>& attr) { + m_name = attr.value("name"); + m_presence_to = attr.value("to") == "True"; + m_presence_from = attr.value("from") == "True"; + m_presence_ask = attr.value("ask") == "True"; } +QHash<QString, QString> ContactT::getAttributes() const { + QHash<QString, QString> attr; + if (jid.isValid()) { + attr["name"] = m_name; + attr["to"] = m_presence_to ? "True" : "False"; + attr["from"] = m_presence_from ? "True" : "False"; + attr["ask"] = m_presence_ask ? "True" : "False"; + } + return attr; +} + +const QString& ContactT::getName() const { + return m_name; +} + +bool ContactT::isConnected() { + return m_connected; +} +