diff --git a/src/command/command.c b/src/command/command.c index 1673707c..6cf60ce7 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -336,7 +336,7 @@ static struct cmd_t command_defs[] = { "/invite contact [message]", "-------------------------", "Send a direct invite to the specified contact to the current chat room.", - "If a message is supplied it will be send as the reason for the invite.", + "If a message is supplied it will be sent as the reason for the invite.", NULL } } }, { "/invites", @@ -2809,7 +2809,7 @@ _cmd_rooms(gchar **args, struct cmd_help_t help) jabber_conn_status_t conn_status = jabber_get_connection_status(); if (conn_status != JABBER_CONNECTED) { - cons_show("You are currenlty connect."); + cons_show("You are not currenlty connected."); return TRUE; } @@ -2900,7 +2900,7 @@ _cmd_disco(gchar **args, struct cmd_help_t help) jabber_conn_status_t conn_status = jabber_get_connection_status(); if (conn_status != JABBER_CONNECTED) { - cons_show("You are currenlty connect."); + cons_show("You are not currenlty connected."); return TRUE; } diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index 4b25edd6..0c56cac7 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -69,8 +69,7 @@ void autocomplete_free(Autocomplete ac) { autocomplete_clear(ac); - g_free(ac); - ac = NULL; + free(ac); } gint diff --git a/src/tools/parser.c b/src/tools/parser.c index f4cfc3d2..dabf7128 100644 --- a/src/tools/parser.c +++ b/src/tools/parser.c @@ -242,15 +242,15 @@ parse_args_with_freetext(const char * const inp, int min, int max) } } } else { - if (!in_freetext && curr_uni == ' ') { + if (in_freetext) { + token_size += g_unichar_to_utf8(curr_uni, NULL); + } else if (curr_uni == ' ') { tokens = g_slist_append(tokens, g_strndup(token_start, token_size)); token_size = 0; in_token = FALSE; - } else { - if (curr_uni != '"') { - token_size += g_unichar_to_utf8(curr_uni, NULL); - } + } else if (curr_uni != '"') { + token_size += g_unichar_to_utf8(curr_uni, NULL); } } } diff --git a/tests/test_parser.c b/tests/test_parser.c index e442baee..6df5eb1d 100644 --- a/tests/test_parser.c +++ b/tests/test_parser.c @@ -280,6 +280,18 @@ parse_cmd_freetext_with_many_quoted_and_many_spaces(void) g_strfreev(result); } +void +parse_cmd_with_quoted_freetext(void) +{ + char *inp = "/cmd arg1 here is \"some\" quoted freetext"; + gchar **result = parse_args_with_freetext(inp, 1, 2); + + assert_int_equals(2, g_strv_length(result)); + assert_string_equals("arg1", result[0]); + assert_string_equals("here is \"some\" quoted freetext", result[1]); + g_strfreev(result); +} + void count_one_token(void) { @@ -425,6 +437,7 @@ register_parser_tests(void) TEST(parse_cmd_freetext_with_quoted_and_space); TEST(parse_cmd_freetext_with_quoted_and_many_spaces); TEST(parse_cmd_freetext_with_many_quoted_and_many_spaces); + TEST(parse_cmd_with_quoted_freetext); TEST(count_one_token); TEST(count_one_token_quoted_no_whitespace); TEST(count_one_token_quoted_with_whitespace);