Пример #1
0
 private void Client_MessageRecieved (object sender, MessageRecievedEventArgs e) {
     JacoChatMessage msg = JacoChatMessage.Parse (e.Message);
     switch (msg.JacoChatMessageType) {
         case JacoChatMessageType.PRIVMSG:
             string channel = msg.Channel == nickname ? msg.Sender : msg.Channel;
             checkChannel (channel);
             if (!channel.StartsWith ("#"))
                 channels[channel].ShowNames = false;
             channels[channel].AppendMessage (msg.Sender, msg.Body);
             break;
         case JacoChatMessageType.NAMES:
             checkChannel (msg.Channel);
             channels[msg.Channel].SetNamesList (msg.Body.Trim ().Split (' '));
             break;
         case JacoChatMessageType.NICK:
             checkChannel (msg.Channel);
             channels[msg.Channel].OnChatEvent (ChatEventType.NickChange, msg.Sender, msg.Body);
             break;
         case JacoChatMessageType.JOIN:
             checkChannel (msg.Channel);
             Console.WriteLine ("Join '{0}'", msg.Sender);
             channels[msg.Channel].OnChatEvent (ChatEventType.UserJoin, msg.Sender);
             break;
         case JacoChatMessageType.PART:
             checkChannel (msg.Channel);
             channels[msg.Channel].OnChatEvent (ChatEventType.UserPart, msg.Sender, msg.Body);
             break;
         case JacoChatMessageType.ERROR:
         case JacoChatMessageType.UNKNOWN:
             network.StatusBuffer.AppendRaw (msg.Body);
             break;
     }
 }
Пример #2
0
 protected virtual void OnMessageRecieved(MessageRecievedEventArgs e)
 {
     EventHandler<MessageRecievedEventArgs> handler = MessageRecieved;
     if (handler != null)
         handler(this, e);
 }
Пример #3
0
 static void client_OnMessageRecieved(object sender, MessageRecievedEventArgs e)
 {
     Console.WriteLine(e.Message);
 }