Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
pavneet9@yahoo.com #1
Member since Dec 2013 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: Gtalk Bot Problem
  1. Imports agsXMPP
  2. Imports Microsoft.Win32
  3. Partial Class gtalk
  4.     Inherits System.Web.UI.Page
  5.     Dim username As String, Password As String, automaticstart As Boolean, message As String
  6.     Dim objXmpp As agsXMPP.XmppClientConnection
  7.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  8.  
  9.         Dim xmpp As New XmppClientConnection
  10.         xmpp.Server = "gmail.com"
  11.         xmpp.ConnectServer = "talk.google.com"
  12.         xmpp.Username = "abc@gmail.com"
  13.         xmpp.Password = "123456"
  14.         xmpp.Open()
  15.         Dim jid1 As Jid
  16.         jid1 = New Jid("ggnwt1@gmail.com")
  17.         xmpp.MessageGrabber.Add(jid1, New agsXMPP.Collections.BareJidComparer(), New MessageCB(AddressOf ChatResponseReceived), Nothing)
  18.         'xmpp.MessageGrabber.Add(JID, new agsXMPP.Collections.BareJidComparer(), new MessageCB(delegate(object sender, agsXMPP.protocol.client.Message msg, object data){    }), null)
  19.  
  20.  
  21.         Dim msg As protocol.client.Message = New agsXMPP.protocol.client.Message()
  22.         msg.Type = agsXMPP.protocol.client.MessageType.chat
  23.         msg.To = jid1
  24.         msg.Body = "www.mydomain.edu " + DateTime.Now.ToString()
  25.         xmpp.Send(msg)
  26.  
  27.  
  28.     End Sub
  29.  
  30.  
  31.     Private Shared Sub ChatResponseReceived(ByVal sender As Object, ByVal msg As agsXMPP.protocol.client.Message, ByVal data As Object)
  32.        
  33.     End Sub
  34.  
  35. End Class

Please Check WHy This Code Is Not Sending Message To Gtalk Messenger
This post was edited on 2013-12-21, 12:24 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Because the Open call is async. You have to listen to events of agsXMPP and wait until you are connected and you session is ready. Then you can start sending your message.
Please download and study also the MiniClient example, there should be all info you need.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS