Changeset 73:f574beee3bca in ralphm-patches for async-observer.patch


Ignore:
Timestamp:
May 6, 2013, 10:01:18 PM (7 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Children:
74:355afce3af27, 75:9b7b8b99da61
Message:

Minor cleanups, improved error message handling, and upstreamed patch.

  • Upstreamed deprecation of prepareIDNName.
  • MessageProtocol? now properly handles error message stanzas.
  • Renamed methods for RosterServerProtocol?.
  • Prefer connectionInitialized for setting up stanza observers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • async-observer.patch

    r72 r73  
    11# HG changeset patch
    2 # Parent 2076bac14221bf6aa7dc9337590b18604b100f32
     2# Parent ed052dd5cb7a57faf1693f78457401fd820fdd79
    33
    44diff --git a/wokkel/subprotocols.py b/wokkel/subprotocols.py
     
    2626+
    2727+        >>> class MyHandler(XMPPHandler):
    28 +        ...    def connectionMade(self):
     28+        ...    def connectionInitialized(self):
    2929+        ...       self.xmlstream.addObserver('/message', self.onMessage)
    3030+        ...    @asyncObserver
     
    104104     """
    105105     XMPP subprotocol mixin for handle incoming IQ stanzas.
     106@@ -401,15 +486,15 @@
     107 
     108     A typical way to use this mixin, is to set up L{xpath} observers on the
     109     C{xmlstream} to call handleRequest, for example in an overridden
     110-    L{XMPPHandler.connectionMade}. It is likely a good idea to only listen for
     111-    incoming iq get and/org iq set requests, and not for any iq, to prevent
     112-    hijacking incoming responses to outgoing iq requests. An example:
     113+    L{XMPPHandler.connectionInitialized}. It is likely a good idea to only
     114+    listen for incoming iq get and/org iq set requests, and not for any iq, to
     115+    prevent hijacking incoming responses to outgoing iq requests. An example:
     116 
     117         >>> QUERY_ROSTER = "/query[@xmlns='jabber:iq:roster']"
     118         >>> class MyHandler(XMPPHandler, IQHandlerMixin):
     119         ...    iqHandlers = {"/iq[@type='get']" + QUERY_ROSTER: 'onRosterGet',
     120         ...                  "/iq[@type='set']" + QUERY_ROSTER: 'onRosterSet'}
     121-        ...    def connectionMade(self):
     122+        ...    def connectionInitialized(self):
     123         ...        self.xmlstream.addObserver(
     124         ...          "/iq[@type='get' or @type='set']" + QUERY_ROSTER,
     125         ...          self.handleRequest)
    106126@@ -425,6 +510,7 @@
    107127 
Note: See TracChangeset for help on using the changeset viewer.