예제 #1
0
 internal BanEventArgs(IrcMessageData data, string channel, string who, string hostmask)
     : base(data)
 {
     _Channel = channel;
     _Who = who;
     _Hostmask = hostmask;
 }
예제 #2
0
 internal ErrorEventArgs(IrcMessageData data, string errormsg)
     : base(data)
 {
     _ErrorMessage = errormsg;
 }
예제 #3
0
 internal MotdEventArgs(IrcMessageData data, string motdmsg) : base(data)
 {
     _MotdMessage = motdmsg;
 }
예제 #4
0
 internal ErrorEventArgs(IrcMessageData data, string errormsg) : base(data)
 {
     _ErrorMessage = errormsg;
 }
예제 #5
0
 internal TopicChangeEventArgs(IrcMessageData data, string channel, string who, string newtopic) : base(data)
 {
     _Channel  = channel;
     _Who      = who;
     _NewTopic = newtopic;
 }
예제 #6
0
        public IrcMessageData MessageParser(string rawline)
        {
            string line;
            string[] linear;
            string messagecode;
            string from;
            string nick = null;
            string ident = null;
            string host = null;
            string channel = null;
            string message = null;
            ReceiveType type;
            ReplyCode replycode;
            int exclamationpos;
            int atpos;
            int colonpos;

            if (rawline[0] == ':') {
                line = rawline.Substring(1);
            }
            else {
                line = rawline;
            }

            linear = line.Split(new char[] { ' ' });

            // conform to RFC 2812
            from = linear[0];
            messagecode = linear[1];
            exclamationpos = from.IndexOf("!");
            atpos = from.IndexOf("@");
            colonpos = line.IndexOf(" :");
            if (colonpos != -1) {
                // we want the exact position of ":" not beginning from the space
                colonpos += 1;
            }
            if (exclamationpos != -1) {
                nick = from.Substring(0, exclamationpos);
            }
            if ((atpos != -1) &&
                (exclamationpos != -1)) {
                ident = from.Substring(exclamationpos + 1, (atpos - exclamationpos) - 1);
            }
            if (atpos != -1) {
                host = from.Substring(atpos + 1);
            }

            try {
                replycode = (ReplyCode)int.Parse(messagecode);
            } catch (FormatException) {
                replycode = ReplyCode.Null;
            }
            type = _GetMessageType(rawline);
            if (colonpos != -1) {
                message = line.Substring(colonpos + 1);
            }

            switch (type) {
                case ReceiveType.Join:
                case ReceiveType.Kick:
                case ReceiveType.Part:
                case ReceiveType.TopicChange:
                case ReceiveType.ChannelModeChange:
                case ReceiveType.ChannelMessage:
                case ReceiveType.ChannelAction:
                case ReceiveType.ChannelNotice:
                    channel = linear[2];
                    break;
                case ReceiveType.Who:
                case ReceiveType.Topic:
                case ReceiveType.Invite:
                case ReceiveType.BanList:
                case ReceiveType.ChannelMode:
                    channel = linear[3];
                    break;
                case ReceiveType.Name:
                    channel = linear[4];
                    break;
            }

            if ((channel != null) &&
                (channel[0] == ':')) {
                channel = channel.Substring(1);
            }

            IrcMessageData data;
            data = new IrcMessageData(this, from, nick, ident, host, channel, message, rawline, type, replycode);
            #if LOG4NET
            Logger.MessageParser.Debug("IrcMessageData "+
                                       "nick: '"+data.Nick+"' "+
                                       "ident: '"+data.Ident+"' "+
                                       "host: '"+data.Host+"' "+
                                       "type: '"+data.Type.ToString()+"' "+
                                       "from: '"+data.From+"' "+
                                       "channel: '"+data.Channel+"' "+
                                       "message: '"+data.Message+"' "
                                       );
            #endif
            return data;
        }
예제 #7
0
 internal TopicChangeEventArgs(IrcMessageData data, string channel, string who, string newtopic)
     : base(data)
 {
     _Channel = channel;
     _Who = who;
     _NewTopic = newtopic;
 }
