← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3348: Don't reconnect after a manual hub disconnect

 

------------------------------------------------------------
revno: 3348
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2013-09-15 20:28:03 +0200
message:
  Don't reconnect after a manual hub disconnect
modified:
  changelog.txt
  win32/HubFrame.cpp
  win32/HubFrame.h
  win32/MainWindow.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2013-09-15 16:39:42 +0000
+++ changelog.txt	2013-09-15 18:28:03 +0000
@@ -10,6 +10,7 @@
 * [ADC] Direct encrypted PM channels (poy)
 * [ADC] Validate connection tokens to avoid impersonators (poy)
 * [ADC] Send FM / FB in code 43 STAs instead of FL (poy)
+* Don't reconnect after a manual hub disconnect (poy)
 
 -- 0.828 2013-07-23 --
 * Translation fixes

=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2013-08-19 20:13:24 +0000
+++ win32/HubFrame.cpp	2013-09-15 18:28:03 +0000
@@ -136,7 +136,7 @@
 void HubFrame::reconnectDisconnected() {
 	for(auto i: frames) {
 		if(!i->client->isConnected())
-			i->handleReconnect();
+			i->reconnect();
 	}
 }
 
@@ -261,7 +261,7 @@
 	status->setHelpId(STATUS_AVERAGE_SHARED, IDH_HUB_AVERAGE_SHARED);
 
 	addAccel(FALT, 'G', [this] { handleGetList(); });
-	addAccel(FCONTROL, 'R', [this] { handleReconnect(); });
+	addAccel(FCONTROL, 'R', [this] { reconnect(); });
 	addAccel(FALT, 'P', [this] { handlePrivateMessage(getParent()); });
 	addAccel(FALT, 'U', [this] { users->setFocus(); });
 	addAccel(FALT, 'I', [this] { filter.text->setFocus(); });
@@ -301,7 +301,7 @@
 
 	FavoriteManager::getInstance()->removeListener(this);
 	client->removeListener(this);
-	client->disconnect(true);
+	disconnect(false);
 
 	frames.erase(std::remove(frames.begin(), frames.end(), this), frames.end());
 	return true;
@@ -702,7 +702,7 @@
 				client->setPassword(Text::fromT(linePwd.getValue()));
 				client->password(Text::fromT(linePwd.getValue()));
 			} else {
-				client->disconnect(true);
+				disconnect(true);
 			}
 		} else {
 			message->setText(_T("/password "));
@@ -1290,9 +1290,9 @@
 		menu->appendItem(T_("Add To &Favorites"), [this] { addAsFavorite(); }, WinUtil::menuIcon(IDI_FAVORITE_HUBS));
 	}
 
-	menu->appendItem(T_("&Reconnect\tCtrl+R"), [this] { handleReconnect(); }, WinUtil::menuIcon(IDI_RECONNECT));
+	menu->appendItem(T_("&Reconnect\tCtrl+R"), [this] { reconnect(); }, WinUtil::menuIcon(IDI_RECONNECT));
 	menu->appendItem(T_("Copy &address to clipboard"), [this] { handleCopyHub(); });
-	menu->appendItem(T_("&Disconnect"), [this] { client->disconnect(true); }, WinUtil::menuIcon(IDI_HUB_OFF));
+	menu->appendItem(T_("&Disconnect"), [this] { disconnect(false); }, WinUtil::menuIcon(IDI_HUB_OFF));
 
 	prepareMenu(menu, UserCommand::CONTEXT_HUB, url);
 
@@ -1470,10 +1470,15 @@
 	return false;
 }
 
-void HubFrame::handleReconnect() {
+void HubFrame::reconnect() {
 	client->reconnect();
 }
 
+void HubFrame::disconnect(bool allowReco) {
+	client->setAutoReconnect(allowReco);
+	client->disconnect(true);
+}
+
 void HubFrame::redirect(string&& target) {
 	Util::sanitizeUrl(target);
 

=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h	2013-03-26 22:03:28 +0000
+++ win32/HubFrame.h	2013-09-15 18:28:03 +0000
@@ -235,7 +235,6 @@
 	void handleDoubleClickUsers();
 	void handleCopyHub();
 	void handleAddAsFavorite();
-	void handleReconnect();
 
 	void showFilterOpts();
 	void hideFilterOpts(dwt::Widget* w);
@@ -246,6 +245,8 @@
 	string stripNick(const string& nick) const;
 	tstring scanNickPrefix(const tstring& prefix);
 
+	void reconnect();
+	void disconnect(bool allowReco);
 	void redirect(string&& target);
 
 	// MDIChildFrame

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2013-09-15 16:39:42 +0000
+++ win32/MainWindow.cpp	2013-09-15 18:28:03 +0000
@@ -930,7 +930,7 @@
 }
 
 void MainWindow::handleReconnect() {
-	forwardHub(&HubFrame::handleReconnect);
+	forwardHub(&HubFrame::reconnect);
 }
 
 void MainWindow::forwardHub(void (HubFrame::*f)()) {