Subject: xmpp.OnMessage += new MessageHandler(xmpp_OnMessage); asp.net
private void XmppCon_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
{
if (InvokeRequired)
{
// Windows Forms are not Thread Safe, we need to invoke this
// We're not in the UI thread, so we need to call BeginInvoke
BeginInvoke(new OnMessageDelegate(XmppCon_OnMessage), new object[] { sender, msg });
return;
}
// Dont handle GroupChat Messages here, they have their own callbacks in the
// GroupChat Form
if (msg.Type == MessageType.groupchat)
return;
if (msg.Type == MessageType.error)
{
//Handle errors here
// we dont handle them in this example
return;
}
// check for xData Message
if (msg.HasTag(typeof(Data)))
{
Element e = msg.SelectSingleElement(typeof(Data));
Data xdata = e as Data;
if (xdata.Type == XDataFormType.form)
{
frmXData fXData = new frmXData(xdata);
fXData.Text = "xData Form from " + msg.From.ToString();
fXData.Show();
}
}
else if(msg.HasTag(typeof(agsXMPP.protocol.extensions.ibb.Data)))
{
// ignore IBB messages
return;
}
else
{
if (msg.Body != null)
{
if (!Util.ChatForms.ContainsKey(msg.From.Bare))
{
RosterNode rn = rosterControl.GetRosterItem(msg.From);
string nick = msg.From.Bare;
if (rn != null)
nick = rn.Text;
frmChat f = new frmChat(msg.From, XmppCon, nick);
f.Show();
f.IncomingMessage(msg);
}
}
}
}
Description of how in asp.net
if (InvokeRequired)
(
/ / Windows Forms are not Thread Safe, we need to invoke this: (
/ / We're not in the UI thread, so we need to call BeginInvoke
BeginInvoke (new OnMessageDelegate (XmppCon_OnMessage), new object [] (sender, msg));
return;
)
In order to receive information how to, agsxmppsdk inside did not receive information of the web examples
{
if (InvokeRequired)
{
// Windows Forms are not Thread Safe, we need to invoke this

// We're not in the UI thread, so we need to call BeginInvoke
BeginInvoke(new OnMessageDelegate(XmppCon_OnMessage), new object[] { sender, msg });
return;
}
// Dont handle GroupChat Messages here, they have their own callbacks in the
// GroupChat Form
if (msg.Type == MessageType.groupchat)
return;
if (msg.Type == MessageType.error)
{
//Handle errors here
// we dont handle them in this example
return;
}
// check for xData Message
if (msg.HasTag(typeof(Data)))
{
Element e = msg.SelectSingleElement(typeof(Data));
Data xdata = e as Data;
if (xdata.Type == XDataFormType.form)
{
frmXData fXData = new frmXData(xdata);
fXData.Text = "xData Form from " + msg.From.ToString();
fXData.Show();
}
}
else if(msg.HasTag(typeof(agsXMPP.protocol.extensions.ibb.Data)))
{
// ignore IBB messages
return;
}
else
{
if (msg.Body != null)
{
if (!Util.ChatForms.ContainsKey(msg.From.Bare))
{
RosterNode rn = rosterControl.GetRosterItem(msg.From);
string nick = msg.From.Bare;
if (rn != null)
nick = rn.Text;
frmChat f = new frmChat(msg.From, XmppCon, nick);
f.Show();
f.IncomingMessage(msg);
}
}
}
}
Description of how in asp.net
if (InvokeRequired)
(
/ / Windows Forms are not Thread Safe, we need to invoke this: (
/ / We're not in the UI thread, so we need to call BeginInvoke
BeginInvoke (new OnMessageDelegate (XmppCon_OnMessage), new object [] (sender, msg));
return;
)
In order to receive information how to, agsxmppsdk inside did not receive information of the web examples