Changeset 50:b69ca8f7174e in ralphm-patches for jid_cleanup.patch


Ignore:
Timestamp:
Jun 1, 2011, 9:29:29 AM (9 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Cleanup JIDs a bit more and adjust affected patches.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jid_cleanup.patch

    r49 r50  
    11# HG changeset patch
    2 # Parent c91f18811c37c85486826a8e7916333ad769dce7
     2# Parent 7d4897a32913c43d69e4b77db226714705ac5cd6
    33
    4 diff -r c91f18811c37 wokkel/im.py
    5 --- a/wokkel/im.py      Mon May 23 18:19:44 2011 +0200
    6 +++ b/wokkel/im.py      Wed May 25 09:36:06 2011 +0200
     4diff -r 7d4897a32913 wokkel/im.py
     5--- a/wokkel/im.py      Wed May 25 09:48:39 2011 +0200
     6+++ b/wokkel/im.py      Wed May 25 20:24:36 2011 +0200
    77@@ -12,7 +12,7 @@
    88 All of it should eventually move to Twisted.
     
    1010 
    1111-from twisted.words.protocols.jabber.jid import JID
    12 +from twisted.words.protocols.jabber.jid import JID, internJID
     12+from twisted.words.protocols.jabber import jid
    1313 from twisted.words.xish import domish
    1414 
     
    1919             sent.
    2020-        @type recipient: {JID}
    21 +        @type recipient: L{JID}
     21+        @type recipient: L{jid.JID}
    2222 
    2323         @param show: Optional detailed presence information. One of C{'away'},
     
    2828         @param recipient: Optional entity to which the presence should be sent.
    2929-        @type recipient: {JID}
    30 +        @type recipient: L{JID}
     30+        @type recipient: L{jid.JID}
    3131 
    3232         @param statuses: dictionary of natural language descriptions of the
     
    3737         @param recipient: Entity to subscribe to.
    3838-        @type recipient: {JID}
    39 +        @type recipient: L{JID}
     39+        @type recipient: L{jid.JID}
    4040         """
    4141         presence = SubscriptionPresence(recipient=recipient, sender=sender)
     
    4646         @param recipient: Entity to unsubscribe from.
    4747-        @type recipient: {JID}
    48 +        @type recipient: L{JID}
     48+        @type recipient: L{jid.JID}
    4949         """
    5050         presence = SubscriptionPresence(recipient=recipient, sender=sender)
     
    5555         @param recipient: Entity that subscribed.
    5656-        @type recipient: {JID}
    57 +        @type recipient: L{JID}
     57+        @type recipient: L{jid.JID}
    5858         """
    5959         presence = SubscriptionPresence(recipient=recipient, sender=sender)
     
    6464         @param recipient: Entity that unsubscribed.
    6565-        @type recipient: {JID}
    66 +        @type recipient: L{JID}
     66+        @type recipient: L{jid.JID}
    6767         """
    6868         presence = SubscriptionPresence(recipient=recipient, sender=sender)
     
    7373         @param recipient: Entity to be probed.
    7474-        @type recipient: {JID}
    75 +        @type recipient: L{JID}
     75+        @type recipient: L{jid.JID}
    7676         """
    7777         presence = ProbePresence(recipient=recipient, sender=sender)
    7878         self.send(presence.toElement())
    79 @@ -389,7 +389,7 @@
     79@@ -350,7 +350,7 @@
     80     This represents one contact from an XMPP contact list known as roster.
     81 
     82     @ivar jid: The JID of the contact.
     83-    @type jid: L{JID}
     84+    @type jid: L{jid.JID}
     85     @ivar name: The optional associated nickname for this contact.
     86     @type name: C{unicode}
     87     @ivar subscriptionTo: Subscription state to contact's presence. If C{True},
     88@@ -389,8 +389,8 @@
    8089 
    8190 
    8291     def _parseRosterItem(self, element):
    8392-        jid = JID(element['jid'])
    84 +        jid = internJID(element['jid'])
    85          item = RosterItem(jid)
     93-        item = RosterItem(jid)
     94+        entity = jid.internJID(element['jid'])
     95+        item = RosterItem(entity)
    8696         item.name = element.getAttribute('name')
    8797         subscription = element.getAttribute('subscription')
     98         item.subscriptionTo = subscription in ('to', 'both')
     99@@ -407,7 +407,7 @@
     100         """
     101         Retrieve contact list.
     102 
     103-        @return: Roster as a mapping from L{JID} to L{RosterItem}.
     104+        @return: Roster as a mapping from L{jid.JID} to L{RosterItem}.
     105         @rtype: L{twisted.internet.defer.Deferred}
     106         """
     107 
    88108@@ -453,7 +453,7 @@
    89109         itemElement = iq.query.item
     
    91111         if unicode(itemElement['subscription']) == 'remove':
    92112-            self.onRosterRemove(JID(itemElement['jid']))
    93 +            self.onRosterRemove(internJID(itemElement['jid']))
     113+            self.onRosterRemove(jid.internJID(itemElement['jid']))
    94114         else:
    95115             item = self._parseRosterItem(iq.query.item)
    96116             self.onRosterSet(item)
     117@@ -473,5 +473,5 @@
     118         Called when a roster push for the removal of an item was received.
     119 
     120         @param entity: The entity for which the roster item has been removed.
     121-        @type entity: L{JID}
     122+        @type entity: L{jid.JID}
     123         """
Note: See TracChangeset for help on using the changeset viewer.