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


C# JID类代码示例

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


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


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