summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Avatars/AvatarManager.h2
-rw-r--r--Swiften/Roster/ContactRosterItem.cpp8
-rw-r--r--Swiften/Roster/ContactRosterItem.h2
-rw-r--r--Swiften/Roster/SetAvatar.h33
-rw-r--r--Swiften/Roster/SetPresence.h2
-rw-r--r--Swiften/Roster/TreeWidgetItem.h2
6 files changed, 48 insertions, 1 deletions
diff --git a/Swiften/Avatars/AvatarManager.h b/Swiften/Avatars/AvatarManager.h
index 984ce19..3ac4433 100644
--- a/Swiften/Avatars/AvatarManager.h
+++ b/Swiften/Avatars/AvatarManager.h
@@ -32,7 +32,7 @@ namespace Swift {
void handlePresenceReceived(boost::shared_ptr<Presence>);
void handleVCardReceived(const JID& from, const String& hash, boost::shared_ptr<VCard>, const boost::optional<Error>&);
void setAvatarHash(const JID& from, const String& hash);
- JID getAvatarJID(const JID& o) const;
+ JID getAvatarJID(const JID& o) const;
private:
StanzaChannel* stanzaChannel_;
diff --git a/Swiften/Roster/ContactRosterItem.cpp b/Swiften/Roster/ContactRosterItem.cpp
index f38b0f7..2f2f787 100644
--- a/Swiften/Roster/ContactRosterItem.cpp
+++ b/Swiften/Roster/ContactRosterItem.cpp
@@ -34,6 +34,14 @@ void ContactRosterItem::setStatusShow(StatusShow::Type show) {
widget_->setTextColor(colour);
}
+void ContactRosterItem::setStatusText(const String& status) {
+ widget_->setStatusText(status);
+}
+
+void ContactRosterItem::setAvatarPath(const String& path) {
+ widget_->setAvatarPath(path);
+}
+
const JID& ContactRosterItem::getJID() const {
return jid_;
}
diff --git a/Swiften/Roster/ContactRosterItem.h b/Swiften/Roster/ContactRosterItem.h
index 20f9f65..f1810aa 100644
--- a/Swiften/Roster/ContactRosterItem.h
+++ b/Swiften/Roster/ContactRosterItem.h
@@ -23,6 +23,8 @@ class ContactRosterItem : public RosterItem {
StatusShow::Type getStatusShow();
void setStatusShow(StatusShow::Type show);
+ void setStatusText(const String& status);
+ void setAvatarPath(const String& path);
const JID& getJID() const;
void show();
void hide();
diff --git a/Swiften/Roster/SetAvatar.h b/Swiften/Roster/SetAvatar.h
new file mode 100644
index 0000000..7bc9c37
--- /dev/null
+++ b/Swiften/Roster/SetAvatar.h
@@ -0,0 +1,33 @@
+#ifndef SWIFTEN_SetAvatar_H
+#define SWIFTEN_SetAvatar_H
+
+#include "Swiften/Elements/Presence.h"
+#include "Swiften/JID/JID.h"
+#include "Swiften/Roster/RosterItemOperation.h"
+#include "Swiften/Roster/ContactRosterItem.h"
+
+namespace Swift {
+
+class RosterItem;
+
+class SetAvatar : public RosterItemOperation {
+ public:
+ SetAvatar(const JID& jid, const String& path, JID::CompareType compareType = JID::WithoutResource) : jid_(jid), path_(path), compareType_(compareType) {
+ }
+
+ virtual void operator() (RosterItem* item) const {
+ ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item);
+ if (contact && contact->getJID().equals(jid_, compareType_)) {
+ contact->setAvatarPath(path_);
+ }
+ }
+
+ private:
+ JID jid_;
+ String path_;
+ JID::CompareType compareType_;
+};
+
+}
+#endif
+
diff --git a/Swiften/Roster/SetPresence.h b/Swiften/Roster/SetPresence.h
index aa36a52..a18ae6d 100644
--- a/Swiften/Roster/SetPresence.h
+++ b/Swiften/Roster/SetPresence.h
@@ -20,8 +20,10 @@ class SetPresence : public RosterItemOperation {
if (contact && contact->getJID().equals(presence_->getFrom(), compareType_)) {
if (presence_->getType() != Presence::Available) {
contact->setStatusShow(StatusShow::None);
+ contact->setStatusText(presence_->getStatus());
} else {
contact->setStatusShow(presence_->getShow());
+ contact->setStatusText(presence_->getStatus());
}
}
}
diff --git a/Swiften/Roster/TreeWidgetItem.h b/Swiften/Roster/TreeWidgetItem.h
index 5a96a41..4e20050 100644
--- a/Swiften/Roster/TreeWidgetItem.h
+++ b/Swiften/Roster/TreeWidgetItem.h
@@ -13,6 +13,8 @@ class TreeWidgetItem {
public:
virtual ~TreeWidgetItem() {}
virtual void setText(const String& text) = 0;
+ virtual void setStatusText(const String& text) = 0;
+ virtual void setAvatarPath(const String& path) = 0;
virtual void setExpanded(bool b) = 0;
virtual void setTextColor(unsigned long color) = 0;
virtual void setBackgroundColor(unsigned long color) = 0;