2 /********************************* PHP-P10 ******************************
3 * P10 uplink class by pk910 (c)2011 pk910 *
4 ************************************************************************
7 * PHP-P10 is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with PHP-P10; if not, write to the Free Software Foundation, *
19 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 ************************************************************************
23 * Uplink/P10_User.class.php
25 * This class represents a IRC User
27 ************************************************************************
30 * static P10_User getUserByNum(String $numeric)
31 * searches and returns the User with the provided Numeric
33 * __construct(String $nick, String $numeric, P10_Server $server, int $connect_time, String $ident, String $realname, P10_ModeSet $modes)
34 * *** nothing to say here ***
39 private static $static_users = array();
41 public static getUserByNum($numeric) {
42 if(array_key_exists($numeric, self::$static_servers)) {
43 return self::$static_servers[$numeric];
48 public static getUserByNick($nick) {
49 $nick = strtolower($nick);
50 foreach(self::$static_users as $user) {
51 if(strtolower($user->getNick()) == $nick) {
64 private $connect_time;
68 public __construct($nick, $numeric, $server, $connect_time, $ident, $host, $ip, $realname, $modes) {
70 $this->numeric = $numeric;
71 $this->server = $server;
72 $this->connect_time = $connect_time;
73 $this->ident = $ident;
76 $this->realname = $realname;
77 $this->modes = $modes;
78 $server->addUser($this);
79 self::$static_users[$numeric] = $this;
82 public function getNumeric() {
83 return $this->numeric;
86 public function setNick($nick) {
90 public function getNick() {
94 public function setIdent($ident) {
95 $this->ident = $ident;
98 public function getIdent() {
102 public function getHost() {
106 public function getIP() {
110 public function getConnectTime() {
111 return $this->connect_time;
114 public function getModes() {
118 public function getRealname() {
119 return $this->realname;
122 public function quit($reason) {
123 $this->server->delUser($this);