1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00
Commit Graph

47 Commits

Author SHA1 Message Date
Michael Vetter
057c9ad776 Add config.h in files were it was missing
Related to https://github.com/profanity-im/profanity/issues/1512
2021-03-26 19:54:22 +01:00
Michael Vetter
35aecd425f Declare counter var inside loop
We require c99/gnu99 anyways.
2020-11-09 11:33:33 +01:00
Michael Vetter
ade0ff589d parser.c: Use glib
We use malloc() to allcoate memory for the arguments.
But later on in cmd_funcs.c we use g_strfreev() to free it.
Let's use g_malloc() to allocate instead.

Second change is to use g_malloc() and g_free() for a gchar.
2020-07-23 09:42:43 +02:00
Michael Vetter
8c0c5cb28c Fix /correct quotation marks usage
Add new `parse_args_as_one()` function to just use everything after the
command as the argument.

Fix https://github.com/profanity-im/profanity/issues/1404
2020-07-23 09:40:22 +02:00
Michael Vetter
5a9f76c16a parser.c: Use helper function to reduce duplicate code
`parse_args()` and `parse_args_with_freetext()` shared a lot of common
code.
Let's have a helper function `_parse_args_helper()` for that. The
`with_freetext` parameter will make it behave like
`parse_args_with_freetext()`.

In preparation for https://github.com/profanity-im/profanity/issues/1404
2020-07-21 10:45:29 +02:00
Michael Vetter
0077d02c86 parse_args(): Call g_free() once 2020-07-21 10:20:34 +02:00
Michael Vetter
86281072f9 Use parse_args_with_freetext() for /correct
This commit partly reverts
8f37afcd37
Which was using a wrong approach to achieve this.

It changed parse_args() to have a -1 for infinite parameters.
But actually parse_args_with_freetext() should have been used exactly
for this behaviour.

Discovered when checking for
https://github.com/profanity-im/profanity/issues/1404
2020-07-20 15:33:19 +02:00
Michael Vetter
1f90a41b89 Fix typo in comment 2020-07-15 11:18:27 +02:00
Michael Vetter
a2726b6a7d Apply coding style 2020-07-07 14:18:57 +02:00
Michael Vetter
a4cadf78fa Revert "Apply coding style"
This reverts commit 9b55f2dec0.

Sorting the includes creates some problems.
2020-07-07 13:53:30 +02:00
Michael Vetter
9b55f2dec0 Apply coding style
Regards https://github.com/profanity-im/profanity/issues/1396
2020-07-07 09:43:28 +02:00
Michael Vetter
8f37afcd37 xep-0308: Make /correct work without quotation marks
Now we can specify an unlimited amount of arguments for commands.
Maybe this is also helpful for other commands that use quotation marks
so far.
2020-02-14 10:17:07 +01:00
Michael Vetter
46fd7150e5 Add vim modeline 2019-11-13 12:11:05 +01:00
Michael Vetter
b591f0cf2b Free list in error case in parse_options
Fix memleaks.

Regards https://github.com/profanity-im/profanity/issues/1019
2019-10-06 18:12:50 +02:00
Michael Vetter
897dfbb3c1 Fix memleak in get_start()
Regards https://github.com/profanity-im/profanity/issues/1019
2019-10-06 17:42:44 +02:00
Michael Vetter
706af9a900 Update copyright to include 2019 2019-01-22 11:31:45 +01:00
James Booth
250e972b7a Update copyright 2018-01-21 15:00:02 +00:00
James Booth
68a3daedb9 Update Copyright 2017-01-28 17:24:22 +00:00
James Booth
e8fc80f5c1 Update GPL link in headers 2016-07-24 01:14:49 +01:00
James Booth
e53e94f1e2 Updated copyright 2016-02-14 22:54:46 +00:00
James Booth
0017098400 Applied coding style to src/tools/ 2015-10-25 22:47:42 +00:00
James Booth
fe216b4e97 Use null check convention in parser.c 2015-05-04 22:57:19 +01:00
Christian Storm
a1d14c4526 Fixed spelling. 2015-02-17 10:52:37 +01:00
James Booth
b3be26a214 Updated copyright 2015-02-10 23:16:09 +00:00
James Booth
4c6cfcdca0 Simplified autocompleters and command history 2015-01-16 22:50:40 +00:00
James Booth
f9737251a6 Added license exemption for OpenSSL to source headers 2014-08-24 20:57:39 +01:00
James Booth
ecedca8a95 Free tokens when 0 supplied an 0 min, parse_args_with_freetext 2014-06-17 22:30:51 +01:00
James Booth
ff37b44a62 Added common.h to parser.c 2014-05-22 20:07:43 +01:00
James Booth
d6e92f62dc Fixed cppcheck warnings 2014-04-26 00:36:36 +01:00
James Booth
40759eddbf Simplified parse_options to take first option as argument 2014-04-15 00:27:55 +01:00
James Booth
4425aba1f2 Simplified parse_options to take gchar** 2014-04-15 00:13:32 +01:00
James Booth
3e69d6b71e Refactored cmd_join to use parse_options 2014-04-14 23:36:00 +01:00
James Booth
2419737006 Check for duplicate options in option parser 2014-04-14 23:01:57 +01:00
James Booth
8d77930ece Added parse_options 2014-04-14 22:48:18 +01:00
James Booth
c3e3759256 Command argument parsers set result argument 2014-04-09 21:31:43 +01:00
James Booth
26726b207a Updated copyright 2014-03-09 01:18:19 +00:00
James Booth
b738e8f363 Moved free in parse_args_with_freetext
issue #226
2013-09-23 01:19:54 +01:00
James Booth
cb507497b6 Fixed memory leak in parse_args_with_freetext
issue #226
2013-09-23 00:09:30 +01:00
James Booth
bac97125a3 Fix quoted nicknames in /group add
fixes #233
2013-08-27 00:05:09 +01:00
James Booth
7af6bad5e6 Fix freetext arguments with quotes
fixes #203
2013-07-20 21:02:07 +01:00
James Booth
7f82dc42f5 Remaining parser function unicode compatible 2013-07-14 01:00:11 +01:00
James Booth
e7478d8cb8 Added parser tests 2013-07-14 00:46:56 +01:00
James Booth
4d35031cb0 Implemented parse_args_with_freetext with unicode compatibility 2013-07-14 00:24:57 +01:00
James Booth
51786f67a6 Implemented parse_args with unicode compatibility 2013-07-14 00:14:36 +01:00
James Booth
bb550fed55 Handle unicode chars in command parser 2013-07-12 00:46:33 +01:00
James Booth
5233000498 Removed if clause in parser 2013-07-11 23:03:20 +01:00
James Booth
36265dde2f Moved functions to parser.c, moved parser to tools 2013-07-11 22:57:35 +01:00