khobin???khaste nabashid8-)
azizan mikhastam bedonam get profile ro
bekham b bot online ezaf konam chetor
hame chize midonam
just nemidonam cheto to pv taraf bayad piyade
she age y xml bedid ya y rahnamaee dameton garm
:@}->--:
No user |
Nima.Send("<iq to='" + (msg.Body.Replace("p/", "").Replace("&", "&").Replace("'", "'").Replace("\"", """).Replace(">", ">").Replace("<", "<")) + "@nimbuzz.com' type='get' id='CsharpTeaM'><query xmlns='http://jabber.org/protocol/profile'/></iq>");
if (msg.Body == "p/")
{
// masalan Nima.Send(xml get profilo mizari bad to xml bejaye id mizari (msg.Body.Replase("p/", "")) );
}
private void button1_Click(object sender, EventArgs e)
{
x.Server = "nimbuzz.com";
x.ConnectServer = "o.nimbuzz.com";
x.Open(textBox1.Text, textBox2.Text, textBox3.Text, 50);
x.OnAuthError += new XmppElementHandler(failed);
x.OnLogin += new ObjectHandler(connected);
x.OnClose += new ObjectHandler(dc);
x.OnReadXml += new agsXMPP.XmlHandler(OnReadXml);
x.OnMessage += new agsXMPP.protocol.client.MessageHandler(cnt_OnMessage);
}
private void failed(object sender, Element e)
{
if (base.InvokeRequired)
{
base.BeginInvoke(new XmppElementHandler(failed), new object[] { sender, e });
}
else
{
textBox1.BackColor = Color.Red;
textBox2.BackColor = Color.Red;
textBox3.BackColor = Color.Red;
textBox1.Enabled = true;
textBox2.Enabled = true;
textBox3.Enabled = true;
}
}
private void connected(object sender)
{
if (base.InvokeRequired)
{
base.BeginInvoke(new ObjectHandler(connected), new object[] { sender });
}
else
{
textBox1.BackColor = Color.Green;
textBox2.BackColor = Color.Green;
textBox3.BackColor = Color.Green;
textBox1.Enabled = false;
textBox2.Enabled = false;
textBox3.Enabled = false;
}
}
private void dc(object sender)
{
if (base.InvokeRequired)
{
base.BeginInvoke(new ObjectHandler(dc), new object[] { sender });
}
else
{
textBox1.BackColor = Color.Yellow;
textBox2.BackColor = Color.Yellow;
textBox3.BackColor = Color.Yellow;
textBox1.Enabled = true;
textBox2.Enabled = true;
textBox3.Enabled = true;
}
}
void cnt_OnMessage(object sender, agsXMPP.protocol.client.Message Msg)
{
if (InvokeRequired)
BeginInvoke(new agsXMPP.protocol.client.MessageHandler(cnt_OnMessage), new object[] { sender, Msg });
else
{
if (Msg.Body.ToLower().Contains("p/"))
{
x.Send("<iq to='" + Msg.Body.Replace("p/", "") + "@nimbuzz.com' type='get' id='amirslr'><query xmlns='http://jabber.org/protocol/profile'/></iq>");
}
}
}
private void button3_Click(object sender, EventArgs e)
{
x.Send("<iq to='" + textBox4.Text + "@nimbuzz.com' type='get' id='jonewaram'><query xmlns='http://jabber.org/protocol/profile'/></iq>");
}
private void OnReadXml(object sender, string xml)
{
if (InvokeRequired)
{
BeginInvoke(new XmlHandler(OnReadXml), new object[] { sender, xml });
return;
}
else
{
xml = Strings.Replace(xml, "\"", "'", 1, -1, CompareMethod.Text);
if (((Strings.InStr(xml,"<value>http://jabber.org/protocol/profile</value>",CompareMethod.Binary) != 0)))
{
string PRo = xml;
if ((Strings.InStr(PRo, "'status'", CompareMethod.Binary) != 0))
{
string prSTS = PRo.Substring(PRo.IndexOf("<field var='status'") + 1);
prSTS = prSTS.Substring(0, prSTS.IndexOf("</") - 0);
string stSKH = prSTS.Substring(prSTS.IndexOf(">") + 2);
string STS = stSKH.Substring(stSKH.IndexOf(">") + 1);
label4.Text += STS;
}
if ((Strings.InStr(PRo, "'nickname'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='nickname'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string Nick = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label5.Text += Nick;
}
if ((Strings.InStr(PRo, "'street'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='street'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string street = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label6.Text += street;
}
if ((Strings.InStr(PRo, "'locality'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='locality'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string local = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label7.Text += local;
}
if ((Strings.InStr(PRo, "'country'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='country'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string con = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label8.Text += con;
}
if ((Strings.InStr(PRo, "'username'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='username'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string user = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label9.Text += user;
}
}
}
}
}
}
private void button1_Click(object sender, EventArgs e)
{
x.Server = "nimbuzz.com";
x.ConnectServer = "o.nimbuzz.com";
x.Open(textBox1.Text, textBox2.Text, textBox3.Text, 50);
x.OnAuthError += new XmppElementHandler(failed);
x.OnLogin += new ObjectHandler(connected);
x.OnClose += new ObjectHandler(dc);
x.OnReadXml += new agsXMPP.XmlHandler(OnReadXml);
x.OnMessage += new agsXMPP.protocol.client.MessageHandler(cnt_OnMessage);
}
private void failed(object sender, Element e)
{
if (base.InvokeRequired)
{
base.BeginInvoke(new XmppElementHandler(failed), new object[] { sender, e });
}
else
{
textBox1.BackColor = Color.Red;
textBox2.BackColor = Color.Red;
textBox3.BackColor = Color.Red;
textBox1.Enabled = true;
textBox2.Enabled = true;
textBox3.Enabled = true;
}
}
private void connected(object sender)
{
if (base.InvokeRequired)
{
base.BeginInvoke(new ObjectHandler(connected), new object[] { sender });
}
else
{
textBox1.BackColor = Color.Green;
textBox2.BackColor = Color.Green;
textBox3.BackColor = Color.Green;
textBox1.Enabled = false;
textBox2.Enabled = false;
textBox3.Enabled = false;
}
}
private void dc(object sender)
{
if (base.InvokeRequired)
{
base.BeginInvoke(new ObjectHandler(dc), new object[] { sender });
}
else
{
textBox1.BackColor = Color.Yellow;
textBox2.BackColor = Color.Yellow;
textBox3.BackColor = Color.Yellow;
textBox1.Enabled = true;
textBox2.Enabled = true;
textBox3.Enabled = true;
}
}
void cnt_OnMessage(object sender, agsXMPP.protocol.client.Message Msg)
{
if (InvokeRequired)
BeginInvoke(new agsXMPP.protocol.client.MessageHandler(cnt_OnMessage), new object[] { sender, Msg });
else
{
if (Msg.Body.ToLower().Contains("p/"))
{
x.Send("<iq to='" + Msg.Body.Replace("p/", "") + "@nimbuzz.com' type='get' id='amirslr'><query xmlns='http://jabber.org/protocol/profile'/></iq>");
}
}
}
private void button3_Click(object sender, EventArgs e)
{
x.Send("<iq to='" + textBox4.Text + "@nimbuzz.com' type='get' id='jonewaram'><query xmlns='http://jabber.org/protocol/profile'/></iq>");
}
private void OnReadXml(object sender, string xml)
{
if (InvokeRequired)
{
BeginInvoke(new XmlHandler(OnReadXml), new object[] { sender, xml });
return;
}
else
{
xml = Strings.Replace(xml, "\"", "'", 1, -1, CompareMethod.Text);
if (((Strings.InStr(xml,"<value>http://jabber.org/protocol/profile</value>",CompareMethod.Binary) != 0)))
{
string PRo = xml;
if ((Strings.InStr(PRo, "'status'", CompareMethod.Binary) != 0))
{
string prSTS = PRo.Substring(PRo.IndexOf("<field var='status'") + 1);
prSTS = prSTS.Substring(0, prSTS.IndexOf("</") - 0);
string stSKH = prSTS.Substring(prSTS.IndexOf(">") + 2);
string STS = stSKH.Substring(stSKH.IndexOf(">") + 1);
label4.Text += STS;
}
if ((Strings.InStr(PRo, "'nickname'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='nickname'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string Nick = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label5.Text += Nick;
}
if ((Strings.InStr(PRo, "'street'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='street'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string street = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label6.Text += street;
}
if ((Strings.InStr(PRo, "'locality'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='locality'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string local = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label7.Text += local;
}
if ((Strings.InStr(PRo, "'country'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='country'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string con = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label8.Text += con;
}
if ((Strings.InStr(PRo, "'username'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='username'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string user = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
label9.Text += user;
}
}
}
}
}
}
string b = textBox1.Text//jaye ke profile behet neshon mide
x.OnMessage += new agsXMPP.protocol.client.MessageHandler(cnt_OnMessage1);
void cnt_OnMessage1(object sender, agsXMPP.protocol.client.Message Msg)
{
if (InvokeRequired)
BeginInvoke(new agsXMPP.protocol.client.MessageHandler(cnt_OnMessage1), new object[] { sender, Msg });
else
{
if (Msg.Body.ToLower().Contains("p/"))
{
textBox2.Text = (Msg.Body.ToLower().Replace("p/", ""))// Textbox2 jaye ke idi taraf midi ke profilesho begiri
x.Send("<message to=\"" + Msg.From + "\" type=\"chat\"><body>" + b + "</body></message>");
}
}
}
if(msg.Body.ToLower().StartsWith("p/"))
{
MessageFrom = msg.From.ToString();
ram.Send("<iq to='" + (msg.Body.Replace("p/", "").Replace("&", "&").Replace("'", "'").Replace("\"", """).Replace(">", ">").Replace("<", "<")) + "@nimbuzz.com' type='get' id='CsharpTeaM'><query xmlns='http://jabber.org/protocol/profile'/></iq>");
}
private string Profile, MessageFrom;
private void OnReadXml(object sender, string xml)
{
if (InvokeRequired)
{
BeginInvoke(new XmlHandler(OnReadXml), new object[] { sender, xml });
return;
}
else
{
xml = Strings.Replace(xml, "\"", "'", 1, -1, CompareMethod.Text);
if (((Strings.InStr(xml, "<value>http://jabber.org/protocol/profile</value>", CompareMethod.Binary) != 0)))
{
string PRo = xml;
Profile = "";
if ((Strings.InStr(PRo, "'status'", CompareMethod.Binary) != 0))
{
string prSTS = PRo.Substring(PRo.IndexOf("<field var='status'") + 1);
prSTS = prSTS.Substring(0, prSTS.IndexOf("</") - 0);
string stSKH = prSTS.Substring(prSTS.IndexOf(">") + 2);
string STS = stSKH.Substring(stSKH.IndexOf(">") + 1);
Profile += STS;
}
if ((Strings.InStr(PRo, "'nickname'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='nickname'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string Nick = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
Profile += Nick;
}
if ((Strings.InStr(PRo, "'street'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='street'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string street = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
Profile += street;
}
if ((Strings.InStr(PRo, "'locality'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='locality'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string local = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
Profile += local;
}
if ((Strings.InStr(PRo, "'country'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='country'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string con = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
Profile += con;
}
if ((Strings.InStr(PRo, "'username'", CompareMethod.Binary) != 0))
{
string prSTS1 = PRo.Substring(PRo.IndexOf("<field var='username'") + 1);
prSTS1 = prSTS1.Substring(0, prSTS1.IndexOf("</") - 0);
string stSKH1 = prSTS1.Substring(prSTS1.IndexOf(">") + 2);
string user = stSKH1.Substring(stSKH1.IndexOf(">") + 1);
Profile += user;
ram.Send(new agsXMPP.protocol.client.Message(new Jid(MessageFrom),MessageType.chat, Profile));
Profile = null;
MessageFrom = null;
}
}
}
}