← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2609: IP display and determination of passive users in NMDC hubs

 

------------------------------------------------------------
revno: 2609
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-09-22 21:45:17 +0200
message:
  IP display and determination of passive users in NMDC hubs
modified:
  dcpp/User.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/User.cpp'
--- dcpp/User.cpp	2011-08-22 20:33:02 +0000
+++ dcpp/User.cpp	2011-09-22 19:45:17 +0000
@@ -37,15 +37,13 @@
 }
 
 bool Identity::isTcp4Active() const {
-	if(getIp4().empty())
-		return false;
-	return user->isSet(User::NMDC) ? !user->isSet(User::PASSIVE) : supports(AdcHub::TCP4_FEATURE);
+	return (!user->isSet(User::NMDC)) ?
+		!getIp4().empty() && supports(AdcHub::TCP4_FEATURE) :
+		!user->isSet(User::PASSIVE);
 }
 
 bool Identity::isTcp6Active() const {
-	if(getIp6().empty())
-		return false;
-	return user->isSet(User::NMDC) ? false : supports(AdcHub::TCP6_FEATURE);
+	return !getIp6().empty() && supports(AdcHub::TCP6_FEATURE);
 }
 
 bool Identity::isUdpActive() const {
@@ -73,11 +71,7 @@
 }
 
 string Identity::getIp() const {
-	if(getIp6().empty() || getUdp6Port().empty()) {
-		return getIp4();
-	}
-
-	return getIp6();
+	return getIp6().empty() ? getIp4() : getIp6();
 }
 
 void Identity::getParams(StringMap& sm, const string& prefix, bool compatibility) const {