mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Debug room config form fields
This commit is contained in:
parent
c133b89313
commit
9728d1a727
@ -477,8 +477,17 @@ handle_room_configure(const char * const room, DataForm *form)
|
||||
GSList *curr = fields;
|
||||
while (curr != NULL) {
|
||||
FormField *field = curr->data;
|
||||
|
||||
if (field->label != NULL) {
|
||||
cons_show(" Field: %s", field->label);
|
||||
} else {
|
||||
cons_show(" Field:");
|
||||
}
|
||||
if (field->type != NULL) {
|
||||
cons_show(" Type: %s", field->type);
|
||||
}
|
||||
if (field->var != NULL) {
|
||||
cons_show(" Field: %s", field->var);
|
||||
cons_show(" var: %s", field->var);
|
||||
}
|
||||
|
||||
curr = g_slist_next(curr);
|
||||
|
@ -1087,23 +1087,39 @@ stanza_create_form(xmpp_stanza_t * const stanza)
|
||||
|
||||
//handle fields
|
||||
while (child != NULL) {
|
||||
char *label = xmpp_stanza_get_attribute(child, "label");
|
||||
char *type = xmpp_stanza_get_attribute(child, "type");
|
||||
char *var = xmpp_stanza_get_attribute(child, "var");
|
||||
|
||||
// handle FORM_TYPE
|
||||
if (g_strcmp0(var, "FORM_TYPE") == 0) {
|
||||
xmpp_stanza_t *value = xmpp_stanza_get_child_by_name(child, "value");
|
||||
char *value_text = xmpp_stanza_get_text(value);
|
||||
if (value_text != NULL) {
|
||||
result->form_type = strdup(value_text);
|
||||
xmpp_free(ctx, value_text);
|
||||
}
|
||||
|
||||
// handle regular fields
|
||||
} else {
|
||||
FormField *field = malloc(sizeof(FormField));
|
||||
field->label = NULL;
|
||||
field->type = NULL;
|
||||
field->var = NULL;
|
||||
|
||||
if (label != NULL) {
|
||||
field->label = strdup(label);
|
||||
}
|
||||
if (type != NULL) {
|
||||
field->type = strdup(type);
|
||||
}
|
||||
if (var != NULL) {
|
||||
field->var = strdup(var);
|
||||
field->values = NULL;
|
||||
xmpp_stanza_t *value = xmpp_stanza_get_children(child);
|
||||
}
|
||||
|
||||
// handle values
|
||||
field->values = NULL;
|
||||
xmpp_stanza_t *value = xmpp_stanza_get_children(child);
|
||||
while (value != NULL) {
|
||||
char *text = xmpp_stanza_get_text(value);
|
||||
if (text != NULL) {
|
||||
|
@ -87,6 +87,8 @@ typedef struct disco_identity_t {
|
||||
} DiscoIdentity;
|
||||
|
||||
typedef struct form_field_t {
|
||||
char *label;
|
||||
char *type;
|
||||
char *var;
|
||||
GSList *values;
|
||||
} FormField;
|
||||
|
Loading…
Reference in New Issue
Block a user