Subject: nullreferenceexception with subscribe
Hello.
I am trying to do a xmpp client with matrix, and i have problem with subscription.
I want the user to be able to invite people, and chat with them. But the invitation part does not work. for example, i have:
public XmppClient xmpp;
public PresenceManager pm;
public ClientConstructor(string JabberID, string password, string status)
{
senderJIDM = JabberID;
pass = password;
senderJIDM = new Jid(JabberID);
xmpp = new XmppClient();
xmpp.SetUsername(senderJIDM.User);
xmpp.SetXmppDomain(senderJIDM.Server);
xmpp.Status = status;
xmpp.Password = password;
xmpp.Show = Matrix.Xmpp.Show.chat;
// Trying to connect...
try
{
xmpp.Open();
}
catch
{
MessageBox.Show("Wrong login data!");
}
xmpp.AutoRoster = true;
xmpp.OnRosterItem += new EventHandler<Matrix.Xmpp.Roster.RosterEventArgs>(xmpp_OnItem);
xmpp.OnAuthError += new EventHandler<Matrix.Xmpp.Sasl.SaslEventArgs>(xmpp_OnAuthError);
xmpp.OnRosterEnd += new EventHandler<Matrix.EventArgs>(xmpp_OnEnd);
xmpp.OnError += new EventHandler<Matrix.ExceptionEventArgs>(xmppClient_OnError);
xmpp.OnIq += new EventHandler<IqEventArgs>(xmppClient_OnIq);
xmpp.OnPresence += new EventHandler<PresenceEventArgs>(xmpp_OnPresence);
xmpp.OnMessage += new EventHandler<MessageEventArgs>(xmpp_OnMessage);
xmpp.OnBind += new System.EventHandler<JidEventArgs>(xmppClient_OnBind);
pm = new PresenceManager(xmpp);
pm.OnSubscribe += new EventHandler<PresenceEventArgs>(presenceManager_OnSubscribe);
}
public void suscribeToThisSite(string user)
{
Jid jid = user + "@gmail.com";
pm.Subscribe(jid);
}
And so, whenever i call suscribeToThisSite(string user), i have the xmpp.OnError event raised, the exception message being something like: nullreferenceexception, at Matrix.Net.ClientSocket.Send(Byte[] bData)
What do you think causes this error?
I am trying to do a xmpp client with matrix, and i have problem with subscription.
I want the user to be able to invite people, and chat with them. But the invitation part does not work. for example, i have:
public XmppClient xmpp;
public PresenceManager pm;
public ClientConstructor(string JabberID, string password, string status)
{
senderJIDM = JabberID;
pass = password;
senderJIDM = new Jid(JabberID);
xmpp = new XmppClient();
xmpp.SetUsername(senderJIDM.User);
xmpp.SetXmppDomain(senderJIDM.Server);
xmpp.Status = status;
xmpp.Password = password;
xmpp.Show = Matrix.Xmpp.Show.chat;
// Trying to connect...
try
{
xmpp.Open();
}
catch
{
MessageBox.Show("Wrong login data!");
}
xmpp.AutoRoster = true;
xmpp.OnRosterItem += new EventHandler<Matrix.Xmpp.Roster.RosterEventArgs>(xmpp_OnItem);
xmpp.OnAuthError += new EventHandler<Matrix.Xmpp.Sasl.SaslEventArgs>(xmpp_OnAuthError);
xmpp.OnRosterEnd += new EventHandler<Matrix.EventArgs>(xmpp_OnEnd);
xmpp.OnError += new EventHandler<Matrix.ExceptionEventArgs>(xmppClient_OnError);
xmpp.OnIq += new EventHandler<IqEventArgs>(xmppClient_OnIq);
xmpp.OnPresence += new EventHandler<PresenceEventArgs>(xmpp_OnPresence);
xmpp.OnMessage += new EventHandler<MessageEventArgs>(xmpp_OnMessage);
xmpp.OnBind += new System.EventHandler<JidEventArgs>(xmppClient_OnBind);
pm = new PresenceManager(xmpp);
pm.OnSubscribe += new EventHandler<PresenceEventArgs>(presenceManager_OnSubscribe);
}
public void suscribeToThisSite(string user)
{
Jid jid = user + "@gmail.com";
pm.Subscribe(jid);
}
And so, whenever i call suscribeToThisSite(string user), i have the xmpp.OnError event raised, the exception message being something like: nullreferenceexception, at Matrix.Net.ClientSocket.Send(Byte[] bData)
What do you think causes this error?