[Phpfreechat-svn] SF.net SVN: phpfreechat: [748] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-09-10 20:48:10
|
Revision: 748 http://svn.sourceforge.net/phpfreechat/?rev=748&view=rev Author: kerphi Date: 2006-09-10 13:47:57 -0700 (Sun, 10 Sep 2006) Log Message: ----------- [en] Bug fix: two users with same nick at same time (thanks to wjwlsn, SF bug 1555160). [fr] Bug fix : Deux utilisateurs avec le m?\195?\170me pseudo pouvaient parler ensemble (merci ?\195?\160 wjwlsn, SF bug 1555160). Modified Paths: -------------- trunk/src/client/pfcclient.js trunk/src/proxys/checknickchange.class.php Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-09-10 19:18:38 UTC (rev 747) +++ trunk/src/client/pfcclient.js 2006-09-10 20:47:57 UTC (rev 748) @@ -303,10 +303,14 @@ { this.el_handle.innerHTML = param; this.nickname = param; + + // clear the possible error box generated by the bellow displayMsg(...) function + this.clearError(Array(this.el_words)); } else if (resp == "isused") { - this.displayMsg( cmd, this.res.getLabel('Choosen nickname is allready used') ); + this.setError(this.res.getLabel('Choosen nickname is allready used'), Array()); + this.askNick(param); } else alert(cmd + "-"+resp+"-"+param); @@ -620,7 +624,7 @@ displayMsg: function( cmd, msg ) { - this.setError(msg); + this.setError(msg, Array()); // @todo find a better crossbrowser way to display messages /* Modified: trunk/src/proxys/checknickchange.class.php =================================================================== --- trunk/src/proxys/checknickchange.class.php 2006-09-10 19:18:38 UTC (rev 747) +++ trunk/src/proxys/checknickchange.class.php 2006-09-10 20:47:57 UTC (rev 748) @@ -46,14 +46,6 @@ $newnick = phpFreeChat::FilterNickname($param); $oldnick = $u->nick; - if ($newnick == $oldnick) - { - $xml_reponse->addScript("pfc.handleResponse('nick', 'notchanged', '".addslashes($newnick)."');"); - if ($c->debug) - pxlog("/nick ".$newnick." (user just reloded the page so let him keep his nickname without any warnings)", "chat", $c->getId()); - return; - } - // if the user want to change his nickname but the frozen_nick is enable // then send him a warning if ( $this->name == "nick" && @@ -69,8 +61,17 @@ $container =& $c->getContainerInstance(); $newnickid = $container->getNickId($newnick); - $oldnickid = $container->getNickId($oldnick); + $oldnickid = $u->nickid; + if ($newnick == $oldnick && + $newnickid == $oldnickid) + { + $xml_reponse->addScript("pfc.handleResponse('nick', 'notchanged', '".addslashes($newnick)."');"); + if ($c->debug) + pxlog("/nick ".$newnick." (user just reloded the page so let him keep his nickname without any warnings)", "chat", $c->getId()); + return; + } + // now check the nickname is not yet used (unsensitive case) // 'BoB' and 'bob' must be considered same nicknames $nick_in_use = false; @@ -86,20 +87,13 @@ $nick_in_use = true; } } - if ($nick_in_use) + if ($nick_in_use || $newnickid != "undefined") { $xml_reponse->addScript("pfc.handleResponse('nick', 'isused', '".addslashes($newnick)."');"); if ($c->debug) pxlog("/nick ".$newnick." (wanted nick is allready in use -> wantednickid=".$newnickid.")", "chat", $c->getId()); return; } - - if ( $newnickid != "undefined" ) - { - // @todo notify the user ? - return; - } - } // allow nick changes only from the parameters array (server side) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |