public ChatMessage(ChatLogControl parent, User user, string xml) { this.parent = parent; this.user = user; stf = StringFormat.GenericTypographic; stf.FormatFlags |= StringFormatFlags.NoClip | StringFormatFlags.NoWrap; stf.FormatFlags |= StringFormatFlags.LineLimit; stf.LineAlignment = StringAlignment.Center; XmlDocument doc = new XmlDocument(); doc.LoadXml("<body>" + xml + "</body>"); XmlElement root = (XmlElement)doc.FirstChild; this.root = new RootPart(this,(XmlElement)root, new Font("Arial", 16)); if (user != null) Nick = user.ID; }
public void UserStateChanged(string roomID,User user,UserState state) { TabPage page = pages [roomID]; ChatControl cht = (ChatControl)page.Controls [0]; cht.UserStateChanged(user,state); }
public void TestControl() { TabPage page = new TabPage (); page.Text = "TestPage"; ChatLogControl log = new ChatLogControl (); log.Dock = DockStyle.Fill; page.Controls.Add (log); User user = new User ("testid"); user.Color = Color.Red; log.AddMessage (new ChatMessage (log,user, "zumindest <b>zeit<i>lich</i></b> gesehen")); log.AddMessage (new ChatMessage (log,user, "haha <b>test<i>5873</i></b> bla")); log.AddMessage(new ChatMessage(log, user, "unformatierter test text bla susch sieht das hier niemals")); AddTabPage (page); }
public TabPage CreateTabPage(User user) { TabPage page = new TabPage (); page.Text = user.ID; return page; }
static void Room_UserStateChanged(Room room, User user, LiveCodingChat.Xmpp.UserState state) { if (user.ID == session.Username) return; if (state == LiveCodingChat.Xmpp.UserState.Available) { System.Timers.Timer tmr = new System.Timers.Timer(); tmr.Interval = 20000; tmr.Elapsed +=delegate { room.SendMessage("Willkommen @" + user.ID + ".Ich bin Adam der Bot dieses Streams. Sprich mich an, wenn du Infos zum Stream brauchst"); userCount++; if (userCount % 3 == 0) { room.SendMessage("@" + user.ID + " ist der " + userCount + " besucher dieses Streams :hi:"); } tmr.Stop(); }; tmr.Start(); } else { userCount--; } }
static void Room_UserStateChanged(Room room, User user, LiveCodingChat.Xmpp.UserState state) { if (state == LiveCodingChat.Xmpp.UserState.Available) { userCount++; } else { userCount--; } if (!isStarted) return; if (user.ID == chatRoom.Client.Nick) return; if (state == LiveCodingChat.Xmpp.UserState.Available) { System.Timers.Timer tmr = new System.Timers.Timer(); tmr.Interval = 20000; tmr.Elapsed +=delegate { if (welcomeUser.Count != 0) for (int i = 0; i < welcomeUser.Count; i++) if (Convert.ToInt32(welcomeUser[i].Remove(0, welcomeUser[i].Length - 3)) <= stopWatch.Elapsed.Minutes - timeToSayHelloAgainInMinutes) welcomeUser.Remove(welcomeUser[i]); if (!welcomeUser.Exists(t => t.Substring(0, t.Length - 3) == user.ID.ToLower())) { room.SendMessage("Willkommen @" + user.ID + ".Ich bin Adam der Bot dieses Streams. Sprich mich an, wenn du Infos zum Stream brauchst"); welcomeUser.Add(user.ID.ToLower() + stopWatch.Elapsed.Minutes.ToString("000")); } if (userCount % 10 == 0) { room.SendMessage("@" + user.ID + " ist der " + userCount + " besucher dieses Streams :hi:"); } tmr.Stop(); }; tmr.Start(); } }