本文整理汇总了C#中agsXMPP.protocol.client.Presence.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Presence.AddChild方法的具体用法?C# Presence.AddChild怎么用?C# Presence.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agsXMPP.protocol.client.Presence
的用法示例。
在下文中一共展示了Presence.AddChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMyPresence
/// <summary>
/// Sends our Presence, the packet is built of Status, Show and Priority
/// </summary>
public void SendMyPresence()
{
Presence pres = new Presence(m_Show, m_Status, m_Priority);
// Add client caps when enabled
if (m_EnableCapabilities)
{
if (m_Capabilities.Version == null)
UpdateCapsVersion();
pres.AddChild(m_Capabilities);
}
this.Send(pres);
}
示例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);
}
示例3: SetPresenceStatus
public override void SetPresenceStatus(PresenceStatus status,
string message)
{
Trace.Call(status, message);
if (!IsConnected) {
return;
}
switch (status) {
case PresenceStatus.Online:
JabberClient.Show = ShowType.NONE;
JabberClient.Priority = Server.Priorities[status];
JabberClient.Status = message;
break;
case PresenceStatus.Away:
JabberClient.Priority = Server.Priorities[status];
JabberClient.Show = ShowType.away;
JabberClient.Status = message;
break;
}
JabberClient.SendMyPresence();
// send presence update to all MUCs, see XEP-0045:
// http://xmpp.org/extensions/xep-0045.html#changepres
foreach (var chat in Chats) {
if (!(chat is XmppGroupChatModel)) {
continue;
}
var muc = (XmppGroupChatModel) chat;
var to = new Jid(muc.ID) {
Resource = muc.OwnNickname
};
var presence = new Presence() {
Show = JabberClient.Show,
Status = JabberClient.Status,
From = JabberClient.MyJID,
To = to
};
if (JabberClient.EnableCapabilities) {
presence.AddChild(JabberClient.Capabilities);
}
JabberClient.Send(presence);
}
base.SetPresenceStatus(status, message);
}