Added new window and layout types

This commit is contained in:
James Booth
2014-12-16 01:39:47 +00:00
parent 070547a7ff
commit 630fef015d
8 changed files with 466 additions and 389 deletions

View File

@@ -1666,8 +1666,9 @@ cmd_reset_autocomplete()
if (ui_current_win_type() == WIN_MUC_CONFIG) {
ProfWin *window = wins_get_current();
if (window && window->wins.conf.form) {
form_reset_autocompleters(window->wins.conf.form);
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
if (window && confwin->form) {
form_reset_autocompleters(confwin->form);
}
}
@@ -1782,9 +1783,10 @@ cmd_execute_default(const char * inp)
} else {
GString *send_recipient = g_string_new(recipient);
ProfWin *current = wins_get_current();
if (current && current->wins.chat.resource) {
ProfChatWin *chatwin = (ProfChatWin*)current;
if (current && win_has_chat_resource(current)) {
g_string_append(send_recipient, "/");
g_string_append(send_recipient, current->wins.chat.resource);
g_string_append(send_recipient, chatwin->resource);
}
#ifdef HAVE_LIBOTR
@@ -2462,7 +2464,8 @@ _form_autocomplete(char *input, int *size)
char *found = NULL;
DataForm *form = current->wins.conf.form;
ProfMucConfWin *confwin = (ProfMucConfWin*)current;
DataForm *form = confwin->form;
if (form) {
found = autocomplete_param_with_ac(input, size, "/form help", form->tag_ac, TRUE);
if (found != NULL) {
@@ -2488,7 +2491,8 @@ _form_field_autocomplete(char *input, int *size)
char *found = NULL;
DataForm *form = current->wins.conf.form;
ProfMucConfWin *confwin = (ProfMucConfWin*)current;
DataForm *form = confwin->form;
if (form == NULL) {
return NULL;
}

View File

@@ -1151,9 +1151,10 @@ cmd_msg(gchar **args, struct cmd_help_t help)
}
GString *send_jid = g_string_new(usr_jid);
ProfWin *current = wins_get_current();
if (current->type == WIN_CHAT && current->wins.chat.resource) {
if (current->type == WIN_CHAT && win_has_chat_resource(current)) {
ProfChatWin *chatwin = (ProfChatWin *)current;
g_string_append(send_jid, "/");
g_string_append(send_jid, current->wins.chat.resource);
g_string_append(send_jid, chatwin->resource);
}
if (msg != NULL) {
@@ -1545,6 +1546,8 @@ cmd_resource(gchar **args, struct cmd_help_t help)
return TRUE;
}
ProfChatWin *chatwin = (ProfChatWin*)current;
char *cmd = args[0];
if (g_strcmp0(cmd, "set") == 0) {
@@ -1574,11 +1577,11 @@ cmd_resource(gchar **args, struct cmd_help_t help)
return TRUE;
}
current->wins.chat.resource = strdup(resource);
chatwin->resource = strdup(resource);
return TRUE;
} else if (g_strcmp0(cmd, "off") == 0) {
FREE_SET_NULL(current->wins.chat.resource);
FREE_SET_NULL(chatwin->resource);
return TRUE;
} else {
cons_show("Usage: %s", help.usage);
@@ -1989,7 +1992,8 @@ cmd_form_field(char *tag, gchar **args)
return TRUE;
}
DataForm *form = current->wins.conf.form;
ProfMucConfWin *confwin = (ProfMucConfWin*)current;
DataForm *form = confwin->form;
if (form) {
if (!form_tag_exists(form, tag)) {
ui_current_print_line("Form does not contain a field with tag %s", tag);
@@ -2225,11 +2229,12 @@ cmd_form(gchar **args, struct cmd_help_t help)
char *recipient = ui_current_recipient();
ProfWin *current = wins_get_current();
ProfMucConfWin *confwin = (ProfMucConfWin*)current;
gchar **split_recipient = g_strsplit(recipient, " ", 2);
char *room = split_recipient[0];
if (g_strcmp0(args[0], "show") == 0) {
ui_show_form(current, room, current->wins.conf.form);
ui_show_form(current, room, confwin->form);
g_strfreev(split_recipient);
return TRUE;
}
@@ -2237,9 +2242,9 @@ cmd_form(gchar **args, struct cmd_help_t help)
if (g_strcmp0(args[0], "help") == 0) {
char *tag = args[1];
if (tag != NULL) {
ui_show_form_field_help(current, current->wins.conf.form, tag);
ui_show_form_field_help(current, confwin->form, tag);
} else {
ui_show_form_help(current, current->wins.conf.form);
ui_show_form_help(current, confwin->form);
const gchar **help_text = NULL;
Command *command = g_hash_table_lookup(commands, "/form");
@@ -2256,7 +2261,7 @@ cmd_form(gchar **args, struct cmd_help_t help)
}
if (g_strcmp0(args[0], "submit") == 0) {
iq_submit_room_config(room, current->wins.conf.form);
iq_submit_room_config(room, confwin->form);
}
@@ -2265,8 +2270,8 @@ cmd_form(gchar **args, struct cmd_help_t help)
}
if ((g_strcmp0(args[0], "submit") == 0) || (g_strcmp0(args[0], "cancel") == 0)) {
if (current->wins.conf.form) {
cmd_autocomplete_remove_form_fields(current->wins.conf.form);
if (confwin->form) {
cmd_autocomplete_remove_form_fields(confwin->form);
}
wins_close_current();
current = wins_get_by_recipient(room);
@@ -2934,9 +2939,10 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
char *recipient = ui_current_recipient();
GString *send_recipient = g_string_new(recipient);
ProfWin *current = wins_get_current();
if (current && current->wins.chat.resource) {
ProfChatWin *chatwin = (ProfChatWin*)current;
if (current && win_has_chat_resource(current)) {
g_string_append(send_recipient, "/");
g_string_append(send_recipient, current->wins.chat.resource);
g_string_append(send_recipient, chatwin->resource);
}
#ifdef HAVE_LIBOTR