Subject: agsxmpp trouble Sending and receiving messages more than once
Hello, I'm working on a simple test application to help me get the basics of agsxmpp. I'm having difficulty keeping the thread open to send or receive messages more than once. Below is my code, I've done everything I can think of to make this work, so any help would be greatly appreciated. This is a simple gtk# application running on mono 4.0.
- using System;
- using System.ComponentModel;
- using System.Threading;
- using Gtk;
- using agsXMPP;
- using agsXMPP.protocol.client;
- using agsXMPP.protocol.iq.roster;
- using agsXMPP.protocol.iq.vcard;
- public partial class MainWindow: Gtk.Window
- {
- Gtk.TextBuffer buffer;
- XmppClientConnection xmpp;
- Thread worker;
- ManualResetEvent mre;
- public MainWindow (): base (Gtk.WindowType.Toplevel)
- {
- Build ();
- worker.Start();
- }
- protected void OnDeleteEvent (object sender, DeleteEventArgs a)
- {
- Application.Quit ();
- a.RetVal = true;
- }
- void Login() {
- xmpp.Server = "gmail.com";
- xmpp.ConnectServer = "talk.google.com";
- xmpp.Username = "myUsername";
- xmpp.Password = "mypwd";
- xmpp.Open();
- xmpp.KeepAlive = true;
- msg.Type = agsXMPP.protocol.client.MessageType.chat;
- msg.To = JID;
- msg.Body = "Test software test...English you fail me again! " + DateTime.Now.ToString();
- buffer = textview4.Buffer;
- xmpp.OnLogin += delegate(object o) { xmpp.Send(msg); buffer.Text += "kinda round about damn"; };
- mre.WaitOne ();
- }
- void GrabMessage (object sender, agsXMPP.protocol.client.Message msg)
- {
- buffer.Text += " From: " + msg.From + " " + msg.Body;
- }
- protected void OnTogglebutton1Clicked (object sender, EventArgs e)
- {
- mre.Close();
- worker.Abort();
- }
- }