예제 #8
0
 internal NickChangeEventArgs(IrcMessageData data, string oldnick, string newnick)
     : base(data)
 {
     _OldNickname = oldnick;
     _NewNickname = newnick;
 }
예제 #9
0
        private void _Event_MODE(IrcMessageData ircdata)
        {
            if (IsMe(ircdata.RawMessageArray[2])) {
                // my user mode changed
                _Usermode = ircdata.RawMessageArray[3].Substring(1);
            }
            else {
                // channel mode changed
                string mode = ircdata.RawMessageArray[3];
                string parameter = String.Join(" ", ircdata.RawMessageArray, 4, ircdata.RawMessageArray.Length - 4);
                _InterpretChannelMode(ircdata, mode, parameter);
            }

            if ((ircdata.Type == ReceiveType.UserModeChange) &&
                (OnUserModeChange != null)) {
                OnUserModeChange(this, new IrcEventArgs(ircdata));
            }

            if ((ircdata.Type == ReceiveType.ChannelModeChange) &&
                (OnChannelModeChange != null)) {
                OnChannelModeChange(this, new IrcEventArgs(ircdata));
            }

            if (OnModeChange != null) {
                OnModeChange(this, new IrcEventArgs(ircdata));
            }
        }
예제 #10
0
        private void _Event_KICK(IrcMessageData ircdata)
        {
            string channel = ircdata.Channel;
            string who = ircdata.Nick;
            string whom = ircdata.RawMessageArray[3];
            string reason = ircdata.Message;

            if (IsMe(whom)) {
                _JoinedChannels.Remove(channel);
            }

            if (ActiveChannelSyncing) {
                if (IsMe(whom)) {
                    _Channels.Remove(channel);
                }
                else {
                    _RemoveChannelUser(channel, whom);
                    _RemoveIrcUser(whom);
                }
            }

            if (OnKick != null) {
                OnKick(this, new KickEventArgs(ircdata, channel, who, whom, reason));
            }
        }
예제 #11
0
        private void _Event_JOIN(IrcMessageData ircdata)
        {
            string who = ircdata.Nick;
            string channelname = ircdata.Channel;

            if (IsMe(who)) {
                _JoinedChannels.Add(channelname);
            }

            if (ActiveChannelSyncing) {
                Channel channel;
                if (IsMe(who)) {
                    // we joined the channel
            #if LOG4NET
                    Logger.ChannelSyncing.Debug("joining channel: "+channelname);
            #endif
                    if (SupportNonRfc) {
                        channel = new NonRfcChannel(channelname);
                    }
                    else {
                        channel = new Channel(channelname);
                    }
                    _Channels.Add(channelname, channel);
                    // request channel mode
                    RfcMode(channelname);
                    // request wholist
                    RfcWho(channelname);
                    // request banlist
                    Ban(channelname);
                }
                else {
                    // someone else joined the channel
                    // request the who data
                    RfcWho(who);
                }

            #if LOG4NET
                Logger.ChannelSyncing.Debug(who+" joins channel: "+channelname);
            #endif
                channel = GetChannel(channelname);
                IrcUser ircuser = GetIrcUser(who);

                if (ircuser == null) {
                    ircuser = new IrcUser(who, this);
                    ircuser.Ident = ircdata.Ident;
                    ircuser.Host = ircdata.Host;
                    _IrcUsers.Add(who, ircuser);
                }

                ChannelUser channeluser;
                if (SupportNonRfc) {
                    channeluser = new NonRfcChannelUser(channelname, ircuser);
                }
                else {
                    channeluser = new ChannelUser(channelname, ircuser);
                }
                channel.UnsafeUsers.Add(who, channeluser);
            }

            if (OnJoin != null) {
                OnJoin(this, new JoinEventArgs(ircdata, channelname, who));
            }
        }
예제 #12
0
        private void _Event_INVITE(IrcMessageData ircdata)
        {
            string channel = ircdata.Channel;
            string inviter = ircdata.Nick;

            if (OnInvite != null) {
                OnInvite(this, new InviteEventArgs(ircdata, channel, inviter));
            }
        }
