1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Merge branch 'master' into nextdev

This commit is contained in:
James Booth 2013-07-21 23:33:32 +01:00
commit c5c596f70a
4 changed files with 22 additions and 10 deletions

View File

@ -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;
}

View File

@ -69,8 +69,7 @@ void
autocomplete_free(Autocomplete ac)
{
autocomplete_clear(ac);
g_free(ac);
ac = NULL;
free(ac);
}
gint

View File

@ -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);
}
}
}

View File

@ -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);