summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
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_;
};
}