예제 #13
0
        private void _Event_ERR_NICKNAMEINUSE(IrcMessageData ircdata)
        {
            #if LOG4NET
            Logger.Connection.Warn("nickname collision detected, changing nickname");
            #endif
            string nickname;
            Random rand = new Random();
            int number = rand.Next();
            if (Nickname.Length > 5) {
                nickname = Nickname.Substring(0, 5) + number;
            }
            else {
                nickname = Nickname.Substring(0, Nickname.Length - 1) + number;
            }

            RfcNick(nickname, Priority.Critical);
        }
예제 #14
0
        private void _Event_ERROR(IrcMessageData ircdata)
        {
            string message = ircdata.Message;
            #if LOG4NET
            Logger.Connection.Info("received ERROR from IRC server");
            #endif

            if (OnError != null) {
                OnError(this, new ErrorEventArgs(ircdata, message));
            }
        }
예제 #15
0
 private void _Event_ERR(IrcMessageData ircdata)
 {
     if (OnErrorMessage != null) {
         OnErrorMessage(this, new IrcEventArgs(ircdata));
     }
 }
예제 #16
0
 internal KickEventArgs(IrcMessageData data, string channel, string who, string whom, string kickreason)
     : base(data)
 {
     _Channel = channel;
     _Who = who;
     _Whom = whom;
     _KickReason = kickreason;
 }
예제 #17
0
 internal MotdEventArgs(IrcMessageData data, string motdmsg)
     : base(data)
 {
     _MotdMessage = motdmsg;
 }
예제 #18
0
        private void _Event_NICK(IrcMessageData ircdata)
        {
            string oldnickname = ircdata.Nick;
            string newnickname = ircdata.Message;

            if (IsMe(ircdata.Nick)) {
                _Nickname = newnickname;
            }

            if (ActiveChannelSyncing) {
                IrcUser ircuser = GetIrcUser(oldnickname);

                // if we don't have any info about him, don't update him!
                // (only queries or ourself in no channels)
                if (ircuser != null) {
                    string[] joinedchannels = ircuser.JoinedChannels;

                    // update his nickname
                    ircuser.Nick = newnickname;
                    // remove the old entry
                    // remove first to avoid duplication, Foo -> foo
                    _IrcUsers.Remove(oldnickname);
                    // add him as new entry and new nickname as key
                    _IrcUsers.Add(newnickname, ircuser);
            #if LOG4NET
                    Logger.ChannelSyncing.Debug("updated nickname of: "+oldnickname+" to: "+newnickname);
            #endif
                    // now the same for all channels he is joined
                    Channel channel;
                    ChannelUser channeluser;
                    foreach (string channelname in joinedchannels) {
                        channel = GetChannel(channelname);
                        channeluser = GetChannelUser(channelname, oldnickname);
                        // remove first to avoid duplication, Foo -> foo
                        channel.UnsafeUsers.Remove(oldnickname);
                        channel.UnsafeUsers.Add(newnickname, channeluser);
                        if (channeluser.IsOp) {
                            channel.UnsafeOps.Remove(oldnickname);
                            channel.UnsafeOps.Add(newnickname, channeluser);
                        }
                        if (SupportNonRfc && ((NonRfcChannelUser)channeluser).IsHalfop) {
                            NonRfcChannel nchannel = (NonRfcChannel)channel;
                            nchannel.UnsafeHalfops.Remove(oldnickname);
                            nchannel.UnsafeHalfops.Add(newnickname, channeluser);
                        }
                        if (channeluser.IsVoice) {
                            channel.UnsafeVoices.Remove(oldnickname);
                            channel.UnsafeVoices.Add(newnickname, channeluser);
                        }
                    }
                }
            }

            if (OnNickChange != null) {
                OnNickChange(this, new NickChangeEventArgs(ircdata, oldnickname, newnickname));
            }
        }
