public override void StreamParserOnStreamElement(object sender, Node e)
{
base.StreamParserOnStreamElement (sender, e);
if (e is Handshake)
{
m_Authenticated = true;
if (OnLogin != null)
OnLogin(this);
if (KeepAlive)
CreateKeepAliveTimer();
}
else if (e is Route)
{
if (OnRoute != null)
OnRoute(this, e as Route);
}
else if (e is protocol.Error)
{
protocol.Error streamErr = e as protocol.Error;
switch (streamErr.Condition)
{
// Auth errors are important for the users here, so throw catch auth errors
// in a separate event here
case agsXMPP.protocol.StreamErrorCondition.NotAuthorized:
// Authentication Error
if (OnAuthError != null)
OnAuthError(this, e as Element);
break;
default:
if (OnStreamError != null)
OnStreamError(this, e as Element);
break;
}
}
else if (e is Message)
{
if (OnMessage != null)
OnMessage(this, e as Message);
}
else if (e is Presence)
{
if (OnPresence != null)
OnPresence(this, e as Presence);
}
else if (e is IQ)
{
if (OnIq != null)
OnIq(this, e as IQ);
}
}