Ejemplo n.º 1
0
        protected virtual void OnPublicActionReceived(User user, string channelName, string Action)
        {
            var publicActionReceived = PublicActionReceived;

            if (publicActionReceived != null)
                publicActionReceived(this, new PublicMessageReceivedEventArgs(user, channelName, Action));
        }
Ejemplo n.º 2
0
        protected virtual void OnPrivateActionReceived(User user, string Action)
        {
            var privateActionReceived = PrivateActionReceived;

            if (privateActionReceived != null)
                privateActionReceived(this, new PrivateMessageReceivedEventArgs(user, Action));
        }
Ejemplo n.º 3
0
        public IUserToken RetrieveToken(User user)
        {
            IUserToken token;

            using (_mutex.AquireReadLock())
            {
                token = CreateUserToken(user);
            }

            return token;
        }
Ejemplo n.º 4
0
        public void HandleSingleTargetMessage(User user, string message)
        {
            IUserToken userToken = UserTokenCache.RetrieveToken(user);
            AuthToken authToken = AuthHandler.Authenticate(userToken);

            Request request = new Request
            {
                RequestFrom = authToken,
                Channel = null,
                Nick = user.NickName,
                RequestType = RequestType.Private,
                Message = message
            };

            CommunicationManager.HandleRequestReceived(request);
        }
Ejemplo n.º 5
0
        public void HandleMultiTargetAction(User user, string channel, string message)
        {
            var userToken = UserTokenCache.RetrieveToken(user);
            var authToken = AuthHandler.Authenticate(userToken);

            var request = new Request
            {
                RequestFrom = authToken,
                Channel = channel,
                Nick = user.NickName,
                RequestSourceType = RequestSourceType.Public,
                RequestType = Communications.RequestType.Action,
                Addressee = user.NickName,
                Message = message
            };

            CommunicationManager.HandleRequestReceived(request);
        }
 public PublicMessageReceivedEventArgs(User user, string channelName, string message)
 {
     User = user;
     ChannelName = channelName;
     Message = message;
 }
Ejemplo n.º 7
0
        void IrcClient_PrivateMessageReceived(object sender, IrcMessageEventArgs e)
        {
            var sourceUser = (IrcUser)e.Source;
            var user = new User
            {
                NickName = sourceUser.NickName,
                HostName = sourceUser.HostName
            };

            OnPrivateMessageReceived(user, e.Text);
        }
Ejemplo n.º 8
0
        void _ctcpClient_ActionReceived(object sender, CtcpMessageEventArgs e)
        {
            var source = e.Source as IrcUser;

            if (source != null)
            {
                var sourceChannel = sender as IrcChannel;

                if (sourceChannel != null)
                {
                    var user = new User
                    {
                        NickName = source.NickName,
                        HostName = source.HostName
                    };

                    OnPublicActionReceived(user, sourceChannel.Name, e.Text);
                }
                else
                {
                    var user = new User
                    {
                        NickName = source.NickName,
                        HostName = source.HostName
                    };

                    OnPrivateActionReceived(user, e.Text);
                }
            }
        }
 public PrivateMessageReceivedEventArgs(User user, string message)
 {
     this.User = user;
     this.Message = message;
 }
Ejemplo n.º 10
0
        void IrcClient_PublicMessageReceived(object sender, IrcMessageEventArgs e)
        {
            var sourceChannel = (IrcChannel)sender;
            var source = e.Source as IrcUser;

            if (source != null)
            {
                if(sourceChannel != null)
                {
                    var sourceUser = source;
                    var user = new User
                    {
                        NickName = sourceUser.NickName,
                        HostName = sourceUser.HostName
                    };

                    if (e.Text.TrimStart().StartsWith("ACTION "))
                    {
                        string message = e.Text.Substring(8);
                        message = message.Substring(0, message.Length-1);

                        OnPublicActionReceived(user, sourceChannel.Name, message);
                    }
                    else
                    {
                        OnPublicMessageReceived(user, sourceChannel.Name, e.Text);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        protected virtual void OnPrivateMessageReceived(User user, string message)
        {
            EventHandler<PrivateMessageReceivedEventArgs> privateMessageReceived = this.PrivateMessageReceived;

            if (privateMessageReceived != null)
                privateMessageReceived(this, new PrivateMessageReceivedEventArgs(user, message));
        }
Ejemplo n.º 12
0
        void _ircClient_OnQueryMessage(object sender, SIRC4N.IrcEventArgs e)
        {
            var user = new User
            {
                NickName = e.Data.Nick,
                HostName = e.Data.Host
            };

            OnPrivateMessageReceived(user, e.Data.Message);
        }
Ejemplo n.º 13
0
 private static IUserToken CreateUserToken(User user)
 {
     return new IrcUserToken(user.NickName, user.HostName);
 }
Ejemplo n.º 14
0
        protected virtual void OnPublicMessageReceived(User user, string channelName, string message)
        {
            EventHandler<PublicMessageReceivedEventArgs> publicMessageReceived = this.PublicMessageReceived;

            if (publicMessageReceived != null)
                publicMessageReceived(this, new PublicMessageReceivedEventArgs(user, channelName, message));
        }
Ejemplo n.º 15
0
        void Listener_OnPublic(UserInfo userInfo, string channel, string message)
        {
            ManualResetEventSlim finishedEvent = new ManualResetEventSlim();

            new Thread(() =>
                {
                    var user = new User
                    {
                        NickName = userInfo.Nick,
                        HostName = userInfo.Hostname
                    };

                    OnPublicMessageReceived(user, channel, message);

                    finishedEvent.Set();
                }) { IsBackground = true }.Start();

            finishedEvent.Wait();
        }
Ejemplo n.º 16
0
        void IrcClient_PublicMessageReceived(object sender, IrcMessageEventArgs e)
        {
            var sourceChannel = (IrcChannel)sender;

            if (e.Source is IrcUser)
            {
                var sourceUser = (IrcUser)e.Source;

                var user = new User
                {
                    NickName = sourceUser.NickName,
                    HostName = sourceUser.HostName
                };

                OnPublicMessageReceived(user, sourceChannel.Name, e.Text);
            }
        }
 public PublicMessageReceivedEventArgs(User user, string channelName, string message)
 {
     this.User = user;
     this.ChannelName = channelName;
     this.Message = message;
 }
Ejemplo n.º 18
0
 public void InvalidateToken(User user)
 {
     InvalidateToken(user.NickName);
 }
Ejemplo n.º 19
0
        void _ircClient_OnChannelMessage(object sender, SIRC4N.IrcEventArgs e)
        {
            var user = new User
            {
                NickName = e.Data.Nick,
                HostName = e.Data.Host
            };

            OnPublicMessageReceived(user, e.Data.Channel, e.Data.Message);
        }
Ejemplo n.º 20
0
        void _ircClient_OnQueryAction(object sender, SIRC4N.ActionEventArgs e)
        {
            var user = new User
            {
                NickName = e.Data.Nick,
                HostName = e.Data.Host
            };

            OnPrivateActionReceived(user, e.Data.Message.Substring(8, e.Data.Message.Length - 9));
        }
Ejemplo n.º 21
0
        void Listener_OnPrivateAction(UserInfo userInfo, string message)
        {
            var finishedEvent = new ManualResetEventSlim();

            new Thread(() =>
            {
                var user = new User
                {
                    NickName = userInfo.Nick,
                    HostName = userInfo.Hostname
                };

                OnPrivateActionReceived(user, message);

                finishedEvent.Set();
            }) { IsBackground = true }.Start();

            finishedEvent.Wait();
        }