当前位置: 首页>>代码示例>>C#>>正文


C# Presence.AddChild方法代码示例

本文整理汇总了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);
        }
开发者ID:jptoto,项目名称:argsxmpp,代码行数:18,代码来源:XmppClientConnection.cs

示例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);
        }
开发者ID:jptoto,项目名称:argsxmpp,代码行数:48,代码来源:MucManager.cs

示例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);
        }
开发者ID:meebey,项目名称:smuxi,代码行数:51,代码来源:XmppProtocolManager.cs


注:本文中的agsXMPP.protocol.client.Presence.AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。