示例#1
0
 private void OnNick(object sender, TokenEventArgs e)
 {
     if (NoColon(e.tokens[0]).Substring(0, nickname.Length).Equals(nickname))
     {
         ChangeNick(e.tokens[2]);
         WriteLineA("main", $"<span class=\"info\">* Your nickname is now {nickname}</span>");
     }
 }
示例#2
0
        private void OnPrivMsg(object sender, TokenEventArgs e)
        {
            string channelName = NoColon(e.tokens[2]).Remove(0, 1); // rem #

            if (windows.Contains(channelName))
            {
                WriteLineA(channelName, $"<span class=\"chat_nick\">&lt;{NoColon(e.tokens[0]).Split('!')[0]}&gt;</span> {NoColon(string.Join(" ", e.tokens.Skip(3).ToArray()))}");
                canvas.BeginInvoke(new InvokeDelegate1(ChannelListNotify), channelName);
            }
        }
示例#3
0
 private void OnDefault(object sender, TokenEventArgs e)
 {
     if (!new List <string>()
     {
         "470", "333", "328", "366"
     }.Contains(e.tokens[1]) && e.tokens.Length > 2)
     {
         WriteLineA("main", $"-<span class=\"notice_nick\">Server</span>- {FormatString(e.tokens)}");
     }
 }
示例#4
0
        private void OnQuit(object sender, TokenEventArgs e)
        {
            string nick   = NoColon(e.tokens[0]).Split('!')[0];
            string reason = "";

            if (e.tokens[2] != null)
            {
                reason = NoColon(string.Join(" ", e.tokens.Skip(2).ToArray()));
            }
            canvas.BeginInvoke(new InvokeDelegate(QuittingUser), nick, reason);
        }
示例#5
0
 private void OnMode(object sender, TokenEventArgs e)
 {
     if (e.tokens[2].Equals(nickname))
     {
         WriteLineA("main", $"<span class=\"info\">* {nickname} sets usermode {NoColon(e.tokens[3])}</span>");
     }
     else
     {
         WriteLineA(e.tokens[2].Remove(0, 1), $"<span class=\"info\">* {NoColon(e.tokens[0]).Split('!')[0]} sets mode {string.Join(" ", e.tokens.Skip(3).ToArray())} for #{e.tokens[2].Remove(0, 1)}</span>");
     }
 }
示例#6
0
        private void OnUser(object sender, TokenEventArgs e)
        {
            string channelName = e.tokens[4].Remove(0, 1);

            if (windows.Contains(channelName))
            {
                e.tokens[5] = NoColon(e.tokens[5]);
                foreach (string u in e.tokens.Skip(5).Where(x => !string.IsNullOrEmpty(x)).ToArray())
                {
                    canvas.BeginInvoke(new InvokeDelegate(AddUserToList), channelName, u);
                }
            }
        }
示例#7
0
        private void OnPart(object sender, TokenEventArgs e)
        {
            string nick = NoColon(e.tokens[0]).Split('!')[0];
            string win  = e.tokens[2].Remove(0, 1);

            if (nick.Equals(nickname))
            {
                WriteLineA(win, $"<span class=\"info\">* You have left #{win}</span>");
            }
            else
            {
                canvas.BeginInvoke(new InvokeDelegate(OtherUserParted), nick, win);
            }
        }
示例#8
0
        private void OnJoin(object sender, TokenEventArgs e)
        {
            string channelName = NoColon(e.tokens[2]).Remove(0, 1); // rem #

            if (NoColon(e.tokens[0]).Substring(0, nickname.Length).Equals(nickname))
            {
                windows.Add(channelName);
                canvas.BeginInvoke(new InvokeDelegate1(MakeWindow), channelName);
                WriteLineA(channelName, $"<span class=\"info\">* You have joined #{channelName}</span>");
            }
            else
            if (windows.Contains(channelName))
            {
                string nick = NoColon(e.tokens[0]).Split('!')[0];
                WriteLineA(channelName, $"<span class=\"info\">* {nick} has joined #{channelName}</span>");
                canvas.BeginInvoke(new InvokeDelegate(AddUserToList), channelName, nick);
            }
        }
示例#9
0
 // Events
 private void OnNotice(object sender, TokenEventArgs e)
 {
     WriteLineA("main", $"-<span class=\"notice_nick\">{e.tokens[0].Substring(1)}</span>- {FormatString(e.tokens)}");
 }
示例#10
0
 private void OnTopic(object sender, TokenEventArgs e)
 {
     topics.Add(e.tokens[3].Remove(0, 1), NoColon(string.Join(" ", e.tokens.Skip(4).ToArray())));
 }
示例#11
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaiseTopicEvent(TokenEventArgs e)
 {
     TopicEvent?.Invoke(this, e);
 }
示例#12
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaiseUserEvent(TokenEventArgs e)
 {
     UserEvent?.Invoke(this, e);
 }
示例#13
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaiseDefaultEvent(TokenEventArgs e)
 {
     DefaultEvent?.Invoke(this, e);
 }
示例#14
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaiseJoinEvent(TokenEventArgs e)
 {
     JoinEvent?.Invoke(this, e);
 }
示例#15
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaisePartEvent(TokenEventArgs e)
 {
     PartEvent?.Invoke(this, e);
 }
示例#16
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaiseSocketExceptionEvent(TokenEventArgs e)
 {
     SocketExceptionEvent?.Invoke(this, e);
 }
示例#17
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaiseModeEvent(TokenEventArgs e)
 {
     ModeEvent?.Invoke(this, e);
 }
示例#18
0
 private void OnSocketException(object sender, TokenEventArgs e)
 {
     WriteLineA(e.tokens[0], $"<span class=\"info\">* Could not connect: {e.tokens[1]}</span>");
 }
示例#19
0
文件: IRC.cs 项目: hnjm/IRC-Client
 protected virtual void RaiseNickEvent(TokenEventArgs e)
 {
     NickEvent?.Invoke(this, e);
 }