From 2fc775d220c4aef146e61a98c57e9994bf828872 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Fri, 15 Mar 2013 17:32:42 +0000 Subject: Only attempt ten extensions before giving up on joining a room Change-Id: Ic7d26086a51e346605cb85201d55bf8cbc4249f1 diff --git a/SwifTools/SpellParser.h b/SwifTools/SpellParser.h index a6eafb5..b64565c 100644 --- a/SwifTools/SpellParser.h +++ b/SwifTools/SpellParser.h @@ -18,7 +18,7 @@ namespace Swift { ID_WWW = 1, ID_HTTP = 2, ID_WORD = 3, - ID_CHAR = 4, + ID_CHAR = 4 }; typedef boost::tuple PositionPair; 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 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 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 joinContext_; + size_t renameCounter_; }; } -- cgit v0.10.2-6-g49f6