From c8b74387361ed600878f27b50f2ee14d8582ef13 Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Sun, 14 Jul 2013 21:32:20 +0300 Subject: [PATCH 1/5] fixed typos in command.c --- src/command/command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/command.c b/src/command/command.c index 63d003f4..6bcc9986 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -2780,7 +2780,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; } @@ -2804,7 +2804,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; } From 0b221bde2055766410b3392edd958ef45e47671c Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Sun, 14 Jul 2013 21:34:02 +0300 Subject: [PATCH 2/5] removed useless code in autocomplete.c --- src/tools/autocomplete.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index 849aaf1d..b53e49bd 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -68,8 +68,7 @@ void autocomplete_free(Autocomplete ac) { autocomplete_clear(ac); - g_free(ac); - ac = NULL; + free(ac); } gint From 8137efbfa3a99b3e1b2f8aeeab90fe44220abc33 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 20 Jul 2013 20:53:43 +0100 Subject: [PATCH 3/5] Added test for quoted freetext in parser --- tests/test_parser.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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); From 7af6bad5e69742386747e05e749589d937bb1377 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 20 Jul 2013 21:02:07 +0100 Subject: [PATCH 4/5] Fix freetext arguments with quotes fixes #203 --- src/tools/parser.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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); } } } From cbe3c41abedf5ffa48761009af4ab426eb850a38 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 20 Jul 2013 23:47:57 +0100 Subject: [PATCH 5/5] Fixed typo on /invite help --- src/command/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/command.c b/src/command/command.c index f15de124..2e31605d 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -333,7 +333,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",