示例#1
0
 private void SentChannelMessages(Server server, Channel channel, string message)
 {
     if (this.InvokeRequired)
     {
         setChannelCallback s = new setChannelCallback(SentChannelMessages);
         this.Invoke(s,new object[] {server,channel,message});
     }
     else
     {
         this.PrintToChatWindow(server, message);
     }
 }
示例#2
0
 private void JoinedChannel(Server server,Channel channel)
 {
     TreeNode newChannel = new TreeNode();
         newChannel.Name = "channelNode_"+ channel.Name;
         newChannel.Text = channel.Name;
         TreeNode[] serverNode = this.ChannelList.Nodes.Find("serverNode_" + server.Name, false);
         serverNode[0].Nodes.Add(newChannel);
         this.SelectChannelListNode(newChannel);
 }
示例#3
0
 private void ReceivedChannelCommands(Server server, Channel channel, string message)
 {
     if (this.InvokeRequired)
     {
         setChannelCallback s = new setChannelCallback(ReceivedChannelCommands);
         this.Invoke(s, new object[] { server, channel, message });
     }
     else
     {
         switch (message)
         {
             case "NAMES": this.UserBox.DataSource = channel.NickNames; break;
             case "JOIN": this.UserBox.DataSource = channel.NickNames; break;
             case "TOPIC": this.ChannelTitle.Text = channel.Title; break;
         }
     }
 }
示例#4
0
 private void SentChannelCommands(Server server, Channel channel, string message)
 {
     if (this.InvokeRequired)
     {
         setChannelCallback s = new setChannelCallback(SentChannelCommands);
         this.Invoke(s, new object[] { server, channel, message });
     }
     else
     {
         switch (message)
         {
             case "JOIN": this.JoinedChannel(server, channel); break;
             case "PART": this.LeftChannel(server, channel); break;
             //default: this.ChatWindow.AppendText(message + " \n"); break;
         }
     }
 }
示例#5
0
 private void LeftChannel(Server server, Channel channel)
 {
     TreeNode[] serverNode = this.ChannelList.Nodes.Find("serverNode_" + server.Name, false);
     TreeNode[] channelNode = serverNode[0].Nodes.Find("channelNode_" + channel.Name, false);
     serverNode[0].Nodes.Remove(channelNode[0]);
 }
示例#6
0
文件: Server.cs 项目: taftse/OpenIRCC
 public void SentChannelMessages(Channel channel,string message)
 {
     if (this.selectedChannel == channel.Name)
     {
         if (this.ChannelSentMessages != null)
         {
             this.ChannelSentMessages(this, channel, message.Trim());
         }
     }
 }
示例#7
0
文件: Server.cs 项目: taftse/OpenIRCC
 public void SentChannelCommands(Channel channel, string message)
 {
     if (this.selectedChannel == channel.Name)
     {
         if (this.ChannelSentCommands != null)
         {
             this.ChannelSentCommands(this, channel, message);
         }
     }
 }
示例#8
0
文件: Server.cs 项目: taftse/OpenIRCC
 /**
  * for when the client joins a channel
  */
 public void JoinChannel(string channelName)
 {
     this.SendCommand("JOIN",channelName);
        Channel joinedChannel = new Channel(this,channelName);
        this.connectedChannels.Add(channelName,joinedChannel);
        //if (this.ChannelEvent != null) { this.ChannelEvent(this, joinedChannel, "JOIN"); }
        if (this.ChannelSentCommands != null)
        {
        this.ChannelSentCommands(this, joinedChannel, "JOIN");
        }
 }
示例#9
0
文件: Server.cs 项目: taftse/OpenIRCC
        public void Connect(string host, int port, string username, string name, string password, string nickname)
        {
            hostNameParts = new string[host.Split('.').Length];
            hostNameParts = host.Split('.');
            this.serverChannel = new Channel(this, hostNameParts[1]);
            this.host = host;
            this.port = port;
            this.username = username;
            this.nickname = nickname;
            if (name == null) { this.name = hostNameParts[1]; } else { this.name = name; }
            this.password = password;
            this.connection = new TcpClient(this.host, this.port);

            if (this.ServerCommandsSent != null) { this.ServerCommandsSent(this, "CONNECT"); }

            this.reader = new StreamReader(this.connection.GetStream());
            this.writer = new StreamWriter(this.connection.GetStream());
            this.Authenticate();
            this.isConnected = true;
            this.Listen();
        }