예제 #19
0
 internal PingEventArgs(IrcMessageData data, string pingdata)
     : base(data)
 {
     _PingData = pingdata;
 }
예제 #20
0
 private void _Event_NOTICE(IrcMessageData ircdata)
 {
     switch (ircdata.Type) {
         case ReceiveType.ChannelNotice:
             if (OnChannelNotice != null) {
                 OnChannelNotice(this, new IrcEventArgs(ircdata));
             }
             break;
         case ReceiveType.QueryNotice:
             if (OnQueryNotice != null) {
                 OnQueryNotice(this, new IrcEventArgs(ircdata));
             }
             break;
         case ReceiveType.CtcpReply:
             if (OnCtcpReply != null) {
                 OnCtcpReply(this, new IrcEventArgs(ircdata));
             }
             break;
     }
 }
예제 #21
0
 internal TopicEventArgs(IrcMessageData data, string channel, string topic)
     : base(data)
 {
     _Channel = channel;
     _Topic = topic;
 }
예제 #22
0
        private void _Event_PART(IrcMessageData ircdata)
        {
            string who = ircdata.Nick;
            string channel = ircdata.Channel;
            string partmessage = ircdata.Message;

            if (IsMe(who)) {
                _JoinedChannels.Remove(channel);
            }

            if (ActiveChannelSyncing) {
                if (IsMe(who)) {
            #if LOG4NET
                    Logger.ChannelSyncing.Debug("parting channel: "+channel);
            #endif
                    _Channels.Remove(channel);
                }
                else {
            #if LOG4NET
                    Logger.ChannelSyncing.Debug(who+" parts channel: "+channel);
            #endif
                    _RemoveChannelUser(channel, who);
                    _RemoveIrcUser(who);
                }
            }

            if (OnPart != null) {
                OnPart(this, new PartEventArgs(ircdata, channel, who, partmessage));
            }
        }
예제 #23
0
 internal TopicEventArgs(IrcMessageData data, string channel, string topic) : base(data)
 {
     _Channel = channel;
     _Topic   = topic;
 }
예제 #24
0
        // <internal messagehandler>
        private void _Event_PING(IrcMessageData ircdata)
        {
            string server = ircdata.RawMessageArray[1].Substring(1);
            #if LOG4NET
            Logger.Connection.Debug("Ping? Pong!");
            #endif
            RfcPong(server, Priority.Critical);

            if (OnPing != null) {
                OnPing(this, new PingEventArgs(ircdata, server));
            }
        }
예제 #25
0
 internal UnbanEventArgs(IrcMessageData data, string channel, string who, string hostmask) : base(data)
 {
     _Channel  = channel;
     _Who      = who;
     _Hostmask = hostmask;
 }
예제 #26
0
        private void _Event_PRIVMSG(IrcMessageData ircdata)
        {
            if (ircdata.Type == ReceiveType.CtcpRequest) {
                if (ircdata.Message.StartsWith("\x1" + "PING")) {
                    SendMessage(SendType.CtcpReply, ircdata.Nick, "PING " + ircdata.Message.Substring(6, (ircdata.Message.Length - 7)));
                }
                else if (ircdata.Message.StartsWith("\x1" + "VERSION")) {
                    string versionstring;
                    if (_CtcpVersion == null) {
                        versionstring = VersionString;
                    }
                    else {
                        versionstring = _CtcpVersion + " | using " + VersionString;
                    }
                    SendMessage(SendType.CtcpReply, ircdata.Nick, "VERSION " + versionstring);
                }
                else if (ircdata.Message.StartsWith("\x1" + "CLIENTINFO")) {
                    SendMessage(SendType.CtcpReply, ircdata.Nick, "CLIENTINFO PING VERSION CLIENTINFO");
                }
            }

            switch (ircdata.Type) {
                case ReceiveType.ChannelMessage:
                    if (OnChannelMessage != null) {
                        OnChannelMessage(this, new IrcEventArgs(ircdata));
                    }
                    break;
                case ReceiveType.ChannelAction:
                    if (OnChannelAction != null) {
                        string action = ircdata.Message.Substring(7, ircdata.Message.Length - 8);
                        OnChannelAction(this, new ActionEventArgs(ircdata, action));
                    }
                    break;
                case ReceiveType.QueryMessage:
                    if (OnQueryMessage != null) {
                        OnQueryMessage(this, new IrcEventArgs(ircdata));
                    }
                    break;
                case ReceiveType.QueryAction:
                    if (OnQueryAction != null) {
                        string action = ircdata.Message.Substring(7, ircdata.Message.Length - 8);
                        OnQueryAction(this, new ActionEventArgs(ircdata, action));
                    }
                    break;
                case ReceiveType.CtcpRequest:
                    if (OnCtcpRequest != null) {
                        OnCtcpRequest(this, new IrcEventArgs(ircdata));
                    }
                    break;
            }
        }
