• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# JID类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中JID的典型用法代码示例。如果您正苦于以下问题:C# JID类的具体用法?C# JID怎么用?C# JID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JID类属于命名空间,在下文中一共展示了JID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UserPresenceManager

 public UserPresenceManager(JID jid)
 {
     Debug.Assert(jid.Resource == null);
     m_jid = jid;
 }
开发者ID:eNoise,项目名称:cyclops-chat,代码行数:5,代码来源:PresenceManager.cs


示例2: RemoveRosterItem

        /// <summary>
        /// Removes a contact from the roster.
        /// This will also remove the subscription for that contact being removed.
        /// </summary>
        /// <param name="to">The JID to remove</param>
        public void RemoveRosterItem(JID to)
        {
            Debug.Assert(to != null);

            /*
            <iq from='[email protected]/balcony' type='set' id='roster_4'>
              <query xmlns='jabber:iq:roster'>
            <item jid='[email protected]' subscription='remove'/>
              </query>
            </iq>
             */
            RosterIQ riq = new RosterIQ(Document) {Type = IQType.Set};
            Roster r = riq.Instruction;
            Item i = r.AddItem();
            i.JID = to;
            i.Subscription = Subscription.remove;
            Write(riq); // don't care about result.  we should get a iq/response and a roster push.
        }
开发者ID:csfmeridian,项目名称:jabber-net,代码行数:23,代码来源:JabberClient.cs


示例3: Remove

        /// <summary>
        /// Remove a contact from the roster
        /// </summary>
        /// <param name="jid">Typically just a [email protected] JID</param>
        public void Remove(JID jid)
        {
/*
C: <iq from='[email protected]/balcony' type='set' id='delete_1'>
     <query xmlns='jabber:iq:roster'>
       <item jid='[email protected]' subscription='remove'/>
     </query>
   </iq>
 */
            RosterIQ iq = new RosterIQ(m_stream.Document);
            iq.Type = IQType.set;
            Roster r = iq.Instruction;
            Item item = r.AddItem();
            item.JID = jid;
            item.Subscription = Subscription.remove;
            m_stream.Write(iq);  // ignore response
        }
开发者ID:rankida,项目名称:HangoutPhone,代码行数:21,代码来源:RosterManager.cs


