Esempio n. 1
0
        private void cmdNOTICE(string[] args)
        {
            _Parsed = true;
            string[] source = args[0].Split(new char[] { '!' });
            string   nick   = source[0].Replace(":", "");
            string   realname;
            string   hostname;

            if (args[0].IndexOf("!") > -1)
            {
                realname = source[1].Split(arobas)[0];
                hostname = source[1].Split(arobas)[1];
            }
            else
            {
                hostname = null;
                realname = null;
            }
            UserInfo user    = new UserInfo(nick, realname, hostname, false);
            string   channel = args[2];

            if (channel.StartsWith("@"))
            {
                channel = channel.Remove(0, 1);
            }
            string message = UtilityService.JoinString(args, 3, args.Length).Remove(0, 1);

            if (message.StartsWith(UtilityService.CTCPMarker))
            {
                CTCPReplyEventArgs e_ctcp;
                string             reply    = message.Replace(UtilityService.CTCPMarker, "");
                string             ctcptype = (reply.Split(new char[] { ' ' }))[0];
                reply = reply.Replace(ctcptype, "");
                if (ctcptype.ToUpper() == "PING")
                {
                    DateTime now        = DateTime.Now;
                    DateTime ping       = UtilityService.ConvertCtimeToDateTime(reply);
                    TimeSpan difference = now - ping;
                    reply = Convert.ToInt32(difference.TotalSeconds).ToString() + " second(s)";
                }
                e_ctcp = new CTCPReplyEventArgs(user, ctcptype, reply);
                //connection.OnCTCPReplyEventReceived(e_ctcp);
            }
            else
            {
                NoticeEventArgs e = new NoticeEventArgs(user, message, channel);
                if (oNoticeEvent != null)
                {
                    oNoticeEvent(this, e);
                }

                // connection.OnNoticeEventReceived(e);
            }
        }
Esempio n. 2
0
        private void cmdNOTICE(string[] args)
        {
            _Parsed = true;
            string[] source = args[0].Split(new char[] { '!' });
            string nick = source[0].Replace(":", "");
            string realname;
            string hostname;
            if (args[0].IndexOf("!") > -1)
            {
                realname = source[1].Split(arobas)[0];
                hostname = source[1].Split(arobas)[1];
            }
            else
            {
                hostname = null;
                realname = null;
            }
            UserInfo user = new UserInfo(nick, realname, hostname, false);
            string channel = args[2];
            if (channel.StartsWith("@"))
                channel = channel.Remove(0, 1);
            string message = UtilityService.JoinString(args, 3, args.Length).Remove(0, 1);
            if (message.StartsWith(UtilityService.CTCPMarker))
            {
                CTCPReplyEventArgs e_ctcp;
                string reply = message.Replace(UtilityService.CTCPMarker, "");
                string ctcptype = (reply.Split(new char[] { ' ' }))[0];
                reply = reply.Replace(ctcptype, "");
                if (ctcptype.ToUpper() == "PING")
                {
                    DateTime now = DateTime.Now;
                    DateTime ping = UtilityService.ConvertCtimeToDateTime(reply);
                    TimeSpan difference = now - ping;
                    reply = Convert.ToInt32(difference.TotalSeconds).ToString() + " second(s)";
                   
                }
                e_ctcp = new CTCPReplyEventArgs(user, ctcptype, reply);
                //connection.OnCTCPReplyEventReceived(e_ctcp);
            }
            else
            {
                NoticeEventArgs e = new NoticeEventArgs(user, message, channel);
                if (oNoticeEvent != null)
                    oNoticeEvent(this, e);

               // connection.OnNoticeEventReceived(e);
            }
        }