1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Add support for form edition in command execution

Also change wins_get_by_string prototype in order to handle const str.
This commit is contained in:
Paul Fariello 2018-03-23 21:10:10 +02:20
parent 40eee1caab
commit 7123e94e82
3 changed files with 26 additions and 9 deletions

View File

@ -364,7 +364,7 @@ wins_get_by_num(int i)
}
ProfWin*
wins_get_by_string(char *str)
wins_get_by_string(const char *str)
{
if (g_strcmp0(str, "console") == 0) {
ProfWin *conswin = wins_get_console();

View File

@ -68,7 +68,7 @@ ProfWin* wins_get_current(void);
void wins_set_current_by_num(int i);
ProfWin* wins_get_by_num(int i);
ProfWin* wins_get_by_string(char *str);
ProfWin* wins_get_by_string(const char *str);
ProfWin* wins_get_next(void);
ProfWin* wins_get_previous(void);

View File

@ -1097,7 +1097,7 @@ _command_exec_response_handler(xmpp_stanza_t *const stanza, void *const userdata
{
const char *id = xmpp_stanza_get_id(stanza);
const char *type = xmpp_stanza_get_type(stanza);
char *from = strdup(xmpp_stanza_get_from(stanza));
const char *from = xmpp_stanza_get_from(stanza);
const char *const command = userdata;
if (id) {
@ -1115,7 +1115,6 @@ _command_exec_response_handler(xmpp_stanza_t *const stanza, void *const userdata
win_command_exec_error(win, command, error_message);
}
free(error_message);
free(from);
return 0;
}
@ -1136,13 +1135,31 @@ _command_exec_response_handler(xmpp_stanza_t *const stanza, void *const userdata
win_handle_command_exec_result_note(win, type, value);
}
}
} else if (g_strcmp0(status, "executing") == 0) {
} else if (g_strcmp0(status, "canceled") == 0) {
} else {
/* TODO */
return 0;
}
free(from);
if (g_strcmp0(status, "executing") == 0) {
xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(cmd, STANZA_NS_DATA);
if (x == NULL) {
/* TODO */
return 0;
}
const char *form_type = xmpp_stanza_get_type(x);
if (g_strcmp0(form_type, "form") != 0) {
/* TODO */
return 0;
}
DataForm *form = form_create(x);
ProfMucConfWin *confwin = (ProfMucConfWin*)wins_new_muc_config(from, form);
mucconfwin_handle_configuration(confwin, form);
}
if (g_strcmp0(status, "canceled") == 0) {
}
/* TODO */
return 0;
}