summaryrefslogtreecommitdiffstats
path: root/Swift
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 /Swift
parentf4d1b6494d5c537ba4a086d61ea86b1dd6843e4b (diff)
downloadswift-contrib-b23637e59839f5f28258f518ac234b2ff62b6da2.zip
swift-contrib-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 'Swift')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp7
-rw-r--r--Swift/Controllers/Chat/MUCController.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 259b715..6ac6a0c 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -96,10 +96,10 @@ void MUCController::rejoin() {
joined_ = false;
parting_ = false;
//FIXME: check for received activity
- if (/*lastActivityDate_ == none*/true) {
+ if (lastActivity_ == boost::posix_time::not_a_date_time) {
muc_->joinAs(nick_);
} else {
- muc_->joinWithContextSince(nick_);
+ muc_->joinWithContextSince(nick_, lastActivity_);
}
}
}
@@ -230,6 +230,9 @@ bool MUCController::messageTargetsMe(boost::shared_ptr<Message> message) {
}
void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) {
+ if (messageEvent->getStanza()->getType() == Message::Groupchat) {
+ lastActivity_ = boost::posix_time::microsec_clock::universal_time();
+ }
clearPresenceQueue();
boost::shared_ptr<Message> message = messageEvent->getStanza();
if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && messageTargetsMe(message) && !message->getPayload<Delay>()) {
diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h
index 1af9c58..20bf403 100644
--- a/Swift/Controllers/Chat/MUCController.h
+++ b/Swift/Controllers/Chat/MUCController.h
@@ -93,6 +93,7 @@ namespace Swift {
boost::shared_ptr<Timer> loginCheckTimer_;
std::set<String> currentOccupants_;
std::vector<NickJoinPart> joinParts_;
+ boost::posix_time::ptime lastActivity_;
};
}