linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04696
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2653: better connectivity info string
------------------------------------------------------------
revno: 2653
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2011-10-25 20:53:49 +0200
message:
better connectivity info string
modified:
dcpp/ConnectivityManager.cpp
dcpp/ConnectivityManager.h
win32/HubFrame.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 'dcpp/ConnectivityManager.cpp'
--- dcpp/ConnectivityManager.cpp 2011-10-25 18:07:46 +0000
+++ dcpp/ConnectivityManager.cpp 2011-10-25 18:53:49 +0000
@@ -21,11 +21,12 @@
#include "ClientManager.h"
#include "ConnectionManager.h"
+#include "format.h"
#include "LogManager.h"
#include "MappingManager.h"
#include "SearchManager.h"
#include "SettingsManager.h"
-#include "format.h"
+#include "version.h"
namespace dcpp {
@@ -156,6 +157,50 @@
fire(ConnectivityManagerListener::SettingChanged());
}
+string ConnectivityManager::getInformation() const {
+ string autoStatus = ok() ? str(F_("enabled - %1%") % getStatus()) : _("disabled");
+
+ string mode;
+
+ switch(CONNSETTING(INCOMING_CONNECTIONS)) {
+ case SettingsManager::INCOMING_DIRECT:
+ {
+ mode = _("Direct connection to the Internet (no router)");
+ break;
+ }
+ case SettingsManager::INCOMING_FIREWALL_UPNP:
+ {
+ mode = str(F_("Connection behind a router that %1% has configured with %2%") % APPNAME % SETTING(MAPPER));
+ break;
+ }
+ case SettingsManager::INCOMING_FIREWALL_NAT:
+ {
+ mode = _("Active mode behind a router");
+ break;
+ }
+ case SettingsManager::INCOMING_FIREWALL_PASSIVE:
+ {
+ mode = _("Passive mode");
+ break;
+ }
+ }
+
+ string ip = CONNSETTING(EXTERNAL_IP);
+ if(ip.empty()) {
+ ip = _("undefined");
+ }
+
+ return str(F_(
+ "Connectivity information:\n\n"
+ "Automatic connectivity setup is: %1%\n\n"
+ "\t%2%\n"
+ "\tExternal IP: %3%\n"
+ "\tTransfer port: %4%\n"
+ "\tEncrypted transfer port: %5%\n"
+ "\tSearch port: %6%") % autoStatus % mode % ip % ConnectionManager::getInstance()->getPort() %
+ ConnectionManager::getInstance()->getSecurePort() % SearchManager::getInstance()->getPort());
+}
+
void ConnectivityManager::mappingFinished(const string& mapper) {
if(BOOLSETTING(AUTO_DETECT_CONNECTION)) {
if(mapper.empty()) {
=== modified file 'dcpp/ConnectivityManager.h'
--- dcpp/ConnectivityManager.h 2011-10-25 18:07:46 +0000
+++ dcpp/ConnectivityManager.h 2011-10-25 18:53:49 +0000
@@ -62,6 +62,7 @@
bool ok() const { return autoDetected; }
bool isRunning() const { return running; }
const string& getStatus() const { return status; }
+ string getInformation() const;
private:
friend class Singleton<ConnectivityManager>;
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2011-10-25 18:07:46 +0000
+++ win32/HubFrame.cpp 2011-10-25 18:53:49 +0000
@@ -396,10 +396,8 @@
close(true);
} else if(Util::stricmp(cmd.c_str(), _T("userlist")) == 0) {
showUsers->setChecked(!showUsers->getChecked());
- } else if(Util::stricmp(cmd.c_str(), _T("connection")) == 0) {
- addStatus(Text::toT(str(F_("IP: %1%, Transfer port: %2%, Encrypted transfer port: %3%, Search port: %4%") %
- client->getLocalIp() % ConnectionManager::getInstance()->getPort() %
- ConnectionManager::getInstance()->getSecurePort() % SearchManager::getInstance()->getPort())));
+ } else if(Util::stricmp(cmd.c_str(), _T("conn")) == 0 || Util::stricmp(cmd.c_str(), _T("connection")) == 0) {
+ addStatus(Text::toT(ConnectivityManager::getInstance()->getInformation()));
} else if((Util::stricmp(cmd.c_str(), _T("favorite")) == 0) || (Util::stricmp(cmd.c_str(), _T("fav")) == 0)) {
addAsFavorite();
} else if((Util::stricmp(cmd.c_str(), _T("removefavorite")) == 0) || (Util::stricmp(cmd.c_str(), _T("removefav")) == 0)) {
@@ -417,7 +415,9 @@
else if(Util::stricmp(param.c_str(), _T("status")) == 0)
openLog(true);
} else if(Util::stricmp(cmd.c_str(), _T("help")) == 0) {
- addChat(_T("*** ") + WinUtil::commands + _T(", /join <hub-ip>, /showjoins, /favshowjoins, /close, /userlist, /connection, /favorite, /pm <user> [message], /getlist <user>, /log <status, system, downloads, uploads>, /removefavorite"));
+ addChat(_T("*** ") + WinUtil::commands +
+ _T(", /join <hub-ip>, /showjoins, /favshowjoins, /close, /userlist, /conn[ection], /fav[orite], ")
+ _T("/pm <user> [message], /getlist <user>, /log <status, system, downloads, uploads>, /removefav[orite]"));
} else if(Util::stricmp(cmd.c_str(), _T("pm")) == 0) {
string::size_type j = param.find(_T(' '));
if(j != string::npos) {