Changeset 36:f2953cadca90 in ralphm-patches for roster_server.patch


Ignore:
Timestamp:
Feb 12, 2010, 8:07:12 PM (11 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Work on roster item representation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roster_server.patch

    r34 r36  
    1 diff -r 09858bbc7f56 wokkel/xmppim.py
    2 --- a/wokkel/xmppim.py  Fri Feb 12 09:37:28 2010 +0100
    3 +++ b/wokkel/xmppim.py  Fri Feb 12 09:40:15 2010 +0100
     1diff -r 7b9f484b0b44 wokkel/xmppim.py
     2--- a/wokkel/xmppim.py  Fri Feb 12 19:49:36 2010 +0100
     3+++ b/wokkel/xmppim.py  Fri Feb 12 19:53:42 2010 +0100
    44@@ -12,6 +12,7 @@
    55 All of it should eventually move to Twisted.
     
    2020     def __init__(self, to=None, type=None):
    2121         domish.Element.__init__(self, (None, "presence"))
    22 @@ -605,6 +609,7 @@
    23          self.groups = set()
     22@@ -636,6 +640,7 @@
     23 
    2424 
    2525 
     
    2828     """
    2929     Client side XMPP roster protocol.
    30 @@ -614,6 +619,7 @@
     30@@ -645,6 +650,7 @@
    3131         ROSTER_SET = "/iq[@type='set']/query[@xmlns='%s']" % NS_ROSTER
    3232         self.xmlstream.addObserver(ROSTER_SET, self._onRosterSet)
     
    3636         jid = JID(element['jid'])
    3737         item = RosterItem(jid)
    38 @@ -628,6 +634,7 @@
     38@@ -659,6 +665,7 @@
    3939 
    4040         return item
     
    4444         """
    4545         Retrieve contact list.
    46 @@ -683,6 +690,7 @@
     46@@ -713,6 +720,7 @@
    4747             item = self._parseRosterItem(iq.query.item)
    4848             self.onRosterSet(item)
     
    5252         """
    5353         Called when a roster push for a new or update item was received.
    54 @@ -691,6 +699,7 @@
     54@@ -721,6 +729,7 @@
    5555         @type item: L{RosterItem}
    5656         """
     
    6060         """
    6161         Called when a roster push for the removal of an item was received.
    62 @@ -699,6 +708,57 @@
     62@@ -729,6 +738,48 @@
    6363         @type entity: L{JID}
    6464         """
     
    7676+
    7777+
    78 +    def _toRosterReply(self, items, iq):
     78+    def _toRosterReply(self, roster, iq):
    7979+        response = xmlstream.toResponse(iq, 'result')
    8080+        response.addElement((NS_ROSTER, 'query'))
    8181+
    82 +        for item in items:
    83 +            element = response.query.addElement('item')
    84 +            element['jid'] = item['jid']
    85 +            if item['name']:
    86 +                element['name'] = item['name']
    87 +            element['subscription'] = item['subscription']
    88 +            if item['ask']:
    89 +                element['ask'] = item['ask']
    90 +
    91 +            for group in item['groups']:
    92 +                element.addElement('group', content=group)
     82+        for item in roster:
     83+            response.query.addChild(item.toElement())
    9384+
    9485+        return response
Note: See TracChangeset for help on using the changeset viewer.