changeset 17567:cac26c30047a

Implemented <required/> for x-data forms, simplified malloc/sprintf, message type headline is not a requirement for incoming PEP messages (it is just recommended to avoid offline message storage).
author Andreas Monitzer <pidgin@monitzer.com>
date Sun, 10 Jun 2007 12:22:39 +0000
parents 0370da969e8a
children df5bb342b10e
files libpurple/protocols/jabber/message.c libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/xdata.c
diffstat 3 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/message.c	Wed Jun 06 02:07:53 2007 +0000
+++ b/libpurple/protocols/jabber/message.c	Sun Jun 10 12:22:39 2007 +0000
@@ -354,8 +354,7 @@
 		} else if(!strcmp(child->name, "gone") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) {
 			jm->chat_state = JM_STATE_GONE;
 			jm->typing_style |= JM_TS_JEP_0085;
-		} else if(!strcmp(child->name, "event") && jm->type == JABBER_MESSAGE_HEADLINE &&
-                  !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) {
+		} else if(!strcmp(child->name, "event") && !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) {
             xmlnode *items;
             jm->type = JABBER_MESSAGE_EVENT;
             for(items = child->child; child; child = child->next)
--- a/libpurple/protocols/jabber/pep.c	Wed Jun 06 02:07:53 2007 +0000
+++ b/libpurple/protocols/jabber/pep.c	Sun Jun 10 12:22:39 2007 +0000
@@ -34,10 +34,9 @@
 }
 
 void jabber_pep_register_handler(const char *shortname, const char *xmlns, JabberPEPHandler handlerfunc) {
-    char *notifyns = malloc(strlen(xmlns) + 8);
-    sprintf(notifyns,"%s+notify", xmlns);
+    gchar *notifyns = g_strdup_printf("%s+notify", xmlns);
     jabber_add_feature(shortname, notifyns);
-    free(notifyns);
+    g_free(notifyns);
 	g_hash_table_replace(pep_handlers, g_strdup(xmlns), handlerfunc);
 }
 
--- a/libpurple/protocols/jabber/xdata.c	Wed Jun 06 02:07:53 2007 +0000
+++ b/libpurple/protocols/jabber/xdata.c	Sun Jun 10 12:22:39 2007 +0000
@@ -191,8 +191,6 @@
 			value = xmlnode_get_data(valuenode);
 
 
-		/* XXX: handle <required/> */
-
 		if(!strcmp(type, "text-private")) {
 			if((valuenode = xmlnode_get_child(fn, "value")))
 				value = xmlnode_get_data(valuenode);
@@ -324,6 +322,9 @@
 
 			g_free(value);
 		}
+        
+        if(field && xmlnode_get_child(fn, "required"))
+            purple_request_field_set_required(field,TRUE);
 	}
 
 	if((x = xmlnode_get_child(packet, "title")))