Raju parmar

Raju parmar

  • NA
  • 11
  • 2.4k

Integrate Gtalk in Web OR Windows Application.

Jan 17 2014 6:23 AM
Hii,
 
i need a help for google talk integrate in web or window in c# application.
 
in my from i text box and on button . i want to send textbox value to gtalk through any one user who are in my gtalk contact.
 
this process on button click how is it possible.
 
i have some code  :
 
private void btnSend_Click(object sender, EventArgs e)
{
XmppClientConnection xmpp = new XmppClientConnection();
xmpp.Server = "gmail.com";
xmpp.ConnectServer = "talk.google.com";
xmpp.Port = 5222;
xmpp.Username = "[email protected]";
xmpp.Password = "******";
xmpp.Open();
agsXMPP.Jid JID = new Jid("[email protected]");
xmpp.MesagageGrabber.Add(JID, new agsXMPP.Collections.BareJidComparer(), new MessageCB(MessageCallBack), null);
agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();
msg.Type = agsXMPP.protocol.client.MessageType.chat;
msg.To = JID;
msg.Body = "vd998988998a50 " // this is text box value
xmpp.OnLogin += delegate(object o) { xmpp.Send(msg); };
xmpp.Close();
}
static void MessageCallBack(object sender,agsXMPP.protocol.client.Message msg,object data)
{
if (msg.Body != null)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("{0}>> {1}", msg.From.User, msg.Body);
Console.ForegroundColor = ConsoleColor.Green;
}
}
 
 
 

Answers (2)