示例4: m_stream_OnProtocol

        private void m_stream_OnProtocol(object sender, System.Xml.XmlElement rp)
        {
            // There isn't always a from address.  iq:roster, for example.
            string af = rp.GetAttribute("from");
            if (af == "")
                return;
            JID from = new JID(af);
            if (from.Bare != (string)m_room)
                return;  // not for this room.

            switch (rp.LocalName)
            {
                case "presence":
                    Presence p = (Presence)rp;
                    if (p.Error != null)
                    {
                        m_state = STATE.error;
                        if (OnPresenceError != null)
                            OnPresenceError(this, p);
                        return;
                    }

                    Presence oldPresence = (m_participants[from] != null) ? ((RoomParticipant)m_participants[from]).Presence : null;

                    ParticipantCollection.Modification mod = ParticipantCollection.Modification.NONE;
                    RoomParticipant party = m_participants.Modify(p, out mod);

                    // if this is ours
                    if (p.From == m_jid)
                    {
                        switch (m_state)
                        {
                            case STATE.join:
                                OnJoinPresence(p);
                                break;
                            case STATE.leaving:
                                OnLeavePresence(p);
                                break;
                            case STATE.running:
                                if (p.Type == PresenceType.unavailable)
                                    OnLeavePresence(p);
                                else
                                    OnPresenceChange(this, party, oldPresence);
                                break;
                        }
                    }
                    else
                    {
                        switch (mod)
                        {
                            case ParticipantCollection.Modification.NONE:
                                if (OnParticipantPresenceChange != null)
                                    OnParticipantPresenceChange(this, party, oldPresence);
                                break;
                            case ParticipantCollection.Modification.JOIN:
                                if (OnParticipantJoin != null)
                                    OnParticipantJoin(this, party);
                                break;
                            case ParticipantCollection.Modification.LEAVE:
                                if (OnParticipantLeave != null)
                                    OnParticipantLeave(this, party);
                                break;
                        }
                    }
                    break;
                case "message":
                    Message m = (Message)rp;
                    if (m.Type == MessageType.groupchat)
                    {
                        if (m.Subject != null)
                        {
                            if (OnSubjectChange != null)
                                OnSubjectChange(this, m);
                            m_subject = m;
                        }
                        else if (m.From == m_jid)
                        {
                            if (OnSelfMessage != null)
                                OnSelfMessage(this, m);
                        }
                        else
                        {
                            if (OnRoomMessage != null)
                                OnRoomMessage(this, m);
                        }
                    }
                    else
                    {
                        if (m.From.Resource == null)
                        {
                            // room notification of some kind
                            if (OnAdminMessage != null)
                                OnAdminMessage(this, m);
                        }
                        else
                        {
                            if (OnPrivateMessage != null)
                                OnPrivateMessage(this, m);
                        }
                    }
//.........这里部分代码省略.........
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:101,代码来源:ConferenceManager.cs


示例5: RemoveRoom

 /// <summary>
 /// Removes the room from the list.
 /// Should most often be called by the Room.Leave() method.
 /// If the room does not exist, no exception is thrown.
 /// </summary>
 /// <param name="roomAndNick">Room to remove.</param>
 public void RemoveRoom(JID roomAndNick)
 {
     m_rooms.Remove(roomAndNick);
 }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:10,代码来源:ConferenceManager.cs


示例6: GetRoom

        /// <summary>
        /// Joins a conference room.
        /// </summary>
        /// <param name="roomAndNick">[email protected]/nick, where "nick" is the desred nickname in the room.</param>
        /// <returns>
        /// If already joined, the existing room will be returned.
        /// If not, a Room object will be returned in the joining state.
        /// </returns>
        public Room GetRoom(JID roomAndNick)
        {
            if (roomAndNick == null)
                throw new ArgumentNullException("roomAndNick");

            if (roomAndNick.Resource == null)
                roomAndNick.Resource = DefaultNick;

            if (m_rooms.ContainsKey(roomAndNick))
                return m_rooms[roomAndNick];

            // If no resource specified, pick up the user's name from their JID
            if (roomAndNick.Resource == null)
                roomAndNick.Resource = m_stream.JID.User;

            Room r = new Room(this, roomAndNick);
            r.OnJoin += OnJoin;
            r.OnLeave += OnLeave;
            r.OnPresenceError += OnPresenceError;
            r.OnRoomConfig += OnRoomConfig;
            r.OnRoomMessage += OnRoomMessage;
            r.OnPrivateMessage += OnPrivateMessage;
            r.OnAdminMessage += OnAdminMessage;
            r.OnSelfMessage += OnSelfMessage;
            r.OnSubjectChange += OnSubjectChange;
            r.OnParticipantJoin += OnParticipantJoin;
            r.OnParticipantLeave += OnParticipantLeave;
            r.OnParticipantPresenceChange += OnParticipantPresenceChange;
            r.OnPresenceChange += OnPresenceChange;

            m_rooms[roomAndNick] = r;
            return r;
        }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:41,代码来源:ConferenceManager.cs


示例7: RevokeMembership

 /// <summary>
 /// Remove the membership privileges of the given user
 /// </summary>
 /// <param name="jid">The bare jid of the user to revoke the membership of.</param>
 /// <param name="reason"></param>
 public void RevokeMembership(JID jid, string reason)
 {
     // Or "Dismember".
     ChangeAffiliation(jid, RoomAffiliation.none, reason);
 }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:10,代码来源:ConferenceManager.cs


示例8: GetNode

 /// <summary>
 /// Creates nodes and ensure that they are cached.
 /// </summary>
 /// <param name="jid">JID associated with DiscoNode.</param>
 /// <param name="node">Node associated with DiscoNode.</param>
 /// <returns>
 /// If DiscoNode exists, returns the found node.
 /// Otherwise it creates the node and return it.
 /// </returns>
 public DiscoNode GetNode(JID jid, string node)
 {
     lock (m_items)
     {
         string key = DiscoNode.GetKey(jid, node);
         DiscoNode n = (DiscoNode)m_items[key];
         if (n == null)
         {
             n = new DiscoNode(jid, node);
             m_items.Add(key, n);
         }
         return n;
     }
 }
开发者ID:krbysn,项目名称:jabber-net,代码行数:23,代码来源:DiscoManager.cs


示例9: DiscoNode

 /// <summary>
 /// Creates a disco node.
 /// </summary>
 /// <param name="jid">JID associated with this JIDNode.</param>
 /// <param name="node">node associated with this JIDNode.</param>
 public DiscoNode(JID jid, string node)
     : base(jid, node)
 {
 }
开发者ID:krbysn,项目名称:jabber-net,代码行数:9,代码来源:DiscoManager.cs


示例10: JIDNode

 /// <summary>
 /// Creates a new JID/Node combination.
 /// </summary>
 /// <param name="jid">JID to associate with JIDNode.</param>
 /// <param name="node">Node to associate with JIDNode.</param>
 public JIDNode(JID jid, string node)
 {
     this.m_jid = jid;
     if ((node != null) && (node != ""))
         this.m_node = node;
 }
开发者ID:krbysn,项目名称:jabber-net,代码行数:11,代码来源:DiscoManager.cs


示例11: BeginGetItems

 /// <summary>
 /// Retrieves the child items associated with this node and JID,
 /// and then calls back on the handler.
 /// If the information is in the cache, handler gets
 /// called right now.
 /// </summary>
 /// <param name="jid">JID of Service to query.</param>
 /// <param name="node">Node on the service to interact with.</param>
 /// <param name="handler">Callback that gets called with the items.</param>
 /// <param name="state">Context to pass back to caller when complete</param>
 public void BeginGetItems(JID jid, string node, DiscoNodeHandler handler, object state)
 {
     BeginGetItems(GetNode(jid, node), handler, state);
 }
开发者ID:krbysn,项目名称:jabber-net,代码行数:14,代码来源:DiscoManager.cs


示例12: AddNote

 /// <summary>
 /// Add a note to the bookmark list.
 /// </summary>
 /// <param name="jid"></param>
 /// <param name="text"></param>
 /// <returns></returns>
 public BookmarkNote AddNote(JID jid, string text)
 {
     BookmarkNote n = new BookmarkNote(this.OwnerDocument);
     n.JID = jid;
     n.Text = text;
     this.AddChild(n);
     return n;
 }
开发者ID:csfmeridian,项目名称:jabber-net,代码行数:14,代码来源:Bookmarks.cs


示例13: AddConference

 /// <summary>
 /// Add a conference room to the bookmark list
 /// </summary>
 /// <param name="jid"></param>
 /// <param name="name"></param>
 /// <param name="autoJoin"></param>
 /// <param name="nick"></param>
 /// <returns></returns>
 public BookmarkConference AddConference(JID jid, string name, bool autoJoin, string nick)
 {
     BookmarkConference c = new BookmarkConference(this.OwnerDocument);
     c.JID = jid;
     c.ConferenceName = name;
     c.AutoJoin = autoJoin;
     if (nick != null)
         c.Nick = nick;
     this.AddChild(c);
     return c;
 }
开发者ID:csfmeridian,项目名称:jabber-net,代码行数:19,代码来源:Bookmarks.cs


示例14: Ban

 /// <summary>
 /// Ban a user from re-joining the room.  Must be an admin.
 /// </summary>
 /// <param name="jid">The bare JID of the user to ban</param>
 /// <param name="reason">The reason for the shunning</param>
 public void Ban(JID jid, string reason)
 {
     ChangeAffiliation(jid, RoomAffiliation.outcast, reason);
 }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:9,代码来源:ConferenceManager.cs


示例15: GrantMembership

 /// <summary>
 /// Make this user a member of the room.
 /// </summary>
 /// <param name="jid">The bare jid of the user to grant membership to.</param>
 /// <param name="reason"></param>
 public void GrantMembership(JID jid, string reason)
 {
     ChangeAffiliation(jid, RoomAffiliation.member, reason);
 }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:9,代码来源:ConferenceManager.cs


示例16: return

 /// <summary>
 /// Get a participant by their [email protected]/nick JID.
 /// </summary>
 /// <param name="nickJid">[email protected]/nick</param>
 /// <returns>Participant object</returns>
 public RoomParticipant this[JID nickJid]
 {
     get
     {
         return (RoomParticipant)m_hash[nickJid];
     }
 }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:12,代码来源:ConferenceManager.cs


示例17: GetNode

 /// <summary>
 /// Subscribes to a publish-subscribe node.
 /// </summary>
 /// <param name="service">Component that handles PubSub requests.</param>
 /// <param name="node">The node on the component that the client wants to interact with.</param>
 /// <param name="maxItems">Maximum number of items to retain.  First one to call Subscribe gets their value, for now.</param>
 /// <returns>
 /// The existing node will be returned if there is already a subscription.
 /// If the node does not exist, the PubSubNode object will be returned
 /// in a subscribing state.
 /// </returns>
 public PubSubNode GetNode(JID service, string node, int maxItems)
 {
     JIDNode jn = new JIDNode(service, node);
     PubSubNode n = null;
     if (m_nodes.TryGetValue(jn, out n))
         return n;
     n = new PubSubNode(Stream, service, node, maxItems);
     m_nodes[jn] = n;
     n.OnError += OnError;
     return n;
 }
开发者ID:krbysn,项目名称:jabber-net,代码行数:22,代码来源:PubSubManager.cs


示例18: HasRoom

 /// <summary>
 /// Determines whether or not the conference room is being managed
 /// by this ConferenceManager.
 /// </summary>
 /// <param name="roomAndNick">Room to look for.</param>
 /// <returns>True if the room is being managed.</returns>
 public bool HasRoom(JID roomAndNick)
 {
     return m_rooms.ContainsKey(roomAndNick);
 }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:10,代码来源:ConferenceManager.cs


示例19: RemoveNode

        ///<summary>
        /// Removes the publish-subscribe node from the manager and sends a delete
        /// node to the XMPP server.
        ///</summary>
        /// <param name="service">
        /// Component that handles PubSub requests.
        /// </param>
        /// <param name="node">
        /// The node on the component that the client wants to interact with.
        /// </param>
        /// <param name="errorHandler">
        /// Callback for any errors with the publish-subscribe node deletion.
        /// </param>
        public void RemoveNode(JID service, string node, bedrock.ExceptionHandler errorHandler)
        {
            JIDNode jn = new JIDNode(service, node);

            PubSubNode psNode = null;
            if (m_nodes.TryGetValue(jn, out psNode))
            {
                m_nodes.Remove(jn);
            }
            else
            {
                psNode = new PubSubNode(Stream, service, node, 10);
            }

            psNode.OnError += errorHandler;

            psNode.Delete();
        }
开发者ID:krbysn,项目名称:jabber-net,代码行数:31,代码来源:PubSubManager.cs


示例20: Room

 /// <summary>
 /// Create.
 /// </summary>
 /// <param name="manager">The manager for this room.</param>
 /// <param name="roomAndNick">[email protected]/nick, where "nick" is the desred nickname in the room.</param>
 internal Room(ConferenceManager manager, JID roomAndNick)
 {
     m_manager = manager;
     XmppStream stream = manager.Stream;
     m_jid = roomAndNick;
     m_room = new JID(m_jid.User, m_jid.Server, null);
     stream.OnProtocol += new Jabber.Protocol.ProtocolHandler(m_stream_OnProtocol);
     JabberClient jc = stream as JabberClient;
     if (jc != null)
         jc.OnAfterPresenceOut += new Jabber.Client.PresenceHandler(m_stream_OnAfterPresenceOut);
 }
开发者ID:sq5gvm,项目名称:JabberNet-2010,代码行数:16,代码来源:ConferenceManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# JJCalls类代码示例发布时间:2022-05-24
下一篇:
C# JET_param类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap