diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-08-27 16:44:13 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-08-27 16:44:13 (GMT) |
commit | dd9e8b6bb212128c0e5c82a7cf80e2f49597bc31 (patch) | |
tree | 4f643562ac0e5b450c8ea8cc7ca3f32fec0fb065 /Swift | |
parent | 435061ca8010455e4294a818508e4822cf057d95 (diff) | |
download | swift-dd9e8b6bb212128c0e5c82a7cf80e2f49597bc31.zip swift-dd9e8b6bb212128c0e5c82a7cf80e2f49597bc31.tar.bz2 |
Don't tab-complete for users who aren't in the room.
Resolves: #541
Diffstat (limited to 'Swift')
-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_; }; } |