void OnStreamError(object sender, agsXMPP.Xml.Dom.Element e)
{
Trace.Call(sender, e);
var error = e as agsXMPP.protocol.Error;
var builder = CreateMessageBuilder();
builder.AppendEventPrefix();
// TODO: create user readable error messages from the error.Condition
//builder.AppendErrorText(error.Condition.ToString());
switch (error.Condition) {
case StreamErrorCondition.SystemShutdown:
builder.AppendErrorText(_("The server has shut down"));
break;
case StreamErrorCondition.Conflict:
builder.AppendErrorText(_("Another client logged in with the same resource, you have been disconnected"));
break;
case StreamErrorCondition.SeeOtherHost:
Server.Hostname = e.GetTag("see-other-host");
Reconnect(null);
break;
default:
builder.AppendErrorText(error.Text ?? error.Condition.ToString());
break;
}
Session.AddMessageToChat(NetworkChat, builder.ToMessage());
}