private void OnConfigure(object sender, IQ iq, object data)
{
if (iq == null)
{
if (OnError != null)
OnError(this, new PubSubException(Op.CONFIGURE, "IQ timeout", null));
return;
}
if (iq.Type != IQType.result)
{
string msg = string.Format("Error configuring pubsub node: {0}", iq.Error.Condition);
Debug.WriteLine(msg);
if (OnError != null)
OnError(this, new PubSubException(Op.CONFIGURE, msg, iq));
return;
}
PubSubOwner ow = iq.Query as PubSubOwner;
if (ow == null)
{
if (OnError != null)
OnError(this, new PubSubException(Op.CONFIGURE, "Invalid protocol", iq));
return;
}
OwnerConfigure conf = ow.Command as OwnerConfigure;
if (conf == null)
{
if (OnError != null)
OnError(this, new PubSubException(Op.CONFIGURE, "Invalid protocol", iq));
return;
}
IQTracker.TrackerData td = data as IQTracker.TrackerData;
td.Call(this, iq);
}