Exemple #1
0
		/// <summary>
		/// Stops scope handling (that is, stops application if given scope is app
		/// level scope and stops room handling if given scope has lower scope level).
		/// </summary>
		/// <param name="scope">Scope to stop.</param>
		public override void Stop(IScope scope) 
		{
			if(ScopeUtils.IsApplication(scope)) 
				AppStop(scope);
			else if (ScopeUtils.IsRoom(scope)) 
				RoomStop(scope);
			base.Stop(scope);
		}
Exemple #2
0
 public virtual void RemoveEventListener(IEventListener listener)
 {
     this._listeners.Remove(listener);
     if ((!this._keepOnDisconnect && ScopeUtils.IsRoom(this)) && (this._listeners.Count == 0))
     {
         this._parent.RemoveChildScope(this);
     }
 }
Exemple #3
0
		/// <summary>
		/// Disconnects client from scope. Can be applied to both application scope
		/// and scopes of lower level.
		/// </summary>
		/// <param name="client">Client object.</param>
		/// <param name="scope">Scope object.</param>
		public override void Leave(IClient client, IScope scope) 
		{
			if (ScopeUtils.IsApplication(scope)) 
				AppLeave(client, scope);
			else if (ScopeUtils.IsRoom(scope)) 
				RoomLeave(client, scope);
			base.Leave(client, scope);
		}
 /// <summary>
 /// Remove event listener from this observable.
 /// </summary>
 /// <param name="listener">Event listener.</param>
 public virtual void RemoveEventListener(IEventListener listener)
 {
     _listeners.Remove(listener);
     if (!_keepOnDisconnect && ScopeUtils.IsRoom(this) && _listeners.Count == 0)
     {
         // Delete empty rooms
         _parent.RemoveChildScope(this);
     }
 }
Exemple #5
0
		/// <summary>
		/// Adds client to scope. Scope can be both application or room. Can be
		/// applied to both application scope and scopes of lower level.
		/// </summary>
		/// <param name="client">Client object.</param>
		/// <param name="scope">Scope object.</param>
        /// <returns>true to allow, false to deny join.</returns>
		public override bool Join(IClient client, IScope scope) 
		{
			if(!base.Join(client, scope)) 
				return false;
			if(ScopeUtils.IsApplication(scope)) 
				return AppJoin(client, scope);
			else if (ScopeUtils.IsRoom(scope)) 
				return RoomJoin(client, scope);
			else
				return false;
		}
Exemple #6
0
		/// <summary>
		/// Starts scope. Scope can be both application or room level.
		/// </summary>
		/// <param name="scope">Scope object.</param>
		/// <returns>true if scope can be started, false otherwise.</returns>
		public override bool Start(IScope scope) 
		{
			if(!base.Start(scope)) 
				return false;
			if(ScopeUtils.IsApplication(scope)) 
				return AppStart(scope);
			else if (ScopeUtils.IsRoom(scope)) 
				return RoomStart(scope);
			else 
				return false;
		}
 /// <summary>
 /// Returns disconnection result for given scope and parameters.
 /// Whether the scope is room or application level scope, this method distinguishes it and acts accordingly.
 /// </summary>
 /// <param name="connection">Connection object.</param>
 /// <param name="scope">true if disconnect is successful, false otherwise.</param>
 public override void Disconnect(IConnection connection, IScope scope)
 {
     if (ScopeUtils.IsApplication(scope))
     {
         AppDisconnect(connection);
     }
     else if (ScopeUtils.IsRoom(scope))
     {
         RoomDisconnect(connection);
     }
     base.Disconnect(connection, scope);
 }
Exemple #8
0
 public override void Stop(IScope scope)
 {
     if (ScopeUtils.IsApplication(scope))
     {
         this.AppStop(scope);
     }
     else if (ScopeUtils.IsRoom(scope))
     {
         this.RoomStop(scope);
     }
     base.Stop(scope);
 }
Exemple #9
0
 public override bool Start(IScope scope)
 {
     if (!base.Start(scope))
     {
         return(false);
     }
     if (ScopeUtils.IsApplication(scope))
     {
         return(this.AppStart(scope));
     }
     return(ScopeUtils.IsRoom(scope) && this.RoomStart(scope));
 }
Exemple #10
0
 public override bool Join(IClient client, IScope scope)
 {
     if (!base.Join(client, scope))
     {
         return(false);
     }
     if (ScopeUtils.IsApplication(scope))
     {
         return(this.AppJoin(client, scope));
     }
     return(ScopeUtils.IsRoom(scope) && this.RoomJoin(client, scope));
 }
Exemple #11
0
        /// <summary>
        /// Returns connection result for given scope and parameters. 
        /// Whether the scope is room or application level scope, this method distinguishes it and acts accordingly.
        /// </summary>
        /// <param name="connection">Connection object.</param>
        /// <param name="scope">Scope object.</param>
        /// <param name="parameters">List of params passed to connection handler.</param>
        /// <returns>true if connect is successful, false otherwise.</returns>
		public override bool Connect(IConnection connection, IScope scope, object[] parameters)
		{
			if( !base.Connect (connection, scope, parameters) )
				return false;
			bool success = false;
			if(ScopeUtils.IsApplication(scope))
			{
				success = AppConnect(connection, parameters);
			}
			else if (ScopeUtils.IsRoom(scope)) 
			{
				success = RoomConnect(connection, parameters);
			}
			return success;
		}
Exemple #12
0
        public override bool Connect(IConnection connection, IScope scope, object[] parameters)
        {
            if (!base.Connect(connection, scope, parameters))
            {
                return(false);
            }
            bool flag = false;

            if (ScopeUtils.IsApplication(scope))
            {
                flag = this.AppConnect(connection, parameters);
            }
            else if (ScopeUtils.IsRoom(scope))
            {
                flag = this.RoomConnect(connection, parameters);
            }
            return(flag);
        }
 /// <summary>
 /// Adds client to scope. Scope can be both application or room. Can be
 /// applied to both application scope and scopes of lower level.
 /// </summary>
 /// <param name="client">Client object.</param>
 /// <param name="scope">Scope object.</param>
 /// <returns>true to allow, false to deny join.</returns>
 public override bool Join(IClient client, IScope scope)
 {
     if (!base.Join(client, scope))
     {
         return(false);
     }
     if (ScopeUtils.IsApplication(scope))
     {
         return(AppJoin(client, scope));
     }
     else if (ScopeUtils.IsRoom(scope))
     {
         return(RoomJoin(client, scope));
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// Starts scope. Scope can be both application or room level.
 /// </summary>
 /// <param name="scope">Scope object.</param>
 /// <returns>true if scope can be started, false otherwise.</returns>
 public override bool Start(IScope scope)
 {
     if (!base.Start(scope))
     {
         return(false);
     }
     if (ScopeUtils.IsApplication(scope))
     {
         return(AppStart(scope));
     }
     else if (ScopeUtils.IsRoom(scope))
     {
         return(RoomStart(scope));
     }
     else
     {
         return(false);
     }
 }