summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Chat/MUCController.cpp')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index bdc9b20..68be032 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -196,10 +196,10 @@ void MUCController::rejoin() {
}
//FIXME: check for received activity
if (lastActivity_ == boost::posix_time::not_a_date_time) {
- muc_->joinAs(nick_);
- } else {
- muc_->joinWithContextSince(nick_, lastActivity_);
+ lastActivity_ = historyController_->getLastTimeStampFromMUC(selfJID_, toJID_);
}
+
+ muc_->joinWithContextSince(nick_, lastActivity_);
}
}
@@ -275,6 +275,9 @@ void MUCController::handleJoinComplete(const std::string& nick) {
std::string joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have entered room %1% as %2%.")) % toJID_.toString() % nick);
nick_ = nick;
chatWindow_->addSystemMessage(joinMessage);
+
+ addRecentLogs();
+
clearPresenceQueue();
shouldJoinOnReconnect_ = true;
setEnabled(true);
@@ -788,4 +791,15 @@ void MUCController::logMessage(const std::string& message, const JID& fromJID, c
}
}
+void MUCController::addRecentLogs() {
+ std::vector<HistoryMessage> messages = historyController_->getMUCContext(selfJID_, toJID_, lastActivity_);
+
+ foreach (const HistoryMessage& message, messages) {
+ bool senderIsSelf = nick_ == message.getFromJID().getResource();
+
+ // the chatWindow uses utc timestamps
+ addMessage(message.getMessage(), senderDisplayNameFromMessage(message.getFromJID()), senderIsSelf, boost::shared_ptr<SecurityLabel>(new SecurityLabel()), std::string(avatarManager_->getAvatarPath(message.getFromJID()).string()), message.getTime() - boost::posix_time::hours(message.getOffset()));
+ }
+}
+
}