Mercurial > bellaciao
comparison 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 |
comparison
equal
deleted
inserted
replaced
5:0412dc960e3a | 6:48045176d1c6 |
---|---|
17 */ | 17 */ |
18 | 18 |
19 #include "contact.h" | 19 #include "contact.h" |
20 | 20 |
21 ContactT::ContactT() | 21 ContactT::ContactT() |
22 :m_connected(false), m_presence_to(false), m_presence_from(false), m_presence_ask(false) | |
22 { | 23 { |
23 connected = false; | |
24 } | 24 } |
25 | 25 |
26 ContactT::~ContactT() | 26 ContactT::~ContactT() |
27 { | 27 { |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 bool ContactT::isConnected() { | 31 void ContactT::setProfile(const QString& profile) { |
32 return connected; | 32 m_profile = profile; |
33 } | 33 } |
34 | 34 |
35 const QString& ContactT::getProfile() const { | |
36 return m_profile; | |
37 } | |
35 | 38 |
39 void ContactT::setAttributes(const QHash<QString, QString>& attr) { | |
40 m_name = attr.value("name"); | |
41 m_presence_to = attr.value("to") == "True"; | |
42 m_presence_from = attr.value("from") == "True"; | |
43 m_presence_ask = attr.value("ask") == "True"; | |
44 } | |
45 | |
46 QHash<QString, QString> ContactT::getAttributes() const { | |
47 QHash<QString, QString> attr; | |
48 if (jid.isValid()) { | |
49 attr["name"] = m_name; | |
50 attr["to"] = m_presence_to ? "True" : "False"; | |
51 attr["from"] = m_presence_from ? "True" : "False"; | |
52 attr["ask"] = m_presence_ask ? "True" : "False"; | |
53 } | |
54 | |
55 return attr; | |
56 } | |
57 | |
58 const QString& ContactT::getName() const { | |
59 return m_name; | |
60 } | |
61 | |
62 bool ContactT::isConnected() { | |
63 return m_connected; | |
64 } | |
65 |