about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-09-06 23:07:07 +0100
committerJames Booth <boothj5@gmail.com>2014-09-06 23:07:07 +0100
commit05bff31bb34b7a1cc509e5015897079651f22265 (patch)
treeacaf633e6dfc79122163a237dd9e204ec1bd9814 /src
parent2599c43d66915854d6f8658d95ce79eeb1123c35 (diff)
downloadprofani-tty-05bff31bb34b7a1cc509e5015897079651f22265.tar.gz
Added further debug output for room config
Diffstat (limited to 'src')
-rw-r--r--src/server_events.c63
1 files changed, 55 insertions, 8 deletions
diff --git a/src/server_events.c b/src/server_events.c
index 3cf299ab..c8fe2a84 100644
--- a/src/server_events.c
+++ b/src/server_events.c
@@ -468,24 +468,71 @@ handle_room_configure(const char * const room, DataForm *form)
 {
     cons_show("Recieved configuration form for %s", room);
 
+    if (form->type != NULL) {
+        cons_show("  Type: %s", form->type);
+    }
+    if (form->title != NULL) {
+        cons_show("  Title: %s", form->title);
+    }
+    if (form->instructions != NULL) {
+        cons_show("  Instructions: %s", form->instructions);
+    }
+
     GSList *fields = form->fields;
-    GSList *curr = fields;
-    while (curr != NULL) {
-        FormField *field = curr->data;
+    GSList *curr_field = fields;
+    while (curr_field != NULL) {
+        FormField *field = curr_field->data;
+        cons_show("  Field:");
 
         if (field->label != NULL) {
-            cons_show("  Field: %s", field->label);
-        } else {
-            cons_show("  Field:");
+            cons_show("    Label: %s", field->label);
         }
         if (field->type != NULL) {
             cons_show("    Type: %s", field->type);
         }
         if (field->var != NULL) {
-            cons_show("    var: %s", field->var);
+            cons_show("    Var: %s", field->var);
+        }
+        if (field->description != NULL) {
+            cons_show("    Description: %s", field->description);
+        }
+
+        if (field->required) {
+            cons_show("    Required: TRUE");
+        } else {
+            cons_show("    Required: FALSE");
+        }
+
+        GSList *values = field->values;
+        GSList *curr_value = values;
+        if (curr_value != NULL) {
+            cons_show("    Values:");
+        }
+        while (curr_value != NULL) {
+            char *value = curr_value->data;
+            cons_show("      %s", value);
+
+            curr_value = g_slist_next(curr_value);
+        }
+
+        GSList *options = field->options;
+        GSList *curr_option = options;
+        if (curr_option != NULL) {
+            cons_show("    Options:");
+        }
+        while (curr_option != NULL) {
+            FormOption *option = curr_option->data;
+            if (option->label != NULL) {
+                cons_show("      Label: %s", option->label);
+            }
+            if (option->value != NULL) {
+                cons_show("      Value: %s", option->value);
+            }
+
+            curr_option = g_slist_next(curr_option);
         }
 
-        curr = g_slist_next(curr);
+        curr_field = g_slist_next(curr_field);
     }
 
     form_destroy(form);