continued burst() method & Numerics.class.php
[PHP-P10.git] / Uplink / P10_Server.class.php
index a2144cb28a8fc440db8b0ff8d06d6c39b4b2b0d2..f36bbeae3cc1c4092e251e0301f5e88ee3603be4 100644 (file)
  * String getNumeric()
  *     returns the Numeric of the Server
  *
+ * String getName()
+ *     returns the Name of the Server
+ *
+ * String getStartTime()
+ *     returns the startup time of the Server
+ *
+ * String getLinkTime()
+ *     returns the link time of the Server
+ *
+ * String getDescription()
+ *     returns the Description of the Server
+ *
  * void addServer(P10_Server $server)
  *     adds a Server to the server's "slave" list
  *
  * void delServer(P10_Server $server)
- *     removes a Server to the server's "slave" list
+ *     removes a Server from the server's "slave" list
+ *
+ * void addUser(P10_User $user)
+ *     adds a User to the server's userlist
+ *
+ * void delUser(P10_User $user)
+ *     removes a User from the server's userlist
+ *
+ * P10_User[] getUsers()
+ *     returns the server's userlist
  */
 
 class P10_Server {
@@ -64,6 +85,7 @@ class P10_Server {
        private $link_time;
        private $description;
        private $servers = array(); //all Servers connected to this Server
+       private $users = array(); //all Users connected to this Server
        
        public function __construct($name, $numeric, $parent_server, $start_time, $link_time, $description) {
                $this->name = $name;
@@ -91,12 +113,31 @@ class P10_Server {
        
        public function disconnectUsers() {
                //disconnect all Users connected to the actual Server
+               foreach($this->users as $user) {
+                       $user->quit("*.net *.split");
+               }
        }
        
        public function getNumeric() {
                return $this->numeric;
        }
        
+       public function getName() {
+               return $this->name;
+       }
+       
+       public function getStartTime() {
+               return $this->start_time;
+       }
+       
+       public function getLinkTime() {
+               return $this->link_time;
+       }
+       
+       public function getDescription() {
+               return $this->description;
+       }
+       
        public function addServer($server) {
                $this->servers[$server->getNumeric()] = $server;
        }
@@ -108,6 +149,22 @@ class P10_Server {
                        trigger_error("Tried to remove a Server, that does NOT exist.", E_USER_WARNING);
                }
        }
+       
+       public function addUser($user) {
+               $this->users[$user->getNumeric()] = $user;
+       }
+       
+       public function delUser($user) {
+               if(array_key_exists($user->getNumeric(), $this->users)) {
+                       unset($this->users[$user->getNumeric()]);
+               } else {
+                       trigger_error("Tried to remove a User, that does NOT exist.", E_USER_WARNING);
+               }
+       }
+       
+       public function getUsers() {
+               return $this->users;
+       }
 }
 
 ?>
\ No newline at end of file