本文整理汇总了C#中agsXMPP.SwitchDirection方法的典型用法代码示例。如果您正苦于以下问题:C# agsXMPP.SwitchDirection方法的具体用法?C# agsXMPP.SwitchDirection怎么用?C# agsXMPP.SwitchDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agsXMPP
的用法示例。
在下文中一共展示了agsXMPP.SwitchDirection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmppCon_OnIq
private void XmppCon_OnIq(object sender, agsXMPP.protocol.client.IQ iq)
{
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 IqHandler(XmppCon_OnIq), new object[] { sender, iq });
return;
}
if (iq != null)
{
// No Iq with query
if (iq.HasTag(typeof(agsXMPP.protocol.extensions.si.SI)))
{
if (iq.Type == IqType.set)
{
agsXMPP.protocol.extensions.si.SI si = iq.SelectSingleElement(typeof(agsXMPP.protocol.extensions.si.SI)) as agsXMPP.protocol.extensions.si.SI;
agsXMPP.protocol.extensions.filetransfer.File file = si.File;
if (file != null)
{
// somebody wants to send a file to us
Console.WriteLine(file.Size.ToString());
Console.WriteLine(file.Name);
frmFileTransfer frmFile = new frmFileTransfer(XmppCon, iq);
frmFile.Show();
}
}
}
else
{
Element query = iq.Query;
if (query != null)
{
if (query.GetType() == typeof(agsXMPP.protocol.iq.version.Version))
{
// its a version IQ VersionIQ
agsXMPP.protocol.iq.version.Version version = query as agsXMPP.protocol.iq.version.Version;
if (iq.Type == IqType.get)
{
// Somebody wants to know our client version, so send it back
iq.SwitchDirection();
iq.Type = IqType.result;
version.Name = "MiniClient";
version.Ver = "0.5";
version.Os = Environment.OSVersion.ToString();
XmppCon.Send(iq);
}
}
}
}
}
}
示例2: XmppCon_OnIq
private void XmppCon_OnIq(object sender, agsXMPP.protocol.client.IQ iq)
{
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 IqHandler(XmppCon_OnIq), new object[]{sender, iq});
return;
}
Element query = iq.Query;
if (query !=null)
{
if (query.GetType() == typeof(agsXMPP.protocol.iq.version.Version))
{
// its a version IQ VersionIQ
agsXMPP.protocol.iq.version.Version version = query as agsXMPP.protocol.iq.version.Version;
if (iq.Type == IqType.get)
{
// Somebody wants to know our client version, so send it back
iq.SwitchDirection();
iq.Type = IqType.result;
version.Name = "MiniClient";
version.Ver = "0.5";
version.Os = Environment.OSVersion.ToString();
XmppCon.Send(iq);
}
}
}
}
示例3: SwitchIQ
public void SwitchIQ(agsXMPP.protocol.client.IQ iq)
{
if (iq == null) return;
// No Iq with query
if (iq.HasTag(typeof(SI)))
{
if (iq.Type == IqType.set)
{
SI si = iq.SelectSingleElement(typeof(SI)) as SI;
agsXMPP.protocol.extensions.filetransfer.File file = si.File;
if (file != null)
{
// somebody wants to send a file to us
AddLog(string.Concat("Alguien esta enviando un archivo Size:", file.Size.ToString(), " nombre: ", file.Name));
//frmFileTransfer frmFile = new frmFileTransfer(XmppCon, iq);
//frmFile.Show();
}
}
}
if (iq.Type == IqType.error)
{
//if (iq.Error.Code == agsXMPP.protocol.client.ErrorCode.NotFound)
//{
string msg = string.Concat(iq.From ," ", iq.Error.Condition);
AddLog(msg);
//}
}
if (iq.Type == IqType.get)
{
if (iq.Query != null)
{
if (iq.Query is DiscoInfo)
{
//iq.SwitchDirection();
//iq.Type = IqType.result;
//DiscoInfo di = getDiscoInfo();
//iq.Query = di;
//XmppCon.Send(iq);
}
else if (iq.Query is DiscoItems)
{
//iq.SwitchDirection();
//iq.Type = IqType.error;
//iq.Error = new Error(ErrorType.cancel, ErrorCondition.FeatureNotImplemented);
//XmppCon.Send(iq);
}
else if (iq.Query is agsXMPP.protocol.iq.version.Version)
{
//Suichea from y to
iq.SwitchDirection();
iq.Type = IqType.result;//indica retorno o respuesta
agsXMPP.protocol.iq.version.Version version = iq.Query as agsXMPP.protocol.iq.version.Version;
version.Name = Assembly.GetExecutingAssembly().GetName().Name;
version.Ver = Assembly.GetExecutingAssembly().GetName().Version.ToString();
version.Os = Environment.OSVersion.ToString();
Util.XmppServices.XmppCon.Send(iq);
//frmMain.AddLog("IQ: tipo vesion");
}
else if (iq.Query is agsXMPP.protocol.iq.last.Last)
{
//iq.SwitchDirection();
//iq.Type = IqType.result;
//agsXMPP.protocol.iq.last.Last last = iq.Query as agsXMPP.protocol.iq.last.Last;
//last.Seconds = new TimeSpan(Jabber._presence.getLastActivityTicks()).Seconds;
//Jabber.xmpp.Send(iq);
}
else if (iq.Query is agsXMPP.protocol.iq.time.Time)
{
iq.SwitchDirection();
iq.Type = IqType.result;
agsXMPP.protocol.iq.time.Time time = iq.Query as agsXMPP.protocol.iq.time.Time;
time.Display = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
time.Tz = TimeZone.CurrentTimeZone.StandardName;
time.Utc = agsXMPP.util.Time.ISO_8601Date(DateTime.Now);
Util.XmppServices.XmppCon.Send(iq);
}
else if (iq.Query is agsXMPP.protocol.extensions.ping.Ping)
{
iq.SwitchDirection();
iq.Type = IqType.result;
agsXMPP.protocol.extensions.ping.Ping ping = iq.Query as agsXMPP.protocol.extensions.ping.Ping;
Util.XmppServices.XmppCon.Send(iq);
}
else if (iq.Query is agsXMPP.protocol.iq.avatar.Avatar)
{
iq.SwitchDirection();
iq.Type = IqType.result;
agsXMPP.protocol.iq.avatar.Avatar avatar = iq.Query as agsXMPP.protocol.iq.avatar.Avatar;
avatar.Data = null;
if (Jabber._identity.photo != null && Jabber._identity.photoFormat != null)
{
MemoryStream ms = new MemoryStream();
Jabber._identity.photo.Save(ms, Jabber._identity.photoFormat);
//.........这里部分代码省略.........