Subject: Sending a message - easy question, surely!
Hi.
I'm a newbie so please excuse the dumbness of this question. I've already searched this Forum and couldn't find the answer. I am trying to create a very basic VB.NET desktop app to demo the ability to send a message from one Google chat user to another. I can connect, authenticate, send my presence, and that works fine.
What I am struggling with, is the basic task of sending the message. The problem being, it just doesn't get there. But I don't get an error, either.
At this point I am definately connected and authenticated, plus my status shows "Online" at TheRecipient's desktop.
But TheRecipent simply does not recieve the message. However, my presence shows up in their google IM client correctly. I think I'm missing something simple here, but I cannot see what it is.
Here's the relevant code; a "Send" button and a "Login" button:
_____________
Private Sub SendButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendButton.Click
Dim msg As agsXMPP.protocol.client.Message = New agsXMPP.protocol.client.Message
msg.Type = MessageType.normal
msg.Subject = "test subject"
msg.To = New Jid("TheRecipient", "gmail.com", "owentest")
msg.Body = "If you can read this, it has worked."
msg.From = New Jid("MySelf", "gmail.com", "owentest")
XMPP.Send(msg) ' <---- where does the message go? TheRecipient doesn't get it!?!?!
End Sub
Private Sub LoginButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginButton.Click
With XMPP
Dim cb As New agsXMPP.MessageCB(AddressOf MessageCallback)
Dim MyJid As New Jid("MySelf", "gmail.com", "owentest")
.MesagageGrabber.Add(MyJid, cb, Nothing)
Dim pcb As New agsXMPP.PresenceCB(AddressOf PresenceCallback)
.PresenceGrabber.Add(MyJid, pcb, Nothing)
.Server = "gmail.com"
.ConnectServer = "talk.google.com"
.Username = "MySelf"
.Password = "MyPassword"
.Port = "5222"
.UseSSL = False
.Status = "Online"
.Priority = 5
.AutoResolveConnectServer = True
.AutoRoster = True
.RegisterAccount = False
.Show = agsXMPP.protocol.client.ShowType.chat
.Open()
End With
End Sub
Private Sub PresenceCallback(ByVal sender As Object, ByVal pres As agsXMPP.protocol.client.Presence, ByVal data As Object)
Label1.Text = pres.Nickname.ToString & " status = " & pres.Status
End Sub
Private Sub MessageCallback(ByVal sender As Object, ByVal msg As agsXMPP.protocol.client.Message, ByVal data As Object)
Label1.Text = msg.From.User & " said: " & msg.Body
End Sub
___________
I'm a newbie so please excuse the dumbness of this question. I've already searched this Forum and couldn't find the answer. I am trying to create a very basic VB.NET desktop app to demo the ability to send a message from one Google chat user to another. I can connect, authenticate, send my presence, and that works fine.
What I am struggling with, is the basic task of sending the message. The problem being, it just doesn't get there. But I don't get an error, either.
At this point I am definately connected and authenticated, plus my status shows "Online" at TheRecipient's desktop.
But TheRecipent simply does not recieve the message. However, my presence shows up in their google IM client correctly. I think I'm missing something simple here, but I cannot see what it is.
Here's the relevant code; a "Send" button and a "Login" button:
_____________
Private Sub SendButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendButton.Click
Dim msg As agsXMPP.protocol.client.Message = New agsXMPP.protocol.client.Message
msg.Type = MessageType.normal
msg.Subject = "test subject"
msg.To = New Jid("TheRecipient", "gmail.com", "owentest")
msg.Body = "If you can read this, it has worked."
msg.From = New Jid("MySelf", "gmail.com", "owentest")
XMPP.Send(msg) ' <---- where does the message go? TheRecipient doesn't get it!?!?!
End Sub
Private Sub LoginButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginButton.Click
With XMPP
Dim cb As New agsXMPP.MessageCB(AddressOf MessageCallback)
Dim MyJid As New Jid("MySelf", "gmail.com", "owentest")
.MesagageGrabber.Add(MyJid, cb, Nothing)
Dim pcb As New agsXMPP.PresenceCB(AddressOf PresenceCallback)
.PresenceGrabber.Add(MyJid, pcb, Nothing)
.Server = "gmail.com"
.ConnectServer = "talk.google.com"
.Username = "MySelf"
.Password = "MyPassword"
.Port = "5222"
.UseSSL = False
.Status = "Online"
.Priority = 5
.AutoResolveConnectServer = True
.AutoRoster = True
.RegisterAccount = False
.Show = agsXMPP.protocol.client.ShowType.chat
.Open()
End With
End Sub
Private Sub PresenceCallback(ByVal sender As Object, ByVal pres As agsXMPP.protocol.client.Presence, ByVal data As Object)
Label1.Text = pres.Nickname.ToString & " status = " & pres.Status
End Sub
Private Sub MessageCallback(ByVal sender As Object, ByVal msg As agsXMPP.protocol.client.Message, ByVal data As Object)
Label1.Text = msg.From.User & " said: " & msg.Body
End Sub
___________