[Phpfreechat-svn] SF.net SVN: phpfreechat: [826] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-10-07 18:30:29
|
Revision: 826 http://svn.sourceforge.net/phpfreechat/?rev=826&view=rev Author: kerphi Date: 2006-10-07 11:30:07 -0700 (Sat, 07 Oct 2006) Log Message: ----------- [en] Bug fix: correct problems with timeout disconnections and with channels user lists. [1h] [fr] Bug fix : corrections d'incoherances au moment de deconnecter les utilisateurs par timeout et au moment de mettre a jour la liste des utilisateurs. [1h] Modified Paths: -------------- trunk/src/commands/update.class.php trunk/src/pfccontainer.class.php Modified: trunk/src/commands/update.class.php =================================================================== --- trunk/src/commands/update.class.php 2006-10-07 18:20:15 UTC (rev 825) +++ trunk/src/commands/update.class.php 2006-10-07 18:30:07 UTC (rev 826) @@ -30,7 +30,7 @@ } $cmdp = $p; - + // update the user nickname timestamp on the server $cmd =& pfcCommand::Factory("updatemynick"); $cmdp["recipient"] = NULL; @@ -43,12 +43,14 @@ { $cmdp["recipient"] = $chan["recipient"]; $cmdp["recipientid"] = $id; + $cmdp["param"] = ''; // don't forward the parameter because it will be interpreted as a channel name $cmd->run($xml_reponse, $cmdp); } foreach( $u->privmsg as $id => $pv ) { $cmdp["recipient"] = $pv["recipient"]; $cmdp["recipientid"] = $id; + $cmdp["param"] = ''; // don't forward the parameter because it will be interpreted as a channel name $cmd->run($xml_reponse, $cmdp); } Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2006-10-07 18:20:15 UTC (rev 825) +++ trunk/src/pfccontainer.class.php 2006-10-07 18:30:07 UTC (rev 826) @@ -73,10 +73,15 @@ if ($chan == NULL) $chan = 'SERVER'; + $deleted_user = array(); + $deleted_user["nick"] = array(); + $deleted_user["nickid"] = array(); + $deleted_user["timestamp"] = array(); + $timestamp = $this->getMeta("channelid-to-nickid", $this->encode('SERVER'), $nickid); + if (count($timestamp["timestamp"]) == 0) return $deleted_user; $timestamp = $timestamp["timestamp"][0]; - $deleted_user = array(); $deleted_user["nick"][] = $this->getNickname($nickid); $deleted_user["nickid"][] = $nickid; $deleted_user["timestamp"][] = $timestamp; @@ -184,9 +189,8 @@ } /** - * Remove (disconnect/quit) the timeouted nickname from the server or from a channel - * Notice: this function must remove all nicknames which are not uptodate from the given channel or from the server - * @param $chan if NULL then check obsolete nick on the server, otherwise just check obsolete nick on the given channel + * Remove (disconnect/quit) the timeouted nicknames + * Notice: this function will remove all nicknames which are not uptodate from all his joined channels * @param $timeout * @return array("nickid"=>array("nickid1", ...),"timestamp"=>array(timestamp1, ...)) contains all disconnected nickids and there timestamp */ @@ -194,13 +198,11 @@ { $c =& $this->c; - $chan = 'SERVER'; - $deleted_user = array('nick'=>array(), 'nickid'=>array(), 'timestamp'=>array(), 'channels'=>array()); - $ret = $this->getMeta("channelid-to-nickid", $this->encode($chan)); + $ret = $this->getMeta("channelid-to-nickid", $this->encode('SERVER')); for($i = 0; $i<count($ret['timestamp']); $i++) { $timestamp = $ret['timestamp'][$i]; @@ -212,10 +214,19 @@ $ret2 = $this->getMeta("nickid-to-channelid",$nickid); foreach($ret2["value"] as $userchan) { - // disconnect the user from each joined channels - $du = $this->removeNick($this->decode($userchan), $nickid); - $channels[] = $this->decode($userchan); + $userchan = $this->decode($userchan); + if ($userchan != 'SERVER') + { + // disconnect the user from each joined channels + $this->removeNick($userchan, $nickid); + $channels[] = $userchan; + } } + // now disconnect the user from the server + // (order is important because the SERVER channel has timestamp informations) + $du = $this->removeNick('SERVER', $nickid); + $channels[] = 'SERVER'; + $deleted_user["nick"] = array_merge($deleted_user["nick"], $du["nick"]); $deleted_user["nickid"] = array_merge($deleted_user["nickid"], $du["nickid"]); $deleted_user["timestamp"] = array_merge($deleted_user["timestamp"], $du["timestamp"]); @@ -245,6 +256,7 @@ // get timestamp from the SERVER channel $timestamp = $this->getMeta("channelid-to-nickid", $this->encode('SERVER'), $nickid); + if (count($timestamp['timestamp']) == 0) continue; $timestamp = $timestamp['timestamp'][0]; $online_user["nick"][] = $this->getNickname($nickid); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |