Changeset

12517:a8c17c95ef4d

util.stanza: Document top level attributes in Teal definition Tells you if you make a typo like "gropchat" or so
author Kim Alvefur <zash@zash.se>
date Tue, 17 May 2022 17:06:36 +0200
parents 12516:d76ac22f3571
children 12518:73ee3855f970
files teal-src/util/stanza.d.tl
diffstat 1 files changed, 48 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/teal-src/util/stanza.d.tl	Tue May 17 17:05:15 2022 +0200
+++ b/teal-src/util/stanza.d.tl	Tue May 17 17:06:36 2022 +0200
@@ -78,16 +78,61 @@
 		{ serialized_stanza_t | string }
 	end
 
+	record message_attr
+		["xml:lang"] : string
+		from : string
+		id : string
+		to : string
+		type : message_type
+		enum message_type
+			"chat"
+			"error"
+			"groupchat"
+			"headline"
+			"normal"
+		end
+	end
+
+	record presence_attr
+		["xml:lang"] : string
+		from : string
+		id : string
+		to : string
+		type : presence_type
+		enum presence_type
+			"error"
+			"probe"
+			"subscribe"
+			"subscribed"
+			"unsubscribe"
+			"unsubscribed"
+		end
+	end
+
+	record iq_attr
+		["xml:lang"] : string
+		from : string
+		id : string
+		to : string
+		type : iq_type
+		enum iq_type
+			"error"
+			"get"
+			"result"
+			"set"
+		end
+	end
+
 	stanza : function ( string, { string : string } ) : stanza_t
 	is_stanza : function ( any ) : boolean
 	preserialize : function ( stanza_t ) : serialized_stanza_t
 	deserialize : function ( serialized_stanza_t ) : stanza_t
 	clone : function ( stanza_t, boolean ) : stanza_t
-	message : function ( { string : string }, string ) : stanza_t
-	iq : function ( { string : string } ) : stanza_t
+	message : function ( message_attr, string ) : stanza_t
+	iq : function ( iq_attr ) : stanza_t
 	reply : function ( stanza_t ) : stanza_t
 	error_reply : function ( stanza_t, stanza_error_type, stanza_error_condition, string, string ) : stanza_t
-	presence : function ( { string : string } ) : stanza_t
+	presence : function ( presence_attr ) : stanza_t
 	xml_escape : function ( string ) : string
 	pretty_print : function ( string ) : string
 end