[Phpfreechat-svn] SF.net SVN: phpfreechat: [788] trunk/src/commands
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-09-23 09:36:18
|
Revision: 788 http://svn.sourceforge.net/phpfreechat/?rev=788&view=rev Author: kerphi Date: 2006-09-23 02:36:13 -0700 (Sat, 23 Sep 2006) Log Message: ----------- [en] Bug fix: when a user was disconnected by timeout because of his bad connection, when hi comes back he was not correctly reconnected. So, private messages were broken. [1h15] [fr] Bug fix : lorsque un utilisateur est deconnect?\195?\169 par timeout a cause de sa mauvaise connexion, ses metadonnees ne sont pas recrees car il ne repasse pas par la commande /connect. La solution est d'appeler la m?\195?\169thode /connect dans le cas ou l'on d?\195?\169tecte que l'utilisateur n'est plus online juste apr?\195?\168s sa deconnexion au moment du /update suivant. [1h15] Modified Paths: -------------- trunk/src/commands/connect.class.php trunk/src/commands/update.class.php Modified: trunk/src/commands/connect.class.php =================================================================== --- trunk/src/commands/connect.class.php 2006-09-23 09:31:52 UTC (rev 787) +++ trunk/src/commands/connect.class.php 2006-09-23 09:36:13 UTC (rev 788) @@ -11,6 +11,7 @@ $sender = $p["sender"]; $recipient = $p["recipient"]; $recipientid = $p["recipientid"]; + $getoldmsg = isset($p["getoldmsg"]) ? $p["getoldmsg"] : true; $c =& $this->c; $u =& $this->u; @@ -18,26 +19,29 @@ // reset the message id indicator (see getnewmsg.class.php) // i.e. be ready to re-get all last posted messages - require_once(dirname(__FILE__)."/join.class.php"); - $channels = array(); - if (count($u->channels) == 0) - $channels = $c->channels; - else - foreach($u->channels as $chan) - $channels[] = $chan["name"]; - foreach($channels as $channame) + if ($getoldmsg) { - $chanrecip = pfcCommand_join::GetRecipient($channame); - $chanid = pfcCommand_join::GetRecipientId($channame); - // reset the fromid flag - $from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$chanid; - $from_id = $ct->getLastId($chanrecip)-$c->max_msg; - $_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id; - // reset the oldmsg flag - $oldmsg_sid = "pfc_oldmsg_".$c->getId()."_".$clientid."_".$chanid; - $_SESSION[$oldmsg_sid] = true; + require_once(dirname(__FILE__)."/join.class.php"); + $channels = array(); + if (count($u->channels) == 0) + $channels = $c->channels; + else + foreach($u->channels as $chan) + $channels[] = $chan["name"]; + foreach($channels as $channame) + { + $chanrecip = pfcCommand_join::GetRecipient($channame); + $chanid = pfcCommand_join::GetRecipientId($channame); + // reset the fromid flag + $from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$chanid; + $from_id = $ct->getLastId($chanrecip)-$c->max_msg; + $_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id; + // reset the oldmsg flag + $oldmsg_sid = "pfc_oldmsg_".$c->getId()."_".$clientid."_".$chanid; + $_SESSION[$oldmsg_sid] = true; + } } - + // check if the user is alone on the server, and give it the admin status if yes $isadmin = $c->isadmin; if (!$isadmin) Modified: trunk/src/commands/update.class.php =================================================================== --- trunk/src/commands/update.class.php 2006-09-23 09:31:52 UTC (rev 787) +++ trunk/src/commands/update.class.php 2006-09-23 09:36:13 UTC (rev 788) @@ -18,7 +18,19 @@ // do not update if user isn't active (didn't connect) if ($u->active) { + // check the user has not been disconnected from the server by timeout + // if I found he has been disconnected, then I reconnect him with /connect command + $ct =& $c->getContainerInstance(); + if ($ct->isNickOnline(NULL, $u->nickid) < 0) + { + $cmd =& pfcCommand::Factory("connect"); + $cmdp = $p; + $cmdp["getoldmsg"] = false; + $cmd->run($xml_reponse, $cmdp); + } + $cmdp = $p; + // update the user nickname timestamp on the server $cmd =& pfcCommand::Factory("updatemynick"); $cmdp["recipient"] = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |