コード例 #1
0
ファイル: IrcClientBase.cs プロジェクト: KAmaia/SpikeLite
        protected virtual void OnPublicActionReceived(User user, string channelName, string Action)
        {
            var publicActionReceived = PublicActionReceived;

            if (publicActionReceived != null)
                publicActionReceived(this, new PublicMessageReceivedEventArgs(user, channelName, Action));
        }
コード例 #2
0
ファイル: IrcClientBase.cs プロジェクト: KAmaia/SpikeLite
        protected virtual void OnPrivateActionReceived(User user, string Action)
        {
            var privateActionReceived = PrivateActionReceived;

            if (privateActionReceived != null)
                privateActionReceived(this, new PrivateMessageReceivedEventArgs(user, Action));
        }
コード例 #3
0
ファイル: UserTokenCache.cs プロジェクト: KAmaia/SpikeLite
        public IUserToken RetrieveToken(User user)
        {
            IUserToken token;

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

            return token;
        }
コード例 #4
0
ファイル: PrivmsgParser.cs プロジェクト: pjmagee/SpikeLite
        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);
        }
コード例 #5
0
ファイル: PrivmsgParser.cs プロジェクト: KAmaia/SpikeLite
        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);
        }
コード例 #6
0
 public PublicMessageReceivedEventArgs(User user, string channelName, string message)
 {
     User = user;
     ChannelName = channelName;
     Message = message;
 }
コード例 #7
0
ファイル: IrcClient.cs プロジェクト: KAmaia/SpikeLite
        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);
        }
コード例 #8
0
ファイル: IrcClient.cs プロジェクト: KAmaia/SpikeLite
        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);
                }
            }
        }
コード例 #9
0
 public PrivateMessageReceivedEventArgs(User user, string message)
 {
     this.User = user;
     this.Message = message;
 }
コード例 #10
0
ファイル: IrcClient.cs プロジェクト: KAmaia/SpikeLite
        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);
                    }
                }
            }
        }
コード例 #11
0
ファイル: IrcClientBase.cs プロジェクト: pjmagee/SpikeLite
        protected virtual void OnPrivateMessageReceived(User user, string message)
        {
            EventHandler<PrivateMessageReceivedEventArgs> privateMessageReceived = this.PrivateMessageReceived;

            if (privateMessageReceived != null)
                privateMessageReceived(this, new PrivateMessageReceivedEventArgs(user, message));
        }
コード例 #12
0
ファイル: IrcClient.cs プロジェクト: KAmaia/SpikeLite
        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);
        }
コード例 #13
0
ファイル: UserTokenCache.cs プロジェクト: KAmaia/SpikeLite
 private static IUserToken CreateUserToken(User user)
 {
     return new IrcUserToken(user.NickName, user.HostName);
 }
コード例 #14
0
ファイル: IrcClientBase.cs プロジェクト: pjmagee/SpikeLite
        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));
        }
コード例 #15
0
ファイル: IrcClient.cs プロジェクト: pjmagee/SpikeLite
        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();
        }
コード例 #16
0
ファイル: IrcClient.cs プロジェクト: pjmagee/SpikeLite
        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);
            }
        }
コード例 #17
0
 public PublicMessageReceivedEventArgs(User user, string channelName, string message)
 {
     this.User = user;
     this.ChannelName = channelName;
     this.Message = message;
 }
コード例 #18
0
ファイル: UserTokenCache.cs プロジェクト: KAmaia/SpikeLite
 public void InvalidateToken(User user)
 {
     InvalidateToken(user.NickName);
 }
コード例 #19
0
ファイル: IrcClient.cs プロジェクト: KAmaia/SpikeLite
        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);
        }
コード例 #20
0
ファイル: IrcClient.cs プロジェクト: KAmaia/SpikeLite
        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));
        }
コード例 #21
0
ファイル: IrcClient.cs プロジェクト: KAmaia/SpikeLite
        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();
        }