[Phpfreechat-svn] SF.net SVN: phpfreechat: [1009] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-03-25 17:42:32
|
Revision: 1009 http://svn.sourceforge.net/phpfreechat/?rev=1009&view=rev Author: kerphi Date: 2007-03-25 10:42:32 -0700 (Sun, 25 Mar 2007) Log Message: ----------- Bug fix: users were not considered online when they connected first time Modified Paths: -------------- trunk/src/commands/connect.class.php trunk/src/commands/invite.class.php trunk/src/commands/updatemynick.class.php trunk/src/pfccontainer.class.php trunk/src/pfcuserconfig.class.php trunk/src/proxies/auth.class.php Modified: trunk/src/commands/connect.class.php =================================================================== --- trunk/src/commands/connect.class.php 2007-03-25 16:55:12 UTC (rev 1008) +++ trunk/src/commands/connect.class.php 2007-03-25 17:42:32 UTC (rev 1009) @@ -39,16 +39,9 @@ $isadmin = true; } - // setup some user meta + // create the nickid and setup some user meta $nickid = $u->nickid; - - // create the nickid $ct->joinChan($nickid, NULL); // join the server - - // setup the active flag in user session - // $u->active = true; - // $u->saveInCache(); - // store the user ip $ip = isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"]; if ($ip == "::1") $ip = "127.0.0.1"; // fix for konqueror & localhost Modified: trunk/src/commands/invite.class.php =================================================================== --- trunk/src/commands/invite.class.php 2007-03-25 16:55:12 UTC (rev 1008) +++ trunk/src/commands/invite.class.php 2007-03-25 17:42:32 UTC (rev 1009) @@ -66,7 +66,7 @@ } // check that the inviter is already in the channeltarget - if ($ct->isNickOnline(pfcCommand_join::GetRecipient($channeltarget),$u->nickid) == -1) + if (!$ct->isNickOnline(pfcCommand_join::GetRecipient($channeltarget),$u->nickid)) { $cmdp = $p; $cmdp["params"] = array(); Modified: trunk/src/commands/updatemynick.class.php =================================================================== --- trunk/src/commands/updatemynick.class.php 2007-03-25 16:55:12 UTC (rev 1008) +++ trunk/src/commands/updatemynick.class.php 2007-03-25 17:42:32 UTC (rev 1009) @@ -14,9 +14,9 @@ $c =& pfcGlobalConfig::Instance(); $u =& pfcUserConfig::Instance(); - - $container =& pfcContainer::Instance(); - $container->updateNick($u->nickid); + $ct =& pfcContainer::Instance(); + + $ct->updateNick($u->nickid); } } Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-03-25 16:55:12 UTC (rev 1008) +++ trunk/src/pfccontainer.class.php 2007-03-25 17:42:32 UTC (rev 1009) @@ -129,7 +129,7 @@ $this->setMeta("channelid-to-nickid", $this->encode($chan), $nickid); // update the SERVER channel - if ($chan != 'SERVER') $this->updateNick($nickid); + if ($chan == 'SERVER') $this->updateNick($nickid); return true; } @@ -348,18 +348,17 @@ /** * Returns returns a positive number if the nick is online in the given channel * @param $chan if NULL then check if the user is online on the server, otherwise check if the user has joined the channel - * @return -1 if the user is off line, a positive (>=0) if the user is online + * @return false if the user is off line, true if the user is online */ function isNickOnline($chan, $nickid) { if ($chan == NULL) $chan = 'SERVER'; - $ret = $this->getMeta("channelid-to-nickid", $this->encode($chan)); - for($i = 0; $i<count($ret['timestamp']); $i++) - { - if ($ret['value'][$i] == $nickid) return $i; - } - return -1; + $ret = $this->getMeta("channelid-to-nickid", + $this->encode($chan), + $nickid); + + return (count($ret['timestamp']) > 0); } /** Modified: trunk/src/pfcuserconfig.class.php =================================================================== --- trunk/src/pfcuserconfig.class.php 2007-03-25 16:55:12 UTC (rev 1008) +++ trunk/src/pfcuserconfig.class.php 2007-03-25 17:42:32 UTC (rev 1009) @@ -111,7 +111,7 @@ function isOnline() { $ct =& pfcContainer::Instance(); - $online = ($ct->isNickOnline(NULL, $this->nickid) >= 0); + $online = $ct->isNickOnline(NULL, $this->nickid); return $online; } Modified: trunk/src/proxies/auth.class.php =================================================================== --- trunk/src/proxies/auth.class.php 2007-03-25 16:55:12 UTC (rev 1008) +++ trunk/src/proxies/auth.class.php 2007-03-25 17:42:32 UTC (rev 1009) @@ -43,10 +43,10 @@ // do not allow someone to run a command if he is not online - if ($this->name != 'error' && - $this->name != 'connect' && - $this->name != 'update' && - !$u->isOnline()) + if ( !$u->isOnline() && + $this->name != 'error' && + $this->name != 'connect' && + $this->name != 'update' ) { $cmdp = $p; $cmdp["param"] = _pfc("Your must be connected to send a message"); @@ -113,4 +113,4 @@ } } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |