本文整理汇总了C#中Presence.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Presence.AddChild方法的具体用法?C# Presence.AddChild怎么用?C# Presence.AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Presence
的用法示例。
在下文中一共展示了Presence.AddChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCaps
public void TestCaps()
{
PresenceManager pp = new PresenceManager();
Presence pres = new Presence(doc);
pres.From = baz;
CapsManager cm = new CapsManager();
pp.CapsManager = cm;
cm.FileName = "caps.xml";
cm.Node = "http://cursive.net/clients/PresenceManagerTest";
cm.AddFeature(URI.DISCO_INFO);
cm.AddFeature(URI.DELAY);
cm.AddIdentity("client", "pc", null, "Presence Manager Test");
DiscoInfo info = new DiscoInfo(doc);
cm.FillInInfo(info);
cm[cm.Ver] = info;
pres.AddChild(cm.GetCaps(pres.OwnerDocument));
pp.AddPresence(pres);
JID dij = pp.GetFeatureJID(bare, URI.DISCO_INFO);
Assert.AreEqual(baz, dij);
dij = pp.GetFeatureJID(bare, URI.DISCO_ITEMS);
Assert.IsNull(dij);
dij = pp.GetFeatureJID(baz, URI.DISCO_INFO);
Assert.AreEqual(baz, dij);
StringSet fs = pp.GetFeatures(bare);
Assert.IsTrue(fs[URI.DISCO_INFO]);
Assert.IsFalse(fs[URI.DISCO_ITEMS]);
}
示例2: JoinRoom
/// <summary>
/// Join a chatroom
/// </summary>
/// <param name="room">
/// jid of the room to join
/// </param>
/// <param name="nickname">
/// nickname to use in the room
/// </param>
/// <param name="password">
/// password for password protected chat rooms
/// </param>
/// <param name="disableHistory">
/// true for joining without chat room history
/// </param>
public void JoinRoom(Jid room, string nickname, string password, bool disableHistory)
{
/*
<presence
from='[email protected]/pda'
to='[email protected]/thirdwitch'>
<x xmlns='http://jabber.org/protocol/muc'>
<password>cauldron</password>
</x>
</presence>
join room and request no history
<presence
from='[email protected]/pda'
to='[email protected]/thirdwitch'>
<x xmlns='http://jabber.org/protocol/muc'>
<history maxchars='0'/>
</x>
</presence>
*/
Jid to = new Jid(room.ToString());
to.Resource = nickname;
Presence pres = new Presence();
pres.To = to;
Muc x = new Muc();
if (password != null)
{
x.Password = password;
}
if (disableHistory)
{
History hist = new History();
hist.MaxCharacters = 0;
x.History = hist;
}
pres.AddChild(x);
m_connection.Send(pres);
}