Index: plugins/Live/Visitor.php
===================================================================
--- plugins/Live/Visitor.php	(révision 3070)
+++ plugins/Live/Visitor.php	(copie de travail)
@@ -91,13 +91,20 @@
 	}
 
 	function getIp()
-	{
-		if(isset($this->details['location_ip']))
-		{
-			return long2ip($this->details['location_ip']);
-		}
-		return false;
-	}
+        {
+                if(isset($this->details['location_ip']))
+                {
+                        if($this->details['location_ip'] !== '0')
+                        {
+                                return long2ip($this->details['location_ip']);
+                        }
+                }
+                if(isset($this->details['location_ipv6']))
+                {
+                        return $this->details['location_ipv6'];
+                }
+                return false;
+        }
 
 	function getIdVisit()
 	{
Index: core/Tracker/Visit.php
===================================================================
--- core/Tracker/Visit.php	(révision 3070)
+++ core/Tracker/Visit.php	(copie de travail)
@@ -57,8 +57,9 @@
 	// can be overwritten in constructor
 	protected $timestamp;
 	protected $ipString;
+	protected $ipv6String;
 
-	public function __construct($forcedIpString = null, $forcedDateTime = null)
+	public function __construct($forcedIpString = null, $forcedDateTime = null, $forcedIpv6String = null)
 	{
 		$this->timestamp = time();
 		if(!empty($forcedDateTime))
@@ -72,6 +73,14 @@
 		}
 		
 		$this->ipString = Piwik_Common::getIp($ipString);
+
+		$ipv6String = $forcedIpv6String;
+		if(empty($ipv6String))
+		{
+			$ipv6String = Piwik_Common::getIpv6();
+		}
+
+		$this->ipv6String = $ipv6String;
 	}
 	
 	function setRequest($requestArray)
@@ -120,6 +129,7 @@
 	{
 		// the IP is needed by isExcluded() and GoalManager->recordGoals()
 		$this->visitorInfo['location_ip'] = $this->ipString;
+		$this->visitorInfo['location_ipv6'] = $this->ipv6String;
 		
 		if($this->isExcluded())
 		{
@@ -407,6 +417,7 @@
 			'config_silverlight'		=> $userInfo['config_silverlight'],
 			'config_cookie' 			=> $userInfo['config_cookie'],
 			'location_ip' 				=> $this->getVisitorIp(),
+			'location_ipv6'				=> $this->getVisitorIpv6(),
 			'location_browser_lang'		=> $userInfo['location_browser_lang'],
 			'location_country' 			=> $country,
 		);
@@ -477,6 +488,15 @@
 		return $this->visitorInfo['location_ip']; 
 	}
 	
+	/**
+	 * Returns the visitor's IPv6 address
+	 *
+	 * @return string
+	 */
+	protected function getVisitorIpv6()
+	{
+		return $this->visitorInfo['location_ipv6'];
+	}
 
 	/**
 	 * Returns the visitor's browser (user agent)
Index: core/Db/Schema/Myisam.php
===================================================================
--- core/Db/Schema/Myisam.php	(révision 3070)
+++ core/Db/Schema/Myisam.php	(copie de travail)
@@ -200,6 +200,7 @@
 							  config_silverlight TINYINT(1) NOT NULL,
 							  config_cookie TINYINT(1) NOT NULL,
 							  location_ip INT UNSIGNED NOT NULL,
+							  location_ipv6 CHAR(39) NOT NULL,
 							  location_browser_lang VARCHAR(20) NOT NULL,
 							  location_country CHAR(3) NOT NULL,
 							  location_continent CHAR(3) NOT NULL,
Index: core/Common.php
===================================================================
--- core/Common.php	(révision 3070)
+++ core/Common.php	(copie de travail)
@@ -736,6 +736,29 @@
 
 		return sprintf("%u", ip2long($ipStringFrom));
 	}
+	
+	/**
+	 * Convert dotted IP to a stringified integer representation
+	 *
+	 * @return string ip
+	 */
+	static public function getIpv6($ipv6StringFrom = false)
+        {
+                if($ipv6StringFrom === false)
+                {
+                        $ipv6StringFrom = self::getIpString();
+                }
+                // Is an IPv6 regular string (contains at least one colon char)
+                if(strpos($ipv6StringFrom, ':'))
+                {
+                        return $ipv6StringFrom;
+                }
+                // Is not an IPv6 regular string, generic IPv6 address used
+                else
+                {
+                        return '::';
+                }
+        }
 
 	/**
 	 * Returns the best possible IP of the current user, in the format A.B.C.D
