source: ralphm-patches/jid_cleanup.patch @ 50:b69ca8f7174e

Last change on this file since 50:b69ca8f7174e was 50:b69ca8f7174e, checked in by Ralph Meijer <ralphm@…>, 9 years ago

Cleanup JIDs a bit more and adjust affected patches.

File size: 4.2 KB
  • wokkel/im.py

    # HG changeset patch
    # Parent 7d4897a32913c43d69e4b77db226714705ac5cd6
    
    diff -r 7d4897a32913 wokkel/im.py
    a b  
    1212All of it should eventually move to Twisted.
    1313"""
    1414
    15 from twisted.words.protocols.jabber.jid import JID
     15from twisted.words.protocols.jabber import jid
    1616from twisted.words.xish import domish
    1717
    1818from wokkel.compat import IQ
     
    246246
    247247        @param recipient: Optional Recipient to which the presence should be
    248248            sent.
    249         @type recipient: {JID}
     249        @type recipient: L{jid.JID}
    250250
    251251        @param show: Optional detailed presence information. One of C{'away'},
    252252            C{'xa'}, C{'chat'}, C{'dnd'}.
     
    271271        Send unavailable presence.
    272272
    273273        @param recipient: Optional entity to which the presence should be sent.
    274         @type recipient: {JID}
     274        @type recipient: L{jid.JID}
    275275
    276276        @param statuses: dictionary of natural language descriptions of the
    277277            availability status, keyed by the language descriptor. A status
     
    288288        Send subscription request
    289289
    290290        @param recipient: Entity to subscribe to.
    291         @type recipient: {JID}
     291        @type recipient: L{jid.JID}
    292292        """
    293293        presence = SubscriptionPresence(recipient=recipient, sender=sender)
    294294        presence.stanzaType = 'subscribe'
     
    300300        Send unsubscription request
    301301
    302302        @param recipient: Entity to unsubscribe from.
    303         @type recipient: {JID}
     303        @type recipient: L{jid.JID}
    304304        """
    305305        presence = SubscriptionPresence(recipient=recipient, sender=sender)
    306306        presence.stanzaType = 'unsubscribe'
     
    312312        Send subscription confirmation.
    313313
    314314        @param recipient: Entity that subscribed.
    315         @type recipient: {JID}
     315        @type recipient: L{jid.JID}
    316316        """
    317317        presence = SubscriptionPresence(recipient=recipient, sender=sender)
    318318        presence.stanzaType = 'subscribed'
     
    324324        Send unsubscription confirmation.
    325325
    326326        @param recipient: Entity that unsubscribed.
    327         @type recipient: {JID}
     327        @type recipient: L{jid.JID}
    328328        """
    329329        presence = SubscriptionPresence(recipient=recipient, sender=sender)
    330330        presence.stanzaType = 'unsubscribed'
     
    336336        Send presence probe.
    337337
    338338        @param recipient: Entity to be probed.
    339         @type recipient: {JID}
     339        @type recipient: L{jid.JID}
    340340        """
    341341        presence = ProbePresence(recipient=recipient, sender=sender)
    342342        self.send(presence.toElement())
     
    350350    This represents one contact from an XMPP contact list known as roster.
    351351
    352352    @ivar jid: The JID of the contact.
    353     @type jid: L{JID}
     353    @type jid: L{jid.JID}
    354354    @ivar name: The optional associated nickname for this contact.
    355355    @type name: C{unicode}
    356356    @ivar subscriptionTo: Subscription state to contact's presence. If C{True},
     
    389389
    390390
    391391    def _parseRosterItem(self, element):
    392         jid = JID(element['jid'])
    393         item = RosterItem(jid)
     392        entity = jid.internJID(element['jid'])
     393        item = RosterItem(entity)
    394394        item.name = element.getAttribute('name')
    395395        subscription = element.getAttribute('subscription')
    396396        item.subscriptionTo = subscription in ('to', 'both')
     
    407407        """
    408408        Retrieve contact list.
    409409
    410         @return: Roster as a mapping from L{JID} to L{RosterItem}.
     410        @return: Roster as a mapping from L{jid.JID} to L{RosterItem}.
    411411        @rtype: L{twisted.internet.defer.Deferred}
    412412        """
    413413
     
    453453        itemElement = iq.query.item
    454454
    455455        if unicode(itemElement['subscription']) == 'remove':
    456             self.onRosterRemove(JID(itemElement['jid']))
     456            self.onRosterRemove(jid.internJID(itemElement['jid']))
    457457        else:
    458458            item = self._parseRosterItem(iq.query.item)
    459459            self.onRosterSet(item)
     
    473473        Called when a roster push for the removal of an item was received.
    474474
    475475        @param entity: The entity for which the roster item has been removed.
    476         @type entity: L{JID}
     476        @type entity: L{jid.JID}
    477477        """
Note: See TracBrowser for help on using the repository browser.