示例#1
0
 internal BounceEventArgs(IrcMessageData data, string server, int port) : base(data)
 {
     Server = server;
     Port   = port;
 }
示例#2
0
 internal ActionEventArgs(IrcMessageData data, string actionmsg) : base(data, "ACTION", actionmsg) => ActionMessage = actionmsg;
示例#3
0
 internal DevoiceEventArgs(IrcMessageData data, string channel, string who, string whom) : base(data, channel, who, whom)
 {
 }
示例#4
0
        public static WhoInfo Parse(IrcMessageData data)
        {
            var whoInfo = new WhoInfo
            {
                // :fu-berlin.de 352 meebey_ * ~meebey e176002059.adsl.alicedsl.de fu-berlin.de meebey_ H :0 Mirco Bauer..
                Channel = data.RawMessageArray[3],
                Ident   = data.RawMessageArray[4],
                Host    = data.RawMessageArray[5],
                Server  = data.RawMessageArray[6],
                Nick    = data.RawMessageArray[7]
            };

            // HACK: realname field can be empty on bugged IRCds like InspIRCd-2.0
            // :topiary.voxanon.net 352 Mirco #anonplusradio CpGc igot.avhost Voxanon CpGc H
            if (data.MessageArray == null || data.MessageArray.Length < 2)
            {
                whoInfo.Realname = "";
            }
            else
            {
                string hopcountStr = data.MessageArray[0];
                if (Int32.TryParse(hopcountStr, out int hopcount))
                {
                    whoInfo.HopCount = hopcount;
                }
                else
                {
#if LOG4NET
                    Logger.MessageParser.Warn("Parse(): couldn't parse hopcount (as int): '" + hopcountStr + "'");
#endif
                }
                // skip hop count
                whoInfo.Realname = String.Join(" ", data.MessageArray, 1, data.MessageArray.Length - 1);
            }

            string usermode       = data.RawMessageArray[8];
            bool   owner          = false;
            bool   chanadmin      = false;
            bool   op             = false;
            bool   halfop         = false;
            bool   voice          = false;
            bool   ircop          = false;
            bool   away           = false;
            bool   registered     = false;
            int    usermodelength = usermode.Length;
            for (int i = 0; i < usermodelength; i++)
            {
                switch (usermode[i])
                {
                case 'H':
                    away = false;
                    break;

                case 'G':
                    away = true;
                    break;

                case '~':
                    owner = true;
                    break;

                case '&':
                    chanadmin = true;
                    break;

                case '@':
                    op = true;
                    break;

                case '%':
                    halfop = true;
                    break;

                case '+':
                    voice = true;
                    break;

                case '*':
                    ircop = true;
                    break;

                case 'r':
                    registered = true;
                    break;
                }
            }
            whoInfo.IsAway         = away;
            whoInfo.IsOwner        = owner;
            whoInfo.IsChannelAdmin = chanadmin;
            whoInfo.IsOp           = op;
            whoInfo.IsHalfop       = halfop;
            whoInfo.IsVoice        = voice;
            whoInfo.IsIrcOp        = ircop;

            whoInfo.IsRegistered = registered;

            return(whoInfo);
        }
示例#5
0
 internal ListEventArgs(IrcMessageData data, ChannelInfo listInfo) : base(data) => ListInfo = listInfo;
示例#6
0
 internal ErrorEventArgs(IrcMessageData data, string errormsg) : base(data) => ErrorMessage = errormsg;
示例#7
0
 internal PingEventArgs(IrcMessageData data, string pingdata) : base(data) => PingData = pingdata;
示例#8
0
 internal NickChangeEventArgs(IrcMessageData data, string oldnick, string newnick) : base(data)
 {
     OldNickname = oldnick;
     NewNickname = newnick;
 }
示例#9
0
 internal TopicEventArgs(IrcMessageData data, string channel, string topic) : base(data)
 {
     Channel = channel;
     Topic   = topic;
 }
示例#10
0
 internal QuitEventArgs(IrcMessageData data, string who, string quitmessage) : base(data)
 {
     Who         = who;
     QuitMessage = quitmessage;
 }
示例#11
0
 internal AwayEventArgs(IrcMessageData data, string who, string awaymessage) : base(data)
 {
     Who         = who;
     AwayMessage = awaymessage;
 }
示例#12
0
 internal WhoEventArgs(IrcMessageData data, WhoInfo whoInfo) : base(data) => WhoInfo = whoInfo;
示例#13
0
 internal PartEventArgs(IrcMessageData data, string channel, string who, string partmessage) : base(data)
 {
     Channel     = channel;
     Who         = who;
     PartMessage = partmessage;
 }
示例#14
0
 internal InviteEventArgs(IrcMessageData data, string channel, string who) : base(data)
 {
     Channel = channel;
     Who     = who;
 }
示例#15
0
 internal ChannelModeChangeEventArgs(IrcMessageData data, string channel, List <ChannelModeChangeInfo> modeChanges) : base(data)
 {
     Channel     = channel;
     ModeChanges = modeChanges;
 }
示例#16
0
 internal TopicChangeEventArgs(IrcMessageData data, string channel, string who, string newtopic) : base(data)
 {
     Channel  = channel;
     Who      = who;
     NewTopic = newtopic;
 }
示例#17
0
 internal CtcpEventArgs(IrcMessageData data, string ctcpcmd, string ctcpparam) : base(data)
 {
     CtcpCommand   = ctcpcmd;
     CtcpParameter = ctcpparam;
 }
示例#18
0
 internal UnbanEventArgs(IrcMessageData data, string channel, string who, string hostmask) : base(data)
 {
     Channel  = channel;
     Who      = who;
     Hostmask = hostmask;
 }
示例#19
0
 internal MotdEventArgs(IrcMessageData data, string motdmsg) : base(data) => MotdMessage = motdmsg;
示例#20
0
 internal ChannelRoleChangeEventArgs(IrcMessageData data, string channel, string who, string whom) : base(data)
 {
     Channel = channel;
     Who     = who;
     Whom    = whom;
 }
示例#21
0
 internal PongEventArgs(IrcMessageData data, TimeSpan lag) : base(data) => Lag = lag;
示例#22
0
 internal ChannelAdminEventArgs(IrcMessageData data, string channel, string who, string whom) : base(data, channel, who, whom)
 {
 }
示例#23
0
 internal IrcEventArgs(IrcMessageData data) => Data = data;
示例#24
0
 internal NamesEventArgs(IrcMessageData data, string channel, string[] userlist, string[] rawUserList) : base(data)
 {
     Channel     = channel;
     UserList    = userlist;
     RawUserList = rawUserList;
 }