예제 #1
0
 public static void rawOutputCallback(object source, IrcRawReceivedEventArgs args)
 {
     Console.WriteLine("===============RAW MESSAGE===============");
     Console.WriteLine("RAW: " + args.Message);
     Console.WriteLine("===============END RAW MESSAGE===============");
 }
예제 #2
0
        public static void rawOutputCallback(object source, IrcRawReceivedEventArgs args)
        {
            if (accForm.tmpUsername == "Guest" || accForm.tmpUsername == "" || args.Message == null) // prevents crash if signing off
            {
                return;
            }

            Debug.WriteLine("[RO]:" + args.Message);
            string[] info = args.Message.Split(' ');
            // buddy is offline ([RO]::veronica.snoonet.org 401 erfg12 NeWaGe :No such nick/channel)
            if (args.Message.Contains("No such nick/channel")) // say this when disconnecting from server too
            {
                //Debug.WriteLine("user is dead");
                if (buddyStatus.ContainsKey(info[3].ToLower()))
                {
                    buddyStatus[info[3].ToLower()] = false;
                }
            }
            // buddy is online ([RO]::veronica.snoonet.org 318 erfg12 NeWaGe :End of /WHOIS list.)
            else if (args.Message.Contains(" 311 " + accForm.tmpUsername))
            {
                //Debug.WriteLine("user is alive!!");
                buddyStatus[info[3].ToLower()] = true;
            }
            else if (args.Message.Contains("NickServ!NickServ@services NOTICE " + accForm.tmpUsername + " :       Registered"))
            {
                irc.SendMessageToChannel("IDENTIFY " + accForm.tmpPassword, "NickServ");
            }
            else if (args.Message.Contains(" JOIN :#"))
            {
                string chan = args.Message.Substring(args.Message.IndexOf(" JOIN :") + " JOIN :".Length);
                Debug.WriteLine("Getting users list from IRC server: " + chan);
                //irc.GetUsersInCurrentChannel();
                irc.GetUsersInDifferentChannel(chan);
            }
            else if (args.Message.Contains(" PART #"))
            {
                string chan    = args.Message.Substring(args.Message.IndexOf(" PART :") + " PART :".Length);
                string logpath = Application.StartupPath + @"\chatlogs";
                //string privateLog = logpath + @"\" + pChat + ".txt";
                string[] getUN = args.Message.Split('!');
                //File.AppendAllText(privateLog, getUN[0] + " has left." + '\n');
                irc.GetUsersInDifferentChannel(chan); // GetUsersInDifferentChannel("#chanName");
            }
            else if (args.Message.Contains(":You need to be identified to a registered account to join this channel"))
            {
                // users needs to register
                Debug.WriteLine("ERROR: IRC nickname needs to be registered.");
                string logpath = Application.StartupPath + @"\chatlogs";
                //string privateLog = logpath + @"\" + pChat + ".txt";
                //File.AppendAllText(privateLog, "IMPORTANT NOTICE: This is a registered users only chatroom. We will send an authentication request to the NickServ. Open an email with the subject \"Nickname registration for " + accForm.tmpUsername + "\" please." + '\n');
                //irc.SendMessageToChannel("REGISTER " + accForm.tmpPassword + " " + accForm.tmpUsername + "@aolemu.com", "NickServ");
            }
            else if (args.Message.Contains("This nickname is registered and protected."))
            {
                // user needs to authenticate
                irc.SendMessageToChannel("IDENTIFY " + accForm.tmpPassword, "NickServ");
            }
            // get a channel list
            // command -> /list >200
            // :alamo.snoonet.org 322 NeWaGe_test #beer 58 :[+CFJTfjnrtx 5:60 2 5:1 5:5 10:4] its a !bang (again) | Welcome! Everything you...
            // need to compare channel list with category list -> https://snoonet.org/communities
            else if (args.Message.Contains(" 322 ") && args.Message.Contains("#"))
            {
                string[] chan      = args.Message.Split('#');
                string[] chanClean = chan[1].Split(new[] { ' ' }, 2);
                if (chanClean[0] != "")
                {
                    Debug.WriteLine(chanClean[0] + " channel is available");
                }
            }
        }
 private void IrcClient_OnRawMessageReceived(object sender, IrcRawReceivedEventArgs e)
 {
     Console.WriteLine(sender.ToString());
     Console.WriteLine(e.Message);
 }
예제 #4
0
 /// <summary>
 /// Event for receiving raw messages from the irc server.
 /// </summary>
 /// <param name="source">source class</param>
 /// <param name="args">IrcRawReceivedEventArgs contains the message received</param>
 public void OnRawMessageReceived(object source, IrcRawReceivedEventArgs args)
 {
     OnRawMessageReceivedLocal(args.Message);
 }