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()