public void RemoveListener(IXmppListener listener)
        {
            Args.NotNull(listener, "listener");
            RequiresNotListen();

            listeners.Remove(listener);
        }
        public void AddListener(IXmppListener listener)
        {
            Args.NotNull(listener, "listener");
            RequiresNotListen();

            listeners.Add(listener);
        }
Ejemplo n.º 3
0
        public void AddXmppListener(IXmppListener listener)
        {
            lock (syncRoot)
            {
                try
                {
                    if (started)
                    {
                        throw new InvalidOperationException();
                    }
                    if (listener == null)
                    {
                        throw new ArgumentNullException("listener");
                    }

                    listeners.Add(listener.Name, listener);
                    listener.OpenXmppConnection += OpenXmppConnection;

                    log.DebugFormat("Add listener '{0}'", listener.Name);
                }
                catch (Exception e)
                {
                    log.ErrorFormat("Error add listener '{0}': {1}", listener.Name, e);
                    throw;
                }
            }
        }
Ejemplo n.º 4
0
        public TcpXmppConnection(IXmppListener listener, TcpClient client)
        {
            this._listener = listener;
            this._client   = client;
            this._stream   = this._client.GetStream();

            var id = Guid.NewGuid().ToString("D");

            this.Session = new TcpXmppSession(id);
            this._log    = LogManager.GetLogger($"{GetType().Name}/{id}");
        }
Ejemplo n.º 5
0
		public void AddXmppListener(IXmppListener listener)
		{
			lock (syncRoot)
			{
				try
				{
					if (started) throw new InvalidOperationException();
					if (listener == null) throw new ArgumentNullException("listener");

					listeners.Add(listener.Name, listener);
					listener.OpenXmppConnection += OpenXmppConnection;

					log.DebugFormat("Add listener '{0}'", listener.Name);
				}
				catch (Exception e)
				{
					log.ErrorFormat("Error add listener '{0}': {1}", listener.Name, e);
					throw;
				}
			}
		}
Ejemplo n.º 6
0
        public IXmppConnection GetXmppConnection(string connectionId)
        {
            if (string.IsNullOrEmpty(connectionId))
            {
                return(null);
            }

            string        listenerName = null;
            IXmppListener listener     = null;

            lock (syncRoot)
            {
                if (!connectionListenerMap.TryGetValue(connectionId, out listenerName) || listenerName == null)
                {
                    return(null);
                }
                if (!listeners.TryGetValue(listenerName, out listener) || listener == null)
                {
                    return(null);
                }
            }
            return(listener.GetXmppConnection(connectionId));
        }
 public void AddXmppListener(IXmppListener listener)
 {
     gateway.AddXmppListener(listener);
 }
Ejemplo n.º 8
0
		public void AddXmppListener(IXmppListener listener)
		{
			gateway.AddXmppListener(listener);
		}