Exemplo n.º 1
0
 private void RoomMessage(frmChat frm,string roomID,LiveCodingChat.Xmpp.MessageReceivedEventArgs e)
 {
     if (frm.InvokeRequired)
     {
         frm.Invoke(new MethodInvoker(delegate() { RoomMessage(frm,roomID, e); }));
         return;
     }
     frm.Activate();
     frm.AddMessage(roomID,e);
 }
Exemplo n.º 2
0
 public void AddMessage(string roomID,LiveCodingChat.Xmpp.MessageReceivedEventArgs e)
 {
     TabPage page = pages [roomID];
     ChatControl cht = (ChatControl)page.Controls [0];
     cht.AddMessage (e);
 }
Exemplo n.º 3
0
 public void AddMessage(LiveCodingChat.Xmpp.MessageReceivedEventArgs e)
 {
     int tab = 0;
     ChatControl cht = (ChatControl)tabControl.TabPages [tab].Controls [0];
     cht.AddMessage (e);
 }
Exemplo n.º 4
0
 private void RoomStateChanged(frmChat frm,LiveCodingChat.Xmpp.Room room, LiveCodingChat.User user, LiveCodingChat.Xmpp.UserState state)
 {
     if (frm.InvokeRequired)
     {
         frm.Invoke(new MethodInvoker(delegate () { RoomStateChanged(frm, room,user,state); }));
         return;
     }
     frm.UserStateChanged(room.ID,user, state);
 }
Exemplo n.º 5
0
 private void Room_UserStateChanged(LiveCodingChat.Xmpp.Room room, LiveCodingChat.User user, LiveCodingChat.Xmpp.UserState state)
 {
     if (channels.ContainsKey(room.ID))
     {
         RoomStateChanged(channels[room.ID], room,user,state);
     }
 }
Exemplo n.º 6
0
        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--;
            }
        }
Exemplo n.º 7
0
 void Room_Client_MessageReceived(LiveCodingChat.Xmpp.Room room, LiveCodingChat.Xmpp.MessageReceivedEventArgs e)
 {
     if (channels.ContainsKey (room.ID)) {
         RoomMessage(channels[room.ID],room.ID,e);
     }
 }
Exemplo n.º 8
0
        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 (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 == session.Username)
                return;
            if (fnd.Contains(session.Username) || fnd.Contains("adam"))
            {
                room.SendMessage("@" + e.Nick + ": Hier wird OctoAwesome entwickelt. Mehr Infos unter http://www.octoawesome.net");
            }
        }
Exemplo n.º 9
0
        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();
            }
        }
Exemplo n.º 10
0
        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;
                }
            }
        }
Exemplo n.º 11
0
 public void AddMessage(LiveCodingChat.Xmpp.MessageReceivedEventArgs e)
 {
     txtChatLog.AppendText ("[" + e.TimeStamp.ToString () + "]" + e.Nick + ": " + e.Message + "\r\n");
     txtChatLog.ScrollToCaret ();
 }
Exemplo n.º 12
0
 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;
     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 ();
     }
 }