summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-11-09 21:06:28 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-11-09 21:23:39 (GMT)
commitb23637e59839f5f28258f518ac234b2ff62b6da2 (patch)
tree260bb79caa0858d271959159a5913de121687a99 /Swiften/MUC
parentf4d1b6494d5c537ba4a086d61ea86b1dd6843e4b (diff)
downloadswift-b23637e59839f5f28258f518ac234b2ff62b6da2.zip
swift-b23637e59839f5f28258f518ac234b2ff62b6da2.tar.bz2
Only request new MUC context when rejoining.
Resolves: #542 Release-Notes: On reconnects, existing MUC history now won't be replayed.
Diffstat (limited to 'Swiften/MUC')
-rw-r--r--Swiften/MUC/MUC.cpp12
-rw-r--r--Swiften/MUC/MUC.h3
2 files changed, 10 insertions, 5 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp
index 9f7c500..b0365d4 100644
--- a/Swiften/MUC/MUC.cpp
+++ b/Swiften/MUC/MUC.cpp
@@ -34,6 +34,7 @@ MUC::MUC(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSende
* Join the MUC with default context.
*/
void MUC::joinAs(const String &nick) {
+ joinSince_ = boost::posix_time::not_a_date_time;
internalJoin(nick);
}
@@ -43,17 +44,20 @@ void MUC::internalJoin(const String &nick) {
joinComplete_ = false;
ownMUCJID = JID(ownMUCJID.getNode(), ownMUCJID.getDomain(), nick);
boost::shared_ptr<Presence> joinPresence(presenceSender->getLastSentUndirectedPresence());
- //FIXME: use date
joinPresence->setTo(ownMUCJID);
- joinPresence->addPayload(boost::shared_ptr<Payload>(new MUCPayload()));
+ boost::shared_ptr<MUCPayload> mucPayload(new MUCPayload());
+ if (joinSince_ != boost::posix_time::not_a_date_time) {
+ mucPayload->setSince(joinSince_);
+ }
+ joinPresence->addPayload(mucPayload);
presenceSender->sendPresence(joinPresence);
}
/**
* Join the MUC with context since date.
*/
-void MUC::joinWithContextSince(const String &nick) {
- //FIXME: add date
+void MUC::joinWithContextSince(const String &nick, const boost::posix_time::ptime& since) {
+ joinSince_ = since;
internalJoin(nick);
}
diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h
index 29dbbe1..672cdf2 100644
--- a/Swiften/MUC/MUC.h
+++ b/Swiften/MUC/MUC.h
@@ -42,7 +42,7 @@ namespace Swift {
}
void joinAs(const String &nick);
- void joinWithContextSince(const String &nick);
+ void joinWithContextSince(const String &nick, const boost::posix_time::ptime& since);
/*void queryRoomInfo(); */
/*void queryRoomItems(); */
String getCurrentNick();
@@ -85,5 +85,6 @@ namespace Swift {
std::map<String, MUCOccupant> occupants;
bool joinComplete_;
boost::bsignals::scoped_connection scopedConnection_;
+ boost::posix_time::ptime joinSince_;
};
}