Ticket #19 (closed enhancement: fixed)

Opened 4 months ago

Last modified 3 months ago

Presence dispatching

Reported by: guest Assigned to: sylvain
Priority: major Milestone: headstock-0.3.0
Component: headstock Version: headstock-0.2.0
Keywords: presence Cc: jason.baker@ttu.edu

Description

According to the XMPP specification, a presence message without a type is to be treated as a message indicating that the user is available. So I propose that the "unknown" outbox on the Presence dispatcher be changed to "xmpp.available" through the following patch:

@@ -22,10 +22,10 @@
     Outboxes = {"outbox"            : "bridge.Element instance to sent back to the client",
                 "signal"            : "Shutdown signal",
                 "log"               : "log",
-                "unknown"           : "Unknown element that could not be dispatched properly",
                 "xmpp.unavailable"  : "Notifiy an entity of one's availability",
                 "xmpp.error"        : "An error has occurred regarding processing or delivery of a presence stanza",
                 "xmpp.probe"        : "Server to server message to check the presence of an entity",
+                "xmpp.available"    : "Send notifications when a client signs in",
                 "xmpp.subscribe"    : "Sender wishes to subscribe to the recipient's presence",
                 "xmpp.subscribed"   : "Sender has allowed the recipient to receive their presence",
                 "xmpp.unsubscribe"  : "Sender is unsubscribing from another entity's presence",
@@ -53,17 +53,17 @@
             if self.dataReady("inbox"):
                 e = self.recv("inbox")
                 self.send(('INCOMING', e), "log")
+                
                 presence_type = e.get_attribute(u'type')
-                handled = False
+                
                 if presence_type:
                     key = 'xmpp.%s' % presence_type
-                    if key in self.outboxes:
-                        self.send(Presence.from_element(e), key)
-                        handled = True
+                else:
+                    key = 'xmpp.available'
+                
+                if key in self.outboxes:
+                    self.send(Presence.from_element(e), key)
 
-                if not handled:
-                    self.send(e, "unknown")
-
             if not self.anyReady():
                 self.pause()

Change History

08/12/08 02:42:52 changed by sylvain

  • status changed from new to assigned.
  • version changed from Current to headstock-0.2.0.
  • milestone changed from headstock-0.1.0 to headstock-0.2.0.

This is an enhancement to the presence class that will make it show the type as available in a repr.

Index: headstock/api/contact.py =================================================================== --- headstock/api/contact.py (revision 745) +++ headstock/api/contact.py (working copy) @@ -22,7 +22,7 @@

    self.foreign = []

    def repr(self):

- return '<Presence %s (%s) at %s>' % (str(self.from_jid), self.type, hex(id(self))) + return '<Presence %s (%s) at %s>' % (str(self.from_jid), self.type or 'available', hex(id(self)))

    @staticmethod 
    def from_element(e):

08/12/08 03:38:09 changed by sylvain

  • status changed from assigned to closed.
  • resolution set to fixed.
  • milestone changed from headstock-0.2.0 to headstock-0.3.0.

Fixed in [767].

I have decided to keep the unknown outbox for type attributes that were not part of what RFC 3920 allowed.