Beispiel #1
0
        private void ReceiveChannelMessage(IChannel target, IntermediateMessage msg)
        {
            System.Diagnostics.Debug.WriteLine("Irc.ClientConnection.ReceiveChannelMessage({0}, {{ T:{1} S:{2} M:{3} }})", target.IrcName, msg.Type, msg.Sender.IrcNick, msg.Payload);

            if (msg.Type == MessageType.ClientNotice)
            {
                Send(LOCALNICK, "PRIVMSG", target.IrcName, msg.Payload);
                return;
            }

            var payload  = msg.Payload;
            var isAction = false;
            var isEmote  = false;

            if (msg.Payload.StartsWith("/me "))
            {
                isAction = true;
                isEmote  = true;
                payload  = payload.Substring(4);
            }

            if (msg.Type == MessageType.OwnerSay)
            {
                payload = "[OS] " + payload;
            }
            else if (msg.Type == MessageType.ObjectIM)
            {
                payload = "[IM] " + payload;
            }
            else if (msg.Type == MessageType.RegionSay)
            {
                payload = "[RS] " + payload;
            }
            else if (msg.Type == MessageType.Whisper && !isEmote)
            {
                payload  = "whispers: " + payload;
                isAction = true;
            }
            else if (msg.Type == MessageType.Shout && !isEmote)
            {
                payload  = "shouts: " + payload;
                isAction = true;
            }

            if (isAction)
            {
                payload = "\x01" + "ACTION " + payload + "\x01";
            }

            var outmsg = new Irc.Message(msg.Sender.IrcFullId, "PRIVMSG", target.IrcName, payload);

            Send(outmsg);
        }
        private void ReceiveChannelMessage(IChannel target, IntermediateMessage msg)
        {
            System.Diagnostics.Debug.WriteLine("Irc.ClientConnection.ReceiveChannelMessage({0}, {{ T:{1} S:{2} M:{3} }})", target.IrcName, msg.Type, msg.Sender.IrcNick, msg.Payload);

            if(msg.Type == MessageType.ClientNotice)
            {
                Send(LOCALNICK, "PRIVMSG", target.IrcName, msg.Payload);
                return;
            }

            var payload = msg.Payload;
            var isAction = false;
            var isEmote = false;

            if(msg.Payload.StartsWith("/me "))
            {
                isAction = true;
                isEmote = true;
                payload = payload.Substring(4);
            }

            if(msg.Type == MessageType.OwnerSay)
            {
                payload = "[OS] " + payload;
            }
            else if(msg.Type == MessageType.ObjectIM)
            {
                payload = "[IM] " + payload;
            }
            else if (msg.Type == MessageType.RegionSay)
            {
                payload = "[RS] " + payload;
            }
            else if(msg.Type == MessageType.Whisper && !isEmote)
            {
                payload = "whispers: " + payload;
                isAction = true;
            }
            else if(msg.Type == MessageType.Shout && !isEmote)
            {
                payload = "shouts: " + payload;
                isAction = true;
            }

            if(isAction)
            {
                payload = "\x01" + "ACTION " + payload + "\x01";
            }

            var outmsg = new Irc.Message(msg.Sender.IrcFullId, "PRIVMSG", target.IrcName, payload);
            Send(outmsg);
        }