diff options
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index d84c399..5858127 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -169,6 +169,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { if (occupant.getRealJID()) { realJID = occupant.getRealJID().get(); } + currentOccupants_.insert(occupant.getNick()); roster_->addContact(jid, realJID, occupant.getNick(), roleToGroupName(occupant.getRole())); if (joined_) { String joinString = occupant.getNick() + " has joined the room"; @@ -210,7 +211,7 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes } if (joined_) { String nick = message->getFrom().getResource(); - if (nick != nick_) { + if (nick != nick_ && currentOccupants_.find(nick) != currentOccupants_.end()) { completer_->addWord(nick); } } @@ -260,6 +261,7 @@ void MUCController::setEnabled(bool enabled) { } void MUCController::handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType, const String& reason) { + currentOccupants_.erase(occupant.getNick()); completer_->removeWord(occupant.getNick()); String partMessage = (occupant.getNick() != nick_) ? occupant.getNick() + " has left the room" : "You have left the room"; if (!reason.isEmpty()) { diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 7d40ec2..31e3d48 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -9,6 +9,7 @@ #include <boost/shared_ptr.hpp> #include "Swiften/Base/boost_bsignals.h" #include <boost/signals/connection.hpp> +#include <set> #include "Swiften/Base/String.h" #include "Swiften/Network/Timer.h" @@ -70,6 +71,7 @@ namespace Swift { bool joined_; boost::bsignals::scoped_connection avatarChangedConnection_; boost::shared_ptr<Timer> loginCheckTimer_; + std::set<String> currentOccupants_; }; } |