]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Added announcement answer XML, template engine and acceptance of announcements
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index 1ba56ca42e3dacb73d502a9cba8c16ac0de41776..8a091325e91c7ab85a4ef569f78462620f3d1279 100644 (file)
@@ -55,10 +55,15 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
        private $hubIsAnnounced = false;
 
        /**
-        * Whether this hub is active
+        * Whether this hub is active (default: false)
         */
        private $isActive = false;
 
+       /**
+        * Whether this node accepts announcements (default: false)
+        */
+       private $acceptAnnouncements = false;
+
        /**
         * Protected constructor
         *
@@ -454,7 +459,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
        public function activateNode (Requestable $requestInstance, Responseable $responseInstance) {
                // Checks whether a listener is still active and shuts it down if one
                // is still listening.
-               if (($this->determineIfListenerIsActive()) && ($this->getIsActive())) {
+               if (($this->determineIfListenerIsActive()) && ($this->isNodeActive()())) {
                        // Shutdown them down before they can hurt anything
                        $this->shutdownListenerPool();
                } // END - if
@@ -584,7 +589,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
         *
         * @return      $isActive       Whether the hub is active
         */
-       public final function getIsActive () {
+       public final function isNodeActive() () {
                return $this->isActive;
        }
 
@@ -598,6 +603,30 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                $this->isActive = (bool) $isActive;
        }
 
+       /**
+        * Checks whether this node accepts announcements
+        *
+        * @return      $acceptsAnnouncements   Whether this node accepts announcements
+        */
+       public final function isAcceptingAnnouncements () {
+               // Check it (this node must be active and not shutdown!)
+               $acceptsAnnouncements = (($this->acceptsAnnouncements === true) && ($this->isNodeActive()());
+
+               // Return it
+               return $acceptsAnnouncements;
+       }
+
+       /**
+        * Enables whether this node accepts announcements
+        *
+        * @param       $acceptsAnnouncements   Whether this node accepts announcements (default: true)
+        * @return      void
+        */
+       protected final function enableAcceptingAnnouncements ($acceptsAnnouncements = true) {
+               $this->acceptAnnouncements = $acceptsAnnouncements;
+       }
+       
+       
        /**
         * "Getter for address:port combination
         *