예제 #1
0
 void OnError(object sender, ErrorEventArgs e)
 {
     // Ignore any errors that happen during disconnect
     if (connectionStatus != ChatConnectionStatus.Disconnecting)
     {
         connectionStatus = ChatConnectionStatus.Error;
         AddNotification("Error: " + e.ErrorMessage);
     }
 }
예제 #2
0
        void OnChannelActiveSynced(object sender, IrcEventArgs e)
        {
            channel = client.GetChannel(e.Data.Channel);
            AddNotification("{0} users online".F(channel.Users.Count));
            connectionStatus = ChatConnectionStatus.Joined;

            foreach (DictionaryEntry user in channel.Users)
            {
                var u = (ChannelUser)user.Value;
                Game.RunAfterTick(() => Users.Add(u.Nick, new ChatUser(u.Nick, u.IsOp, u.IsVoice)));
            }
        }
예제 #3
0
        void OnDisconnected(object sender, EventArgs e)
        {
            Game.RunAfterTick(Users.Clear);

            // Keep the chat window open if there is an error
            // It will be cleared by the Disconnect button
            if (connectionStatus != ChatConnectionStatus.Error)
            {
                Game.RunAfterTick(History.Clear);
                topic            = null;
                connectionStatus = ChatConnectionStatus.Disconnected;
            }
        }
예제 #4
0
 void OnKick(object sender, KickEventArgs e)
 {
     if (e.Whom == client.Nickname)
     {
         Disconnect();
         connectionStatus = ChatConnectionStatus.Error;
         AddNotification("You were kicked from the chat by {0}. ({1})".F(e.Who, e.KickReason));
     }
     else
     {
         Users.Remove(e.Whom);
         AddNotification("{0} was kicked from the chat by {1}. ({2})".F(e.Whom, e.Who, e.KickReason));
     }
 }
예제 #5
0
        void OnConnected(object sender, EventArgs e)
        {
            AddNotification("Connected.");
            connectionStatus = ChatConnectionStatus.Connected;

            // Guard against settings.yaml modification
            var nick = SanitizedName(Game.Settings.Chat.Nickname);

            if (nick != Game.Settings.Chat.Nickname)
            {
                Game.RunAfterTick(() => Game.Settings.Chat.Nickname = nick);
            }

            client.Login(nick, "in-game IRC client", 0, "OpenRA");
            client.RfcJoin("#" + Game.Settings.Chat.Channel);
        }
예제 #6
0
 void OnConnecting(object sender, EventArgs e)
 {
     AddNotification("Connecting to {0}:{1}...".F(Game.Settings.Chat.Hostname, Game.Settings.Chat.Port));
     connectionStatus = ChatConnectionStatus.Connecting;
 }
예제 #7
0
 void OnKick(object sender, KickEventArgs e)
 {
     if (e.Whom == client.Nickname)
     {
         Disconnect();
         connectionStatus = ChatConnectionStatus.Error;
         AddNotification("You were kicked from the chat by {0}. ({1})".F(e.Who, e.KickReason));
     }
     else
     {
         Users.Remove(e.Whom);
         AddNotification("{0} was kicked from the chat by {1}. ({2})".F(e.Whom, e.Who, e.KickReason));
     }
 }
예제 #8
0
 void OnError(object sender, ErrorEventArgs e)
 {
     // Ignore any errors that happen during disconnect
     if (connectionStatus != ChatConnectionStatus.Disconnecting)
     {
         connectionStatus = ChatConnectionStatus.Error;
         AddNotification("Error: " + e.ErrorMessage);
     }
 }
예제 #9
0
 void OnDisconnecting(object sender, EventArgs e)
 {
     if (connectionStatus != ChatConnectionStatus.Error)
         connectionStatus = ChatConnectionStatus.Disconnecting;
 }
예제 #10
0
 void OnConnecting(object sender, EventArgs e)
 {
     AddNotification("Connecting to {0}:{1}...".F(Game.Settings.Chat.Hostname, Game.Settings.Chat.Port));
     connectionStatus = ChatConnectionStatus.Connecting;
 }
예제 #11
0
        void OnConnected(object sender, EventArgs e)
        {
            AddNotification("Connected.");
            connectionStatus = ChatConnectionStatus.Connected;

            // Guard against settings.yaml modification
            var nick = SanitizedName(Game.Settings.Chat.Nickname);
            if (nick != Game.Settings.Chat.Nickname)
                Game.RunAfterTick(() => Game.Settings.Chat.Nickname = nick);

            client.Login(nick, "in-game IRC client", 0, "OpenRA");
            client.RfcJoin("#" + Game.Settings.Chat.Channel);
        }
예제 #12
0
        void OnChannelActiveSynced(object sender, IrcEventArgs e)
        {
            channel = client.GetChannel(e.Data.Channel);
            AddNotification("{0} users online".F(channel.Users.Count));
            connectionStatus = ChatConnectionStatus.Joined;

            foreach (DictionaryEntry user in channel.Users)
            {
                var u = (ChannelUser)user.Value;
                Game.RunAfterTick(() => Users.Add(u.Nick, new ChatUser(u.Nick, u.IsOp, u.IsVoice)));
            }
        }
예제 #13
0
        public void Disconnect()
        {
            // Error is an alias for disconnect, but keeps the panel open
            // so that clients can see the error
            if (connectionStatus == ChatConnectionStatus.Error)
            {
                Game.RunAfterTick(History.Clear);
                topic = null;
                connectionStatus = ChatConnectionStatus.Disconnected;
            }
            else
                connectionStatus = ChatConnectionStatus.Disconnecting;

            if (!client.IsConnected)
                return;

            client.RfcQuit(Game.Settings.Chat.QuitMessage);

            AddNotification("Disconnecting from {0}...".F(client.Address));

            Game.RunAfterTick(() => Game.Settings.Chat.ConnectAutomatically = false);
        }
예제 #14
0
        public void Connect()
        {
            if (client.IsConnected)
                return;

            new Thread(() =>
            {
                try
                {
                    client.Connect(Game.Settings.Chat.Hostname, Game.Settings.Chat.Port);
                }
                catch (Exception e)
                {
                    connectionStatus = ChatConnectionStatus.Error;
                    AddNotification(e.Message);
                    Game.RunAfterTick(() => Log.Write("irc", e.ToString()));

                    return;
                }

                client.Listen();
            }) { Name = "IrcListenThread", IsBackground = true }.Start();
        }
예제 #15
0
		void OnKick(object sender, KickEventArgs e)
		{
			Disconnect();
			connectionStatus = ChatConnectionStatus.Error;
			AddNotification("Error: You were kicked from the chat by {0}".F(e.Who));
		}
예제 #16
0
        void OnDisconnected(object sender, EventArgs e)
        {
            Game.RunAfterTick(Users.Clear);

            // Keep the chat window open if there is an error
            // It will be cleared by the Disconnect button
            if (connectionStatus != ChatConnectionStatus.Error)
            {
                Game.RunAfterTick(History.Clear);
                topic = null;
                connectionStatus = ChatConnectionStatus.Disconnected;
            }
        }
예제 #17
0
 void OnKick(object sender, KickEventArgs e)
 {
     Disconnect();
     connectionStatus = ChatConnectionStatus.Error;
     AddNotification("Error: You were kicked from the chat by {0}".F(e.Who));
 }