diff options
author | Kevin Smith <git@kismith.co.uk> | 2013-03-15 17:32:42 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-03-18 10:59:21 (GMT) |
commit | 2fc775d220c4aef146e61a98c57e9994bf828872 (patch) | |
tree | e584d9817d5af9e17e64f5dea657b1784643be69 /Swift/Controllers | |
parent | 14c88d285bdac444a13dd253f9d9f02cb85eb11b (diff) | |
download | swift-contrib-2fc775d220c4aef146e61a98c57e9994bf828872.zip swift-contrib-2fc775d220c4aef146e61a98c57e9994bf828872.tar.bz2 |
Only attempt ten extensions before giving up on joining a room
Change-Id: Ic7d26086a51e346605cb85201d55bf8cbc4249f1
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index a61b5f0..03c8810 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -65,7 +65,7 @@ MUCController::MUCController ( HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager) : - ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc->getJID(), presenceOracle, avatarManager, useDelayForLatency, uiEventStream, eventController, timerFactory, entityCapsProvider, historyController, mucRegistry, highlightManager), muc_(muc), nick_(nick), desiredNick_(nick), password_(password) { + ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc->getJID(), presenceOracle, avatarManager, useDelayForLatency, uiEventStream, eventController, timerFactory, entityCapsProvider, historyController, mucRegistry, highlightManager), muc_(muc), nick_(nick), desiredNick_(nick), password_(password), renameCounter_(0) { parting_ = true; joined_ = false; lastWasPresence_ = false; @@ -279,7 +279,8 @@ void MUCController::handleJoinFailed(boost::shared_ptr<ErrorPayload> error) { errorMessage = str(format(QT_TRANSLATE_NOOP("", "Couldn't join room: %1%.")) % errorMessage); chatWindow_->addErrorMessage(errorMessage); parting_ = true; - if (!rejoinNick.empty()) { + if (!rejoinNick.empty() && renameCounter_ < 10) { + renameCounter_++; setNick(rejoinNick); rejoin(); } @@ -289,6 +290,7 @@ void MUCController::handleJoinFailed(boost::shared_ptr<ErrorPayload> error) { void MUCController::handleJoinComplete(const std::string& nick) { receivedActivity(); + renameCounter_ = 0; joined_ = true; std::string joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have entered room %1% as %2%.")) % toJID_.toString() % nick); setNick(nick); @@ -516,6 +518,7 @@ void MUCController::setOnline(bool online) { processUserPart(); } else { if (shouldJoinOnReconnect_) { + renameCounter_ = 0; chatWindow_->addSystemMessage(str(format(QT_TRANSLATE_NOOP("", "Trying to enter room %1%")) % toJID_.toString())); if (loginCheckTimer_) { loginCheckTimer_->start(); diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 11fe0ff..656eadb 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -132,6 +132,7 @@ namespace Swift { InviteToChatWindow* inviteWindow_; XMPPRoster* xmppRoster_; std::vector<HistoryMessage> joinContext_; + size_t renameCounter_; }; } |