Moved room config UI code to ui/core.c
This commit is contained in:
@@ -466,76 +466,7 @@ handle_room_destroy(const char * const room)
|
|||||||
void
|
void
|
||||||
handle_room_configure(const char * const room, DataForm *form)
|
handle_room_configure(const char * const room, DataForm *form)
|
||||||
{
|
{
|
||||||
cons_show("Recieved configuration form for %s", room);
|
ui_handle_room_configuration(room, form);
|
||||||
|
|
||||||
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_field = fields;
|
|
||||||
while (curr_field != NULL) {
|
|
||||||
FormField *field = curr_field->data;
|
|
||||||
cons_show(" Field:");
|
|
||||||
|
|
||||||
if (field->label != NULL) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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_field = g_slist_next(curr_field);
|
|
||||||
}
|
|
||||||
|
|
||||||
form_destroy(form);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -1870,6 +1870,81 @@ _ui_draw_term_title(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ui_handle_room_configuration(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_field = fields;
|
||||||
|
while (curr_field != NULL) {
|
||||||
|
FormField *field = curr_field->data;
|
||||||
|
cons_show(" Field:");
|
||||||
|
|
||||||
|
if (field->label != NULL) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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_field = g_slist_next(curr_field);
|
||||||
|
}
|
||||||
|
|
||||||
|
form_destroy(form);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_win_handle_switch(const wint_t * const ch)
|
_win_handle_switch(const wint_t * const ch)
|
||||||
{
|
{
|
||||||
@@ -2107,4 +2182,5 @@ ui_init_module(void)
|
|||||||
ui_update = _ui_update;
|
ui_update = _ui_update;
|
||||||
ui_room_requires_config = _ui_room_requires_config;
|
ui_room_requires_config = _ui_room_requires_config;
|
||||||
ui_room_destroyed = _ui_room_destroyed;
|
ui_room_destroyed = _ui_room_destroyed;
|
||||||
|
ui_handle_room_configuration = _ui_handle_room_configuration;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ void (*ui_handle_recipient_error)(const char * const recipient, const char * con
|
|||||||
void (*ui_handle_error)(const char * const err_msg);
|
void (*ui_handle_error)(const char * const err_msg);
|
||||||
void (*ui_clear_win_title)(void);
|
void (*ui_clear_win_title)(void);
|
||||||
void (*ui_handle_room_join_error)(const char * const room, const char * const err);
|
void (*ui_handle_room_join_error)(const char * const room, const char * const err);
|
||||||
|
void (*ui_handle_room_configuration)(const char * const room, DataForm *form);
|
||||||
|
|
||||||
// contact status functions
|
// contact status functions
|
||||||
void (*ui_status_room)(const char * const contact);
|
void (*ui_status_room)(const char * const contact);
|
||||||
|
|||||||
Reference in New Issue
Block a user