[Phpfreechat-svn] SF.net SVN: phpfreechat: [1006] trunk
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-03-25 15:47:50
|
Revision: 1006 http://svn.sourceforge.net/phpfreechat/?rev=1006&view=rev Author: kerphi Date: 2007-03-25 08:47:50 -0700 (Sun, 25 Mar 2007) Log Message: ----------- improve the non-wanted timeout disconnections managment Modified Paths: -------------- trunk/data/public/js/pfcclient.js trunk/src/commands/connect.class.php trunk/src/pfcuserconfig.class.php Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-03-20 17:28:34 UTC (rev 1005) +++ trunk/data/public/js/pfcclient.js 2007-03-25 15:47:50 UTC (rev 1006) @@ -171,72 +171,13 @@ if (cmd == "connect") { - //alert(cmd + "-"+resp+"-"+param); if (resp == "ok") { this.nickname = param[0]; this.sendRequest('/nick "'+this.nickname+'"'); -/* - if (this.nickname == '') - // ask to choose a nickname - this.askNick(this.nickname); - else - { - this.sendRequest('/nick "'+this.nickname+'"'); - } -*/ + this.isconnected = true; -/* - // join the default channels comming from the parameter list - // and the user's channels comming from the - var ch = pfc_defaultchan; - for (var i=0; i<pfc_userchan.length; i++) - { - if (indexOf(ch,pfc_userchan[i]) == -1) - ch.push(pfc_userchan[i]); - } -*/ - // join the default channels comming from the parameter list - if (pfc_userchan.length == 0) - for (var i=0; i<pfc_defaultchan.length; i++) - { - if (i<pfc_defaultchan.length-1) - cmd = '/join2'; - else - cmd = '/join'; - cmd += ' "'+pfc_defaultchan[i]+'"'; - this.sendRequest(cmd); - } - else - // join channels comming from user sessions - for (var i=0; i<pfc_userchan.length; i++) - { - if (i<pfc_userchan.length-1) - cmd = '/join2'; - else - cmd = '/join'; - cmd += ' "'+pfc_userchan[i]+'"'; - this.sendRequest(cmd); - } - - // join the default privmsg comming from the parameter list - for (var i=0; i<pfc_defaultprivmsg.length; i++) - { - if (i<pfc_defaultprivmsg.length-1) - cmd = '/privmsg2'; - else - cmd = '/privmsg'; - cmd += ' "'+pfc_defaultprivmsg[i]+'"'; - this.sendRequest(cmd); - } - // now join privmsg comming from the sessions - for (var i=0; i<pfc_userprivmsg.length; i++) - { - this.sendRequest('/privmsg "'+pfc_userprivmsg[i]+'"'); - } - - // start the polling system this.updateChat(true); } @@ -335,45 +276,6 @@ if (resp == "connected" || resp == "notchanged") { cmd = ''; - -/* - // join the default channels comming from the parameter list - for (var i=0; i<pfc_defaultchan.length; i++) - { - if (i<pfc_defaultchan.length-1) - cmd = '/join2'; - else - cmd = '/join'; - cmd += ' "'+pfc_defaultchan[i]+'"'; - this.sendRequest(cmd); - } - // now join channels comming from sessions - for (var i=0; i<pfc_userchan.length; i++) - { - if (i<pfc_userchan.length-1) - cmd = '/join2'; - else - cmd = '/join'; - cmd += ' "'+pfc_userchan[i]+'"'; - this.sendRequest(cmd); - } - - // join the default privmsg comming from the parameter list - for (var i=0; i<pfc_defaultprivmsg.length; i++) - { - if (i<pfc_defaultprivmsg.length-1) - cmd = '/privmsg2'; - else - cmd = '/privmsg'; - cmd += ' "'+pfc_defaultprivmsg[i]+'"'; - this.sendRequest(cmd); - } - // now join privmsg comming from the sessions - for (var i=0; i<pfc_userprivmsg.length; i++) - { - this.sendRequest('/privmsg "'+pfc_userprivmsg[i]+'"'); - } -*/ } if (resp == "ok" || resp == "notchanged" || resp == "changed" || resp == "connected") Modified: trunk/src/commands/connect.class.php =================================================================== --- trunk/src/commands/connect.class.php 2007-03-20 17:28:34 UTC (rev 1005) +++ trunk/src/commands/connect.class.php 2007-03-25 15:47:50 UTC (rev 1006) @@ -1,6 +1,6 @@ <?php -require_once(dirname(__FILE__)."/../pfccommand.class.php"); +require_once dirname(__FILE__).'/../pfccommand.class.php'; class pfcCommand_connect extends pfcCommand { @@ -64,13 +64,26 @@ $cmdp["param"] = $nick; $cmd =& pfcCommand::Factory('nick'); $ret = $cmd->run($xml_reponse, $cmdp); - if ($ret) { - // @todo join the channels if $joinoldchan is true (see /update command code) - // @todo remove the /join client side in pfcclient.js.php - + $chanlist = (count($u->channels) == 0) ? $c->channels : $u->getChannelNames(); + for($i = 0 ; $i < count($chanlist) ; $i++) + { + $cmdp = array(); + $cmdp["param"] = $chanlist[$i]; + $cmd =& pfcCommand::Factory( $i < count($chanlist)-1 || !$joinoldchan ? 'join2' : 'join' ); + $cmd->run($xml_reponse, $cmdp); + } + $pvlist = (count($u->privmsg) == 0) ? $c->privmsg : $u->getPrivMsgNames(); + for($i = 0 ; $i < count($pvlist) ; $i++) + { + $cmdp = array(); + $cmdp["param"] = $pvlist[$i]; + $cmd =& pfcCommand::Factory( $i < count($pvlist)-1 || !$joinoldchan ? 'join2' : 'join' ); + $cmd->run($xml_reponse, $cmdp); + } + $xml_reponse->script("pfc.handleResponse('".$this->name."', 'ok', Array('".addslashes($nick)."'));"); } else Modified: trunk/src/pfcuserconfig.class.php =================================================================== --- trunk/src/pfcuserconfig.class.php 2007-03-20 17:28:34 UTC (rev 1005) +++ trunk/src/pfcuserconfig.class.php 2007-03-25 15:47:50 UTC (rev 1006) @@ -121,6 +121,21 @@ $ct =& pfcContainer::Instance(); return $ct->getNickname($this->nickid); } + + function getChannelNames() + { + $list = array(); + foreach( $this->channels as $v ) + $list[] = $v["name"]; + return $list; + } + function getPrivMsgNames() + { + $list = array(); + foreach( $this->privmsg as $v ) + $list[] = $v["name"]; + return $list; + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |