Iranian Programming Support

Welcome To Csharp TeaM Forum.
For Use All Forum Posts And See Links
Please Register
Thanks
www.Programming.MrForum.net
Csharp TeaM Administrator

Join the forum, it's quick and easy

Iranian Programming Support

Welcome To Csharp TeaM Forum.
For Use All Forum Posts And See Links
Please Register
Thanks
www.Programming.MrForum.net
Csharp TeaM Administrator

Iranian Programming Support

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Iranian Programming Support

Csharp TeaM

Top posting users this month

No user

Latest topics

» html to c# source code convert help
by launchar Tue Dec 06, 2016 7:22 am

» User input
by nesraz Sun Dec 20, 2015 8:39 am

» darkhaste source mediaplayer baraye b4a
by parham01 Tue Dec 15, 2015 10:31 am

» Tolide esme file gheire tekrari
by sajjad3011 Fri Jul 31, 2015 5:00 pm

» 368 library basic 4 android
by alimusavi71 Fri Jul 17, 2015 6:45 pm

» نرم افزار دریافت لایسنس آنتی ویروس نود 32
by programmer-x Wed Jul 15, 2015 3:19 pm

» help for java applications
by launchar Wed Jul 01, 2015 12:25 am

» Nimbuzz id Maker auto Captcha & Auto add FlooD & id BloCker
by briant Sat Jun 20, 2015 12:46 pm

» best mobile server v.1.0.0 persian edition
by programmer-x Fri Jun 19, 2015 12:41 am

» plz help me i neez xml code for spy bot
by alone Sun Mar 22, 2015 9:30 pm

» Dialogs Lib {Basic 4 Android}
by abdo0o Mon Mar 09, 2015 4:02 pm

» Room + PV Flooder Nimbuzz 2015
by sholeh Sat Feb 21, 2015 8:06 am

» PV Flooder Nimbuzz 2015
by sholeh Sat Feb 21, 2015 8:03 am

» سی شارپ سورس
by tr0 Wed Dec 24, 2014 12:15 pm

» help plz auto maker ids
by launchar Wed Dec 17, 2014 5:57 pm

» Join Multi Id To Room + Captcha [ Badbuzz Team ] In Seri Ba AgsXMPP !!
by abdo0o Fri Dec 12, 2014 4:47 am

» Amoozesh Ersale Sms Dar B4a
by abdo0o Fri Dec 12, 2014 4:43 am

» help me pls mehran brother
by launchar Wed Dec 03, 2014 6:36 pm

» plz help code Refresh captcha join Room
by ayad53 Wed Dec 03, 2014 12:24 pm

» please Help Me For AutoCaptchaa kardan IdMaker
by abdo0o Tue Dec 02, 2014 12:12 pm

» source C# bot addlist sender by ==> Alone_051@n.c
by walahazrat Mon Dec 01, 2014 2:34 am

» s2a sender tro help me pls
by walahazrat Mon Dec 01, 2014 2:28 am

» Help For {Data id } C# asixmpp.dll
by abdo0o Sun Nov 30, 2014 11:17 pm

» Help C# {Join & Left With Remoter}
by $iahi Tue Nov 25, 2014 10:31 am

» Source Nimbuzz User Searcher By Mehr,an [ Badbuzz TeaM ]
by waseemmalik Wed Nov 19, 2014 11:35 am


2 posters

    Help About ChatBox

    ar)v(an
    ar)v(an
    New Member
    New Member


    Posts : 3
    Points : 5
    Thanks : 0
    Join date : 2013-06-13

    Solved Help About ChatBox

    Post by ar)v(an Mon Aug 05, 2013 3:02 pm

    Drud
    Ye Soal Dashtam Dar Morde ChatbOx
    Man Tahala Ba ChatBox Kar Nakardam
    Nemidonam Ch Joire Va aZ Ch Using hayi Bayad Use kard
    Plz Harki HarChi Midone Matrah kone
    aGe Ham Codesh Ro Bezarid ke Mamnon misham
    Code Haro Mikhonam va Yad Mgiram
    Ba Tashakor C# TeaM
    Mehdi izadi
    Mehdi izadi
    Administrator
    Administrator


    Posts : 793
    Points : 1182
    Thanks : 288
    Join date : 2013-06-06
    Age : 32
    Location : Iran,Hormozgan,Bandare Lengeh

    Solved Re: Help About ChatBox

    Post by Mehdi izadi Tue Aug 06, 2013 12:45 pm

    salam
    in ye nemune source ghadimie.
    richtextbox2 hamun chatboxe tooye roome.
    kolle code haye xml read ro gozashtam.
    omidvaram ba khoondaneshun befahmi chi be chie.
    movafagh bashi.

    Code:

          public void Xml(object sender, string xml1)
          {
             if (base.InvokeRequired == true)
             {
                base.BeginInvoke(new XmlHandler(Xml), new object[] {sender, xml1});
             }
             else
             {
                    try
                    {
                        Application.DoEvents();
                        xml1 = xml1.ToLower();
                        xml1 = xml1.Replace("\"", "'");
                        if (xml1.IndexOf("@conference.nimbuzz.com/admin'", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                        {
                            if (xml1.IndexOf("enter the right answer to start chatting.", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                            {
                                gt = xml1.Substring(xml1.IndexOf("enter the right answer to start chatting.") + 42);
                                gt = gt.Substring(0, gt.IndexOf("</body>") - 0);
                                gt = gt.Replace(" ", "");
                                gt = gt.Replace("=...", "");
                                gt = gt.Replace("thousand", "");
                                gt = gt.Replace("hundred", "");
                                gt = gt.Replace("and", ",");
                                gt = gt.Replace("ten", "10");
                                gt = gt.Replace("eleven", "11");
                                gt = gt.Replace("twelve", "12");
                                gt = gt.Replace("thirteen", "13");
                                gt = gt.Replace("fourteen", "14");
                                gt = gt.Replace("fifteen", "15");
                                gt = gt.Replace("sixteen", "16");
                                gt = gt.Replace("seventeen", "17");
                                gt = gt.Replace("eighteen", "18");
                                gt = gt.Replace("nineteen", "19");
                                gt = gt.Replace("twenty-", "2");
                                gt = gt.Replace("thirty-", "3");
                                gt = gt.Replace("forty-", "4");
                                gt = gt.Replace("fifty-", "5");
                                gt = gt.Replace("sixty-", "6");
                                gt = gt.Replace("seventy-", "7");
                                gt = gt.Replace("eighty-", "8");
                                gt = gt.Replace("ninety-", "9");
                                gt = gt.Replace("twenty", "20");
                                gt = gt.Replace("thirty", "30");
                                gt = gt.Replace("forty", "40");
                                gt = gt.Replace("fifty", "50");
                                gt = gt.Replace("sixty", "60");
                                gt = gt.Replace("seventy", "70");
                                gt = gt.Replace("eighty", "80");
                                gt = gt.Replace("ninety", "90");
                                gt = gt.Replace("one", "1");
                                gt = gt.Replace("two", "2");
                                gt = gt.Replace("three", "3");
                                gt = gt.Replace("four", "4");
                                gt = gt.Replace("five", "5");
                                gt = gt.Replace("six", "6");
                                gt = gt.Replace("seven", "7");
                                gt = gt.Replace("eight", "8");
                                gt = gt.Replace("nine", "9");
                                if (gt.IndexOf("-", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    int y = Convert.ToInt32(gt.Substring(0, +1));
                                    int x = Convert.ToInt32(gt.Substring(2, +1));
                                    j = (y - x).ToString();
                                }
                                else if (gt.IndexOf("+", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    int y = Convert.ToInt32(gt.Substring(0, +1));
                                    int x = Convert.ToInt32(gt.Substring(2, +1));
                                    j = (y + x).ToString();
                                }
                                else if (gt.IndexOf("*", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    int y = Convert.ToInt32(gt.Substring(0, +1));
                                    int x = Convert.ToInt32(gt.Substring(2, +1));
                                    j = (y * x).ToString();
                                }
                                else if (gt.IndexOf("Whatisthe1stdigitof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 2);
                                    j = j.Substring(0, j.IndexOf("?") - 4);

                                }
                                else if (gt.IndexOf("Whatisthe2nddigitof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 3);
                                    j = j.Substring(0, j.IndexOf("?") - 3);

                                }
                                else if (gt.IndexOf("Whatisthe3rddigitof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 4);
                                    j = j.Substring(0, j.IndexOf("?") - 2);

                                }
                                else if (gt.IndexOf("Whatisthe4thdigitof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 5);
                                    j = j.Substring(0, j.IndexOf("?") - 1);

                                }
                                else if (gt.IndexOf("Whatisthe5thdigitof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 6);
                                    j = j.Substring(0, j.IndexOf("?") - 0);

                                }
                                else if (gt.IndexOf("asdigits?", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("Whatis") + 6);
                                    j = j.Substring(0, j.IndexOf("as") - 0);

                                }
                                else if (gt.IndexOf("whichisthesmallest?", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("bers") + 4);
                                    j = j.Substring(0, j.IndexOf(",w") - 0);
                                    string[] s = null;
                                    s = j.Split(',');
                                    long lng = 0;
                                    lng = Convert.ToInt64(s[s.GetLowerBound(0)]);
                                    for (var i = s.GetLowerBound(0); i <= s.GetUpperBound(0); i++)
                                    {
                                        if (lng > Convert.ToInt64(s[i]))
                                        {
                                            lng = Convert.ToInt64(s[i]);
                                        }
                                    }
                                    j = lng.ToString();

                                }
                                else if (gt.IndexOf("whichisthebiggest?", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("bers") + 4);
                                    j = j.Substring(0, j.IndexOf(",w") - 0);
                                    string[] s = null;
                                    s = j.Split(',');
                                    long lng = 0;
                                    lng = Convert.ToInt64(s[s.GetUpperBound(0)]);
                                    for (var i = s.GetLowerBound(0); i <= s.GetUpperBound(0); i++)
                                    {
                                        if (lng < Convert.ToInt64(s[i]))
                                        {
                                            lng = Convert.ToInt64(s[i]);
                                        }
                                    }
                                    j = lng.ToString();

                                }
                                else if (gt.IndexOf("The1stnumberof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 2);
                                    j = j.Substring(0, j.IndexOf("is?") - 0);
                                    string[] s = null;
                                    s = j.Split(',');
                                    j = s[0].ToString();

                                }
                                else if (gt.IndexOf("The2ndnumberof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 2);
                                    j = j.Substring(0, j.IndexOf("is?") - 0);
                                    string[] s = null;
                                    s = j.Split(',');
                                    j = s[1].ToString();

                                }
                                else if (gt.IndexOf("The3rdnumberof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 2);
                                    j = j.Substring(0, j.IndexOf("is?") - 0);
                                    string[] s = null;
                                    s = j.Split(',');
                                    j = s[2].ToString();

                                }
                                else if (gt.IndexOf("The4thnumberof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 2);
                                    j = j.Substring(0, j.IndexOf("is?") - 0);
                                    string[] s = null;
                                    s = j.Split(',');
                                    j = s[3].ToString();

                                }
                                else if (gt.IndexOf("The5thnumberof", System.StringComparison.OrdinalIgnoreCase) + 1 != 0)
                                {
                                    j = gt.Substring(gt.IndexOf("of") + 2);
                                    j = j.Substring(0, j.IndexOf("is?") - 0);
                                    string[] s = null;
                                    s = j.Split(',');
                                    j = s[4].ToString();

                                }
                                Form1.x.Send("<message to='" + txtRoom.Text + "@conference.nimbuzz.com' type='groupchat'><body>" + j + "</body></message>");
                            }
                        }
                    }
                    catch { }

                    try
                    {
                        this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
                        this.richTextBox1.SelectionLength = 0;
                        richTextBox1.SelectionColor = Color.Black;
                        this.richTextBox1.AppendText("↓Recv: ");
                        richTextBox1.SelectionColor = Color.Red;
                        this.richTextBox1.AppendText(xml1);
                        this.richTextBox1.AppendText("\r*********************************\r");
                        xml1 = xml1.Replace("\"", "'");
                    }
                    catch { }
                    try
                    {
                        this.OnParticipantJoin(sender, xml1);
                    }
                    catch { }
             }
          }

            private void OnParticipantJoin(object sender, string Participant)
            {
                //NoNE Join
                Participant = Participant.Replace("\"", "'");
                try
                {
                    if (Participant.IndexOf("<x xmlns='http://jabber.org/protocol/muc#user'><item role='participant'") >= 0)
                    {
                        if (Participant.IndexOf("affiliation='none'") >= 0)
                        {
                            string nonejoin = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            nonejoin = nonejoin.Substring(0, nonejoin.IndexOf("@") - 0);
                            string resource_UserName = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            resource_UserName = resource_UserName.Substring(0, resource_UserName.IndexOf("'") - 0);
                            this.richTextBox2.SelectionStart = this.richTextBox2.Text.Length;
                            this.richTextBox2.SelectionLength = 0;
                            this.richTextBox2.SelectionColor = Color.Green;
                            this.richTextBox2.AppendText(string.Concat(new string[] { nonejoin + " ( " + resource_UserName + ") has joined (None)" }));
                            this.richTextBox2.SelectionColor = Color.Black;
                            this.richTextBox2.AppendText("\r\n");
                        }
                    }
                }
                catch { }
                //Owner Join
                try
                {
                    if (Participant.IndexOf("<x xmlns='http://jabber.org/protocol/muc#user'><item role='moderator'") >= 0)
                    {
                        if (Participant.IndexOf("affiliation='owner'") >= 0)
                        {
                            string ownerjoin = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            ownerjoin = ownerjoin.Substring(0, ownerjoin.IndexOf("@") - 0);
                            string resource_UserName = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            resource_UserName = resource_UserName.Substring(0, resource_UserName.IndexOf("'") - 0);
                            this.richTextBox2.SelectionStart = this.richTextBox2.Text.Length;
                            this.richTextBox2.SelectionLength = 0;
                            this.richTextBox2.SelectionColor = Color.Green;
                            this.richTextBox2.AppendText(string.Concat(new string[] { ownerjoin + " ( " + resource_UserName + ") has joined (owner)" }));
                            this.richTextBox2.SelectionColor = Color.Black;
                            this.richTextBox2.AppendText("\r\n");
                        }
                    }
                }
                catch { }
                //Admin Join
                try
                {
                    if (Participant.IndexOf("<x xmlns='http://jabber.org/protocol/muc#user'><item role='moderator'") >= 0)
                    {
                        if (Participant.IndexOf("affiliation='admin'") >= 0)
                        {
                            string adminjoin = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            adminjoin = adminjoin.Substring(0, adminjoin.IndexOf("@") - 0);
                            string resource_UserName = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            resource_UserName = resource_UserName.Substring(0, resource_UserName.IndexOf("'") - 0);
                            this.richTextBox2.SelectionStart = this.richTextBox2.Text.Length;
                            this.richTextBox2.SelectionLength = 0;
                            this.richTextBox2.SelectionColor = Color.Green;
                            this.richTextBox2.AppendText(string.Concat(new string[] { adminjoin + " ( " + resource_UserName + ") has joined (admin)" }));
                            this.richTextBox2.SelectionColor = Color.Black;
                            this.richTextBox2.AppendText("\r\n");
                        }
                    }
                }
                catch { }
                //member Join
                try
                {
                    if (Participant.IndexOf("<x xmlns='http://jabber.org/protocol/muc#user'><item role='participant'") >= 0)
                    {
                        if (Participant.IndexOf("affiliation='member'") >= 0)
                        {
                            string memberjoin = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            memberjoin = memberjoin.Substring(0, memberjoin.IndexOf("@") - 0);
                            string resource_UserName = Participant.Substring(Participant.IndexOf("jid='") + 5);
                            resource_UserName = resource_UserName.Substring(0, resource_UserName.IndexOf("'") - 0);
                            this.richTextBox2.SelectionStart = this.richTextBox2.Text.Length;
                            this.richTextBox2.SelectionLength = 0;
                            this.richTextBox2.SelectionColor = Color.Green;
                            this.richTextBox2.AppendText(string.Concat(new string[] { memberjoin + " ( " + resource_UserName + ") has joined (member)" }));
                            this.richTextBox2.SelectionColor = Color.Black;
                            this.richTextBox2.AppendText("\r\n");
                        }
                    }
                }
                catch { }
            }
          public void mesg(object sender, agsXMPP.protocol.client.Message msg)
          {
             if (base.InvokeRequired == true)
             {
                base.BeginInvoke(new MessageHandler(mesg), new object[] {sender, msg});
             }
             else
             {
                    try
                    {

                        if (msg.Type == MessageType.chat)
                        {
                            string[] text = new string[7];
                            text[0] = msg.Body;
                            text[1] = "";
                            text[2] = "";
                            text[3] = "";
                            text[4] = "";
                            text[5] = "";
                            text[6] = "";
                            try
                            {
                                text[1] = text[0].Remove(1, text[0].Length - 1);
                                text[2] = text[0].Remove(2, text[0].Length - 2);
                                text[3] = text[0].Remove(3, text[0].Length - 3);
                                text[4] = text[0].Remove(4, text[0].Length - 4);
                                text[5] = text[0].Remove(5, text[0].Length - 5);
                                text[6] = text[0].Remove(6, text[0].Length - 6);
                            }
                            catch { }
                        }
                    }
                    catch { }

                if (msg.Type == MessageType.groupchat)  // Group Chat Message
                {
                        string[] text = new string[7];
                        text[0] = msg.Body;
                        text[1] = "";
                        text[2] = "";
                        text[3] = "";
                        text[4] = "";
                        text[5] = "";
                        text[6] = "";
                        try
                        {
                            text[1] = text[0].Remove(1, text[0].Length - 1);
                            text[2] = text[0].Remove(2, text[0].Length - 2);
                            text[3] = text[0].Remove(3, text[0].Length - 3);
                            text[4] = text[0].Remove(4, text[0].Length - 4);
                            text[5] = text[0].Remove(5, text[0].Length - 5);
                            text[6] = text[0].Remove(6, text[0].Length - 6);
                        }
                        catch { }

                        //
                        //Chat room
                        //

                        try
                        {
                            if (msg.Body.ToLower() != "" && msg.From.Resource != ID.Text)
                            {
                                try
                                {
                                    richTextBox2.AppendText(msg.From.Resource + " : " + msg.Body + "\n");
                                    this.richTextBox2.SelectionStart = this.richTextBox2.Text.Length;
                                    this.richTextBox2.SelectionLength = 0;
                                    this.richTextBox2.ScrollToCaret();
                                }
                                catch { }
                            }
                            else if (msg.From.Resource == ID.Text)
                            {
                                if (msg.Body.ToLower() != "")
                                {
                                    richTextBox2.AppendText(msg.From.Resource + " : " + msg.Body + "\n");
                                    this.richTextBox2.SelectionStart = this.richTextBox2.Text.Length;
                                    this.richTextBox2.SelectionLength = 0;
                                    this.richTextBox2.ScrollToCaret();
                                }
                            }
                        }
                        catch { }
                }
             }
          }

      Current date/time is Thu May 02, 2024 10:42 am