本文整理汇总了C#中IQ.GetAcknowledge方法的典型用法代码示例。如果您正苦于以下问题:C# IQ.GetAcknowledge方法的具体用法?C# IQ.GetAcknowledge怎么用?C# IQ.GetAcknowledge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQ
的用法示例。
在下文中一共展示了IQ.GetAcknowledge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GotIQ
/// <summary>
/// Analyses an IQ paquet and chooses to handle it or not
/// </summary>
/// <param name="sender"></param>
/// <param name="iq"></param>
private void GotIQ(object sender, IQ iq)
{
if (!iq.Handled &&
iq.Query != null && iq.Type == IQType.get &&
iq.Query.NamespaceURI == URI.PING)
{
iq.Handled = true;
this.Write(iq.GetAcknowledge(m_stream.Document));
}
}
示例2: GotIQ
/// <summary>
/// Analyses an IQ paquet and chooses to handle it or not
/// </summary>
/// <param name="sender"></param>
/// <param name="iq"></param>
private void GotIQ(object sender, IQ iq)
{
Jingle jingle = iq.Query as Jingle;
if (jingle != null)
{
if (jingle.Action == ActionType.session_terminate)
{
this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));
if (this.OnReceivedSessionTerminate != null)
this.OnReceivedSessionTerminate(this, iq);
if (this.Sessions.ContainsKey(jingle.Sid))
this.Sessions.Remove(jingle.Sid);
iq.Handled = true;
}
else
{
if (!this.AllowSessionInitiateFrom(iq.From))
{
this.SessionTerminate(iq.From, jingle.Sid, ReasonType.security_error);
iq.Handled = true;
}
else
{
switch (jingle.Action)
{
case ActionType.session_initiate:
this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));
if (!this.Sessions.ContainsKey(jingle.Sid))
{
JingleSession jingleSession = new JingleSession();
jingleSession.SID = jingle.Sid;
jingleSession.Remote = jingle;
this.Sessions.Add(jingle.Sid, jingleSession);
}
if (this.OnReceivedSessionInitiate != null)
this.OnReceivedSessionInitiate(this, iq);
if (!iq.Handled)
{
this.SessionTerminate(iq.From, jingle.Sid, ReasonType.decline);
iq.Handled = true;
}
break;
case ActionType.session_accept:
this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));
if (!this.Sessions.ContainsKey(jingle.Sid))
{
JingleSession jingleSession = new JingleSession();
jingleSession.SID = jingle.Sid;
jingleSession.Remote = jingle;
this.Sessions.Add(jingle.Sid, jingleSession);
}
if (this.OnReceivedSessionAccept != null)
this.OnReceivedSessionAccept(this, iq);
if (!iq.Handled)
{
this.SessionTerminate(iq.From, jingle.Sid, ReasonType.cancel);
iq.Handled = true;
}
break;
case ActionType.session_info:
if (this.Sessions.ContainsKey(jingle.Sid))
this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));
else
this.Stream.Write(new UnknownSession(this.Stream.Document));
if (this.OnReceivedSessionInfo != null)
this.OnReceivedSessionInfo(this, iq);
break;
case ActionType.transport_info:
if (this.Sessions.ContainsKey(jingle.Sid))
this.Stream.Write(iq.GetAcknowledge(this.Stream.Document));
else
this.Stream.Write(new UnknownSession(this.Stream.Document));
if (this.OnReceivedTransportInfo != null)
this.OnReceivedTransportInfo(this, iq);
//.........这里部分代码省略.........