summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-04-16 10:32:52 (GMT)
committerSwift Review <review@swift.im>2014-05-27 13:38:59 (GMT)
commit8930bbfd434468a4f2c601400705e8a545310c6c (patch)
tree078a8f60b2d1029a0632a300435d4fed2002a458 /Swift/Controllers/Chat
parentbf3739c75fcb312a99608488c8741e2ffc15ca1e (diff)
downloadswift-8930bbfd434468a4f2c601400705e8a545310c6c.zip
swift-8930bbfd434468a4f2c601400705e8a545310c6c.tar.bz2
Remove unnecessary system messages from chats.
Change-Id: Ifa1f34e5d5ada7f529f19c0172b46f08907f55c1
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index cb2616c..ffd86f9 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -335,12 +335,12 @@ void MUCController::handleJoinComplete(const std::string& nick) {
joined_ = true;
std::string joinMessage;
if (isImpromptu_) {
- joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have entered chat as %1%.")) % nick);
+ joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have joined the chat as %1%.")) % nick);
} else {
joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have entered room %1% as %2%.")) % toJID_.toString() % nick);
}
setNick(nick);
- chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(joinMessage), ChatWindow::DefaultDirection);
+ chatWindow_->replaceLastMessage(chatMessageParser_->parseMessageBody(joinMessage));
#ifdef SWIFT_EXPERIMENTAL_HISTORY
addRecentLogs();
@@ -587,7 +587,7 @@ void MUCController::setOnline(bool online) {
if (shouldJoinOnReconnect_) {
renameCounter_ = 0;
if (isImpromptu_) {
- chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(QT_TRANSLATE_NOOP("", "Trying to enter chat")), ChatWindow::DefaultDirection);
+ chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(QT_TRANSLATE_NOOP("", "Trying to join chat")), ChatWindow::DefaultDirection);
} else {
chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(str(format(QT_TRANSLATE_NOOP("", "Trying to enter room %1%")) % toJID_.toString())), ChatWindow::DefaultDirection);
}
@@ -631,7 +631,21 @@ void MUCController::handleOccupantLeft(const MUCOccupant& occupant, MUC::Leaving
case MUC::Disconnect:
case MUC::LeavePart: break;
}
- partMessage = str(format(QT_TRANSLATE_NOOP("", "%1% has left the room%2%")) % occupant.getNick() % partType);
+ if (isImpromptu_) {
+ partMessage = str(format(QT_TRANSLATE_NOOP("", "%1% has left the chat%2%")) % occupant.getNick() % partType);
+ } else {
+ partMessage = str(format(QT_TRANSLATE_NOOP("", "%1% has left the room%2%")) % occupant.getNick() % partType);
+ }
+ }
+ else if (isImpromptu_) {
+ switch (type) {
+ case MUC::LeaveKick:
+ case MUC::LeaveBan: clearPresenceQueue(); clearAfter = true; partMessage = QT_TRANSLATE_NOOP("", "You have been removed from this chat"); break;
+ case MUC::LeaveNotMember: clearPresenceQueue(); clearAfter = true; partMessage = QT_TRANSLATE_NOOP("", "You have been removed from this chat"); break;
+ case MUC::LeaveDestroy: clearPresenceQueue(); clearAfter = true; partMessage = QT_TRANSLATE_NOOP("", "This chat has ended"); break;
+ case MUC::Disconnect:
+ case MUC::LeavePart: partMessage = QT_TRANSLATE_NOOP("", "You have left the chat");
+ }
}
else {
switch (type) {