summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-04 08:47:47 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-04 08:47:47 (GMT)
commit219b1e5e4684323e0dbd0f1ad7de7beaf4d75f50 (patch)
treeb5d357f492864ba3fa88015ff25909d0ffb87561 /Swiften/Presence
parentc60720c32c4b6e8745ae4ec8eead825a06a93555 (diff)
downloadswift-219b1e5e4684323e0dbd0f1ad7de7beaf4d75f50.zip
swift-219b1e5e4684323e0dbd0f1ad7de7beaf4d75f50.tar.bz2
Join MUCs with the last broadcast presence.
Resolves: #590 Release-Notes: Joining rooms when you are not plain 'available' now correctly sends your status to the room.
Diffstat (limited to 'Swiften/Presence')
-rw-r--r--Swiften/Presence/PresenceSender.cpp8
-rw-r--r--Swiften/Presence/PresenceSender.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/Swiften/Presence/PresenceSender.cpp b/Swiften/Presence/PresenceSender.cpp
index 082c841..6df02b8 100644
--- a/Swiften/Presence/PresenceSender.cpp
+++ b/Swiften/Presence/PresenceSender.cpp
@@ -31,6 +31,14 @@ void PresenceSender::sendPresence(boost::shared_ptr<Presence> presence) {
}
}
+/**
+ * Gets either the last broadcast presence, or an empty stanza if none has been sent.
+ */
+boost::shared_ptr<Presence> PresenceSender::getLastSentUndirectedPresence() {
+ boost::shared_ptr<Presence> presenceCopy(lastSentUndirectedPresence ? new Presence(*lastSentUndirectedPresence) : new Presence());
+ return presenceCopy;
+}
+
void PresenceSender::addDirectedPresenceReceiver(const JID& jid) {
directedPresenceReceivers.insert(jid);
if (channel->isAvailable()) {
diff --git a/Swiften/Presence/PresenceSender.h b/Swiften/Presence/PresenceSender.h
index 87be753..3336523 100644
--- a/Swiften/Presence/PresenceSender.h
+++ b/Swiften/Presence/PresenceSender.h
@@ -26,6 +26,8 @@ namespace Swift {
void confirmSubscription(const JID& jid);
void requestSubscription(const JID& jid);
+ boost::shared_ptr<Presence> getLastSentUndirectedPresence();
+
private:
boost::shared_ptr<Presence> lastSentUndirectedPresence;
StanzaChannel* channel;