start defining stuff that could handle subtokens - message-chatstate here.
[citadel.git] / citadel / modules / xmpp / token.def
index 6799c8dc2b52a90737fdf8a0cfc9616cc2165623..d4470e02d38c89012d7027c4756d86013b927c69 100644 (file)
@@ -6,7 +6,7 @@ TOKEN(iq,
              STRPROP(iq, id);
              STRPROP(iq, from);
              STRPROP(iq, to);
-      })
+      });
 
 
 #define NAMESPACE_piq "bub"
@@ -17,4 +17,54 @@ TOKEN(piq,
              STRPROP(piq, id);
              STRPROP(piq, from);
              STRPROP(piq, to);
-      })
+      });
+
+#define NAMESPACE_message "jabber:client"
+TOKEN(message,
+       {
+               STRPROP(message, to);
+               STRPROP(message, type);
+               STRPROP(message, id);
+               PAYLOAD(message, body);
+       });
+
+#define NAMESPACE_message_chatstate "http://jabber.org/protocol/chatstates"
+
+SUBTOKEN(message,
+        chatstate,
+        active,
+        {
+                CALLBACK(active);
+        });
+
+SUBTOKEN(message,
+        chatstate,
+        composing,
+        {
+                CALLBACK(composing);
+        });
+
+SUBTOKEN(message,
+        chatstate,
+        paused,
+        {
+                CALLBACK(paused);
+        });
+
+SUBTOKEN(message,
+        chatstate,
+        inactive,
+        {
+                CALLBACK(inactive);
+        });
+
+SUBTOKEN(message,
+        chatstate,
+        gone,
+        {
+                CALLBACK(gone);
+        });
+
+// <message type='chat' id='purplef5a7ed34' to='testuser@blarg.potzblitz.outgesourced.org'><active xmlns='http://jabber.org/protocol/chatstates'/><body>gci</body></message>
+
+// <iq type="result" id="unsolicited_2"><query xmlns="jabber:iq:roster"><item subscription="both" jid="willi@potzblitz.outgesourced.org" name="testuser"><group>potzblitz</group></item></query></iq><presence>testuser@blarg.potzblitz.outgesourced.org to="willi@potzblitz.outgesourced.org/potzblitz"</presence><message type="chat" to="willi@potzblitz.outgesourced.org/potzblitz" from="testuser@blarg.potzblitz.outgesourced.org"><body>rgilgci</body></message>