예제 #27
0
 internal DevoiceEventArgs(IrcMessageData data, string channel, string who, string whom) : base(data)
 {
     _Channel = channel;
     _Who     = who;
     _Whom    = whom;
 }
예제 #28
0
 internal IrcEventArgs(IrcMessageData data)
 {
     _Data = data;
 }
예제 #29
0
 internal WhoEventArgs(IrcMessageData data, string channel, string nick, string ident, string host, string realname, bool away, bool op, bool voice, bool ircop, string server, int hopcount)
     : base(data)
 {
     _Channel = channel;
     _Nick = nick;
     _Ident = ident;
     _Host = host;
     _Realname = realname;
     _IsAway = away;
     _IsOp = op;
     _IsVoice = voice;
     _IsIrcOp = ircop;
     _Server = server;
     _HopCount = hopcount;
 }
예제 #30
0
 internal IrcEventArgs(IrcMessageData data)
 {
     _Data = data;
 }
예제 #31
0
 internal JoinEventArgs(IrcMessageData data, string channel, string who)
     : base(data)
 {
     _Channel = channel;
     _Who = who;
 }
예제 #32
0
 internal PingEventArgs(IrcMessageData data, string pingdata) : base(data)
 {
     _PingData = pingdata;
 }
예제 #33
0
 internal ActionEventArgs(IrcMessageData data, string actionmsg)
     : base(data)
 {
     _ActionMessage = actionmsg;
 }
예제 #34
0
 internal NamesEventArgs(IrcMessageData data, string channel, string[] userlist) : base(data)
 {
     _Channel  = channel;
     _UserList = userlist;
 }
예제 #35
0
 internal NamesEventArgs(IrcMessageData data, string channel, string[] userlist)
     : base(data)
 {
     _Channel = channel;
     _UserList = userlist;
 }
예제 #36
0
 internal InviteEventArgs(IrcMessageData data, string channel, string who) : base(data)
 {
     _Channel = channel;
     _Who     = who;
 }
예제 #37
0
 internal PartEventArgs(IrcMessageData data, string channel, string who, string partmessage)
     : base(data)
 {
     _Channel = channel;
     _Who = who;
     _PartMessage = partmessage;
 }
예제 #38
0
 internal PartEventArgs(IrcMessageData data, string channel, string who, string partmessage) : base(data)
 {
     _Channel     = channel;
     _Who         = who;
     _PartMessage = partmessage;
 }
예제 #39
0
 internal QuitEventArgs(IrcMessageData data, string who, string quitmessage)
     : base(data)
 {
     _Who = who;
     _QuitMessage = quitmessage;
 }
예제 #40
0
 internal QuitEventArgs(IrcMessageData data, string who, string quitmessage) : base(data)
 {
     _Who         = who;
     _QuitMessage = quitmessage;
 }
예제 #41
0
 internal NickChangeEventArgs(IrcMessageData data, string oldnick, string newnick) : base(data)
 {
     _OldNickname = oldnick;
     _NewNickname = newnick;
 }
예제 #42
0
 internal ActionEventArgs(IrcMessageData data, string actionmsg) : base(data)
 {
     _ActionMessage = actionmsg;
 }
예제 #43
0
 internal VoiceEventArgs(IrcMessageData data, string channel, string who, string whom)
     : base(data)
 {
     _Channel = channel;
     _Who = who;
     _Whom = whom;
 }
예제 #44
0
        private void _InterpretChannelMode(IrcMessageData ircdata, string mode, string parameter)
        {
            string[] parameters = parameter.Split(new char[] { ' ' });
            bool add = false;
            bool remove = false;
            int modelength = mode.Length;
            string temp;
            Channel channel = null;
            if (ActiveChannelSyncing) {
                channel = GetChannel(ircdata.Channel);
            }
            IEnumerator parametersEnumerator = parameters.GetEnumerator();
            // bring the enumerator to the 1. element
            parametersEnumerator.MoveNext();
            for (int i = 0; i < modelength; i++) {
                switch (mode[i]) {
                    case '-':
                        add = false;
                        remove = true;
                        break;
                    case '+':
                        add = true;
                        remove = false;
                        break;
                    case 'o':
                        temp = (string)parametersEnumerator.Current;
                        parametersEnumerator.MoveNext();
                        if (add) {
                            if (ActiveChannelSyncing) {
                                // update the op list
                                try {
                                    channel.UnsafeOps.Add(temp, GetIrcUser(temp));
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("added op: "+temp+" to: "+ircdata.Channel);
            #endif
                                } catch (ArgumentException) {
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("duplicate op: "+temp+" in: "+ircdata.Channel+" not added");
            #endif
                                }

                                // update the user op status
                                GetChannelUser(ircdata.Channel, temp).IsOp = true;
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("set op status: "+temp+" for: "+ircdata.Channel);
            #endif
                            }
                            if (OnOp != null) {
                                OnOp(this, new OpEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                            }
                        }
                        if (remove) {
                            if (ActiveChannelSyncing) {
                                // update the op list
                                channel.UnsafeOps.Remove(temp);
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("removed op: "+temp+" from: "+ircdata.Channel);
            #endif
                                // update the user op status
                                GetChannelUser(ircdata.Channel, temp).IsOp = false;
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("unset op status: "+temp+" for: "+ircdata.Channel);
            #endif
                            }
                            if (OnDeop != null) {
                                OnDeop(this, new DeopEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                            }
                        }
                        break;
                    case 'h':
                        if (SupportNonRfc) {
                            temp = (string)parametersEnumerator.Current;
                            parametersEnumerator.MoveNext();
                            if (add) {
                                if (ActiveChannelSyncing) {
                                    // update the halfop list
                                    try {
                                        ((NonRfcChannel)channel).UnsafeHalfops.Add(temp, GetIrcUser(temp));
            #if LOG4NET
                                        Logger.ChannelSyncing.Debug("added halfop: "+temp+" to: "+ircdata.Channel);
            #endif
                                    } catch (ArgumentException) {
            #if LOG4NET
                                        Logger.ChannelSyncing.Debug("duplicate halfop: "+temp+" in: "+ircdata.Channel+" not added");
            #endif
                                    }

                                    // update the user halfop status
                                    ((NonRfcChannelUser)GetChannelUser(ircdata.Channel, temp)).IsHalfop = true;
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("set halfop status: "+temp+" for: "+ircdata.Channel);
            #endif
                                }
                                if (OnHalfop != null) {
                                    OnHalfop(this, new HalfopEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                                }
                            }
                            if (remove) {
                                if (ActiveChannelSyncing) {
                                    // update the halfop list
                                    ((NonRfcChannel)channel).UnsafeHalfops.Remove(temp);
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("removed halfop: "+temp+" from: "+ircdata.Channel);
            #endif
                                    // update the user halfop status
                                    ((NonRfcChannelUser)GetChannelUser(ircdata.Channel, temp)).IsHalfop = false;
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("unset halfop status: "+temp+" for: "+ircdata.Channel);
            #endif
                                }
                                if (OnDehalfop != null) {
                                    OnDehalfop(this, new DehalfopEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                                }
                            }
                        }
                        break;
                    case 'v':
                        temp = (string)parametersEnumerator.Current;
                        parametersEnumerator.MoveNext();
                        if (add) {
                            if (ActiveChannelSyncing) {
                                // update the voice list
                                try {
                                    channel.UnsafeVoices.Add(temp, GetIrcUser(temp));
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("added voice: "+temp+" to: "+ircdata.Channel);
            #endif
                                } catch (ArgumentException) {
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("duplicate voice: "+temp+" in: "+ircdata.Channel+" not added");
            #endif
                                }

                                // update the user voice status
                                GetChannelUser(ircdata.Channel, temp).IsVoice = true;
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("set voice status: "+temp+" for: "+ircdata.Channel);
            #endif
                            }
                            if (OnVoice != null) {
                                OnVoice(this, new VoiceEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                            }
                        }
                        if (remove) {
                            if (ActiveChannelSyncing) {
                                // update the voice list
                                channel.UnsafeVoices.Remove(temp);
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("removed voice: "+temp+" from: "+ircdata.Channel);
            #endif
                                // update the user voice status
                                GetChannelUser(ircdata.Channel, temp).IsVoice = false;
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("unset voice status: "+temp+" for: "+ircdata.Channel);
            #endif
                            }
                            if (OnDevoice != null) {
                                OnDevoice(this, new DevoiceEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                            }
                        }
                        break;
                    case 'b':
                        temp = (string)parametersEnumerator.Current;
                        parametersEnumerator.MoveNext();
                        if (add) {
                            if (ActiveChannelSyncing) {
                                try {
                                    channel.Bans.Add(temp);
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("added ban: "+temp+" to: "+ircdata.Channel);
            #endif
                                } catch (ArgumentException) {
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("duplicate ban: "+temp+" in: "+ircdata.Channel+" not added");
            #endif
                                }
                            }
                            if (OnBan != null) {
                                OnBan(this, new BanEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                            }
                        }
                        if (remove) {
                            if (ActiveChannelSyncing) {
                                channel.Bans.Remove(temp);
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("removed ban: "+temp+" from: "+ircdata.Channel);
            #endif
                            }
                            if (OnUnban != null) {
                                OnUnban(this, new UnbanEventArgs(ircdata, ircdata.Channel, ircdata.Nick, temp));
                            }
                        }
                        break;
                    case 'l':
                        temp = (string)parametersEnumerator.Current;
                        parametersEnumerator.MoveNext();
                        if (add) {
                            if (ActiveChannelSyncing) {
                                channel.UserLimit = int.Parse(temp);
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("stored user limit for: "+ircdata.Channel);
            #endif
                            }
                        }
                        if (remove) {
                            if (ActiveChannelSyncing) {
                                channel.UserLimit = 0;
            #if LOG4NET
                                Logger.ChannelSyncing.Debug("removed user limit for: "+ircdata.Channel);
            #endif
                            }
                        }
                        break;
                    case 'k':
                        temp = (string)parametersEnumerator.Current;
                        parametersEnumerator.MoveNext();
                        if (add) {
                            if (ActiveChannelSyncing) {
                                channel.Key = temp;
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("stored channel key for: "+ircdata.Channel);
            #endif
                            }
                        }
                        if (remove) {
                            if (ActiveChannelSyncing) {
                                channel.Key = "";
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("removed channel key for: "+ircdata.Channel);
            #endif
                            }
                        }
                        break;
                    default:
                        if (add) {
                            if (ActiveChannelSyncing) {
                                channel.Mode += mode[i];
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("added channel mode ("+mode[i]+") for: "+ircdata.Channel);
            #endif
                            }
                        }
                        if (remove) {
                            if (ActiveChannelSyncing) {
                                channel.Mode = channel.Mode.Replace(mode[i], new char());
            #if LOG4NET
                                    Logger.ChannelSyncing.Debug("removed channel mode ("+mode[i]+") for: "+ircdata.Channel);
            #endif
                            }
                        }
                        break;
                }
            }
        }