示例#1
0
 public static void chatOutputCallback(object source, IrcReceivedEventArgs args)
 {
     Console.WriteLine("===============IRC MESSAGE===============");
     Console.WriteLine(args.Channel + " | " + args.User + ": " + args.Message);
     Console.WriteLine("===============END IRC MESSAGE===============");
     Console.WriteLine("");
 }
示例#2
0
        private void OnMessage(object sender, IrcReceivedEventArgs args)
        {
            DebugHandler.TraceMessage("OnMessage Called.", DebugSource.TASK, DebugType.ENTRY_EXIT);

            IrcClientMessageEventArgs eventArgs = new IrcClientMessageEventArgs()
            {
                Channel = args.Channel,
                User    = args.User,
                Message = args.Message
            };

            DebugHandler.TraceMessage(eventArgs.ToString(), DebugSource.TASK, DebugType.ENTRY_EXIT);

            OnIrcClientMessageEvent?.Invoke(this, eventArgs);
        }
 private void IrcClient_OnMessageReceived(object sender, IrcReceivedEventArgs e)
 {
     Console.WriteLine(sender.ToString());
     Console.WriteLine(e.User + "::" + e.Message);
 }
示例#4
0
        public static void chatOutputCallback(object source, IrcReceivedEventArgs args)
        {
            string msg = args.User + ": " + args.Message;

            Debug.WriteLine("[CO]:" + msg);
            string cleanChannel = args.Channel.Replace("#", "");

            if (args.Channel == accForm.tmpUsername) // PRIVMSG
            {
                Debug.WriteLine("RECEIVED PRIVATE MESSAGE FROM " + args.User);
                newPM = args.User;
                string logpath    = Application.StartupPath + @"\chatlogs";
                string privateLog = logpath + @"\PM_" + args.User + ".txt";

                if (!Directory.Exists(logpath))
                {
                    Directory.CreateDirectory(logpath);
                }
                if (!File.Exists(privateLog))
                {
                    File.Create(privateLog).Dispose();
                }

                File.AppendAllText(privateLog, msg + '\n');

                bool foundFrm = false;
                Debug.WriteLine("Checking for open form with username tag");
                foreach (Form frm in Application.OpenForms)
                {
                    if (frm.Tag == null)
                    {
                        continue;
                    }

                    if (frm.Tag.ToString() == newPM)
                    {
                        foundFrm = true;
                    }
                }

                if (!foundFrm)
                {
                    Debug.WriteLine("Opening IM for user " + newPM);
                    Application.OpenForms[0].Invoke(new MethodInvoker(delegate
                    {
                        instant_message im = new instant_message(newPM);
                        im.Owner           = Application.OpenForms[0];
                        im.MdiParent       = Application.OpenForms[0];
                        im.Tag             = newPM;
                        im.Show();
                    }));
                }
            }
            else
            {
                string logpath = Application.StartupPath + @"\chatlogs";
                string chatlog = logpath + @"\" + cleanChannel + ".txt";

                if (!Directory.Exists(logpath))
                {
                    Directory.CreateDirectory(logpath);
                }
                if (!File.Exists(chatlog))
                {
                    File.Create(chatlog).Dispose();
                }

                File.AppendAllText(chatlog, msg + '\n');
            }
        }
示例#5
0
 /// <summary>
 /// Event handler for receiving messages from the Irc Client.
 /// </summary>
 /// <param name="sender">Values of the class that fired the event</param>
 /// <param name="args">IrcReceivedEventArgs containing the message information</param>
 public void OnMessagesReceived(object sender, IrcReceivedEventArgs args)
 {
     OnMessagesReceivedLocal(args.Channel, args.User, args.Message);
 }