From 695da943d0443abe58d4c7bd7d171ca0107d83bc Mon Sep 17 00:00:00 2001 From: pk910 Date: Tue, 26 Jul 2011 20:28:27 +0200 Subject: [PATCH] added recv_join & recv_part --- Uplink/P10_Channel.class.php | 4 ++++ Uplink/Uplink.class.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/Uplink/P10_Channel.class.php b/Uplink/P10_Channel.class.php index d38015b..a155481 100644 --- a/Uplink/P10_Channel.class.php +++ b/Uplink/P10_Channel.class.php @@ -83,6 +83,10 @@ class P10_Channel { return $this->topic; } + public function setCreateTime($time) { + $this->create_time = $time; + } + public function getCreateTime() { return $this->create_time; } diff --git a/Uplink/Uplink.class.php b/Uplink/Uplink.class.php index b91bf8a..cf9b34f 100644 --- a/Uplink/Uplink.class.php +++ b/Uplink/Uplink.class.php @@ -214,6 +214,13 @@ class Uplink { case "B": $this->recv_burst($from, $arguments); break; + case "J": + case "C": + $this->recv_join($from, $arguments); + break; + case "L": + $this->recv_part($from, $arguments); + break; //default default: //unknown cmd @@ -358,6 +365,7 @@ class Uplink { $channel = P10_Channel::getChannelByName($name); if($channel == null) $channel = new P10_Channel($name); + $channel->setCreateTime($create_time); $modes = $channel->getModes(); $userstr = $args[count($args)-1]; $modeparamcount = count($args)-3; @@ -400,6 +408,30 @@ class Uplink { $modes->parseModes(implode(array_slice($args, 2, $modeparamcount))); } + private function recv_join($from, $args) { + $user = P10_User::getUserByNum($from); + if($user == null) { + trigger_error("Server tries to join an user that does not exist or was not found on recv_join.", E_USER_ERROR); + return; + } + $channel = P10_Channel::getChannelByName($args[0]); + if($channel == null) + $channel = new P10_Channel($args[0]); + $channel->joinUser($user); + } + + private function recv_part($from, $args) { + $user = P10_User::getUserByNum($from); + if($user == null) { + trigger_error("Server tries to part an user that does not exist or was not found on recv_join.", E_USER_ERROR); + return; + } + $channel = P10_Channel::getChannelByName($args[0]); + if($channel == null) + $channel = new P10_Channel($args[0]); + $channel->partUser($user, $args[1]); + } + /******************************************************************************************** * SERVER FUNCTIONS * ********************************************************************************************/ -- 2.20.1