public void AddMessage(string roomID, LiveCodingChat.Xmpp.MessageReceivedEventArgs e) { TabPage page = pages [roomID]; ChatControl cht = (ChatControl)page.Controls [0]; cht.AddMessage(e); }
public void AddMessage(LiveCodingChat.Xmpp.MessageReceivedEventArgs e) { ChatMessage msg = new ChatMessage(chatLog, e.User, e.Message); if (e.User == null) { msg.Nick = e.Nick; } msg.TimeStamp = "[" + e.TimeStamp.ToString() + "]"; chatLog.AddMessage(msg); //txtChatLog.AppendText ("[" + e.TimeStamp.ToString () + "]" + e.Nick + ": " + e.Message + "\r\n"); //txtChatLog.ScrollToCaret (); }
static void Room_Client_MessageReceived(LiveCodingChat.Xmpp.Room room, LiveCodingChat.Xmpp.MessageReceivedEventArgs e) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(e.Nick + ": " + e.Message); Console.ForegroundColor = ConsoleColor.White; if (!isStarted) { return; } if (e.User == null) { return; } string fnd = e.Message.ToLower(); System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("NE[E]*I[I]*N TO[O]*M NE[E]*I[I]*N"); if (fnd.Contains("@tom") || fnd.Contains("@bobstriker") || r.IsMatch(fnd.ToUpper())) { if (player == null) { System.Media.SystemSounds.Exclamation.Play(); } else { player.Play(); } } if (e.User.ID == chatRoom.Client.Nick || e.User.ID == "octobot")//TODO email->nick/username { return; } if (fnd.Contains(chatRoom.Client.Nick) || fnd.Contains("adam")) { room.SendMessage("@" + e.Nick + ": Hier wird OctoAwesome entwickelt. Mehr Infos unter http://www.octoawesome.net"); } if (e.Nick == "jvbsl" || e.User.Staff || e.User.Role == "moderator") { if (fnd.StartsWith("/strawpoll ")) { string[] args = e.Message.Substring("/strawpoll ".Length).Split(','); Strawpoll poll = new Strawpoll(args); string pollRes = poll.CreatePoll(); if (pollRes != null) { room.SendMessage("Neuer Poll - " + args[0] + ": " + pollRes); } } } if (fnd.Contains("kopfoderzahl?")) { byte b = Convert.ToByte(rnd.Next(0, 2)); switch (b) { case 0: room.SendMessage("@" + e.Nick + " Kopf"); break; case 1: room.SendMessage("@" + e.Nick + " Zahl"); break; } } }