protected void processInboundData(string data)
{
try
{
var node = this.reader.nextTree(data);
while (node != null)
{
this.WhatsParser.ParseProtocolNode(node);
this.DebugPrint(node.NodeString("RECVD: "));
if (node.tag.Equals("challenge", StringComparison.OrdinalIgnoreCase))
{
this.processChallenge(node);
}
else if (node.tag.Equals("success", StringComparison.OrdinalIgnoreCase))
{
this.loginStatus = this.connectedStatus;
this.accountinfo = new AccountInfo(node.GetAttribute("status"),
node.GetAttribute("kind"),
node.GetAttribute("creation"),
node.GetAttribute("expiration"));
}
if (node.tag.Equals("message", StringComparison.OrdinalIgnoreCase))
{
this.AddMessage(node);
this.sendMessageReceived(node);
}
if (node.tag.Equals("iq", StringComparison.OrdinalIgnoreCase)
&& node.GetAttribute("type").Equals("get", StringComparison.OrdinalIgnoreCase)
&& node.children.First().tag.Equals("ping", StringComparison.OrdinalIgnoreCase))
{
this.Pong(node.GetAttribute("id"));
}
node = this.reader.nextTree();
}
}
catch (IncompleteMessageException e)
{
}
}