本文整理汇总了C#中IQ.GetResponse方法的典型用法代码示例。如果您正苦于以下问题:C# IQ.GetResponse方法的具体用法?C# IQ.GetResponse怎么用?C# IQ.GetResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQ
的用法示例。
在下文中一共展示了IQ.GetResponse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: jc_OnIQ
private void jc_OnIQ(object sender, IQ iq)
{
if (iq.Type != IQType.get)
return;
XmlElement query = iq.Query;
if (query == null)
return;
// <iq id="jcl_8" to="me" from="you" type="get"><query xmlns="jabber:iq:version"/></iq>
if (query is jabber.protocol.iq.Version)
{
iq = iq.GetResponse(jc.Document);
jabber.protocol.iq.Version ver = iq.Query as jabber.protocol.iq.Version;
if (ver != null)
{
ver.OS = Environment.OSVersion.ToString();
ver.EntityName = Application.ProductName;
ver.Ver = Application.ProductVersion;
}
jc.Write(iq);
return;
}
if (query is Time)
{
iq = iq.GetResponse(jc.Document);
Time tim = iq.Query as Time;
if (tim != null) tim.SetCurrentTime();
jc.Write(iq);
return;
}
if (query is Last)
{
iq = iq.GetResponse(jc.Document);
Last last = iq.Query as Last;
if (last != null) last.Seconds = (int)IdleTime.GetIdleTime();
jc.Write(iq);
return;
}
}
示例2: HandleOnIQ
protected void HandleOnIQ(Object sender, IQ iq) {
if(iq.Query != null && iq.Query.NamespaceURI != null &&
iq.Query.NamespaceURI == SVPNKEYNS) {
if(iq.Type == IQType.get) {
iq = iq.GetResponse(_jclient.Document);
iq.Query.SetAttribute("value", GetQueryResponse());
_jclient.Write(iq);
}
else if(iq.Type == IQType.result) {
string uid = iq.From.User + "@" + iq.From.Server;
ProcessResponse(iq.Query.GetAttribute("value"), uid);
}
}
}
示例3: jc_OnIQ
private void jc_OnIQ(object sender, IQ iq)
{
if (!IsCaps(iq))
return;
DiscoInfo info = iq.Query as DiscoInfo;
if (info == null)
return;
IQ resp = iq.GetResponse(m_stream.Document);
info = (DiscoInfo)resp.Query;
FillInInfo(info);
Write(resp);
}
示例4: HandleOnIQ
private void HandleOnIQ(Object sender, IQ iq)
{
if(iq.Query != null && iq.Query.NamespaceURI != null &&
iq.Query.NamespaceURI == SVPNKEYNS) {
if(iq.Type == IQType.get) {
iq = iq.GetResponse(_jclient.Document);
iq.Query.SetAttribute("value", _local_user.DhtKey);
_jclient.Write(iq);
}
else if (iq.Type == IQType.result) {
string friend = iq.From.User + "@" + iq.From.Server;
string fpr = iq.Query.GetAttribute("value");
if(_friends.ContainsKey(friend)) {
if(!_friends[friend].Contains(fpr)) {
_friends[friend].Add(fpr);
}
}
else {
List<string> fprs = new List<string>();
fprs.Add(fpr);
_friends.Add(friend, fprs);
Console.WriteLine("Friend {0} at {1}", friend, fpr);
}
}
}
}