1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00
Commit Graph

159 Commits

Author SHA1 Message Date
Steffen Jaeckel
9cf78e59d5 auto-format
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-02-01 15:01:28 +01:00
Michael Vetter
f21595597f Format code correctly 2021-10-05 10:01:27 +02:00
Michael Vetter
a46c4443e3 Fix segfault when aesgcm url isn't the expected size
Fixes the bug mentioned in
https://github.com/profanity-im/profanity/issues/1478#issuecomment-794161606

The rest of https://github.com/profanity-im/profanity/issues/1478 I
can't reproduce. Seems to work fine.
2021-06-30 12:27:11 +02:00
Michael Vetter
e9ef3cf1d2 http upload: use correct content type
This bug was introduced in 1ec606540e when
`g_strdup_printf` was used instead of `asprintf`.

Problem discoverd by raspeguy.
Mistake discovered by optmzr and Martin.

Thanks to everybody involved!
2021-06-02 15:29:32 +02:00
Michael Vetter
1ec606540e Get rid of asprintf and _GNU_SOURCE define
_GNU_SOURCE was even in some files where it was not needed at all
(http*).

Let's replace asprintf() with g_strdup_printf().
2021-03-30 17:38:13 +02:00
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
638a50f8d1 autocomplete: remove duplicate code in search functions
_search_next and _search_prev where exactly the same except taking the
nex/prev from the list.
Use one function with a direction argument.
2021-03-11 22:24:27 +01:00
Michael Vetter
e3133ed98f autocomplete: Use asprintf don't calculate length twice
Through asprintf() we can get rid of malloc() + sprintf().
Also we don't need to calculate the strlen() again since asprintf()
returns the bytes printes.

Only non UTF-8 characters. But that was true before already.
2021-03-11 22:24:02 +01:00
Michael Vetter
c1ccaee58f Remove duplicate code in autocomplete_param*
autocomplete_param_with_func and -autocomplete_param_with_ac had lots of
duplicate code.
2021-03-11 22:08:04 +01:00
Thorben Günther
c29343b811
Upload: Fix unused return 2021-03-11 21:05:35 +01:00
Maximilian Wuttke
e217ed0b79 Update to the newest version of XEP 0363 (HTTP Upload)
Main changes:

1. Attributes instead of tags
2. Read the optional <header> tags and send them in the HTTP PUT header:

   * Authorization
   * Cookie
   * Expires

Co-authored-by: Martin Dosch <martin@mdosch.de>
2021-03-11 17:11:22 +01:00
Michael Vetter
8c08e64f37 Update copyright 2021-01-08 16:36:30 +01:00
William Wennerström
42a0518ff4
Fix deadlock on error before HTTP download has begun 2020-12-10 19:26:06 +01:00
William Wennerström
5c5b4d7025
Remove cmd_tiny, empty files and link nonce with IV 2020-12-07 16:30:03 +01:00
William Wennerström
867d895469
Add tests for format_call_external_argv 2020-12-07 16:16:15 +01:00
William Wennerström
4a1c118b8b
Fix bad order of parameters for url save 2020-12-07 15:15:06 +01:00
William Wennerström
ac03037847
Rework url to filename 2020-12-06 17:02:09 +01:00
William Wennerström
1d2c0a8836
Move unique_filename_from_url functions to common 2020-12-04 16:13:13 +01:00
William Wennerström
3a6597ee29
Refactor for threaded external executable for built-in download methods 2020-12-03 16:54:06 +01:00
William Wennerström
1bb6cecee6
Fix stubs and move some tests to http_common 2020-11-16 21:58:10 +01:00
William Wennerström
ab83afe21b
Switch to g_strerror 2020-11-16 21:58:09 +01:00
William Wennerström
3d344cfeaa
Move common http tool code to http_common 2020-11-16 21:58:09 +01:00
William Wennerström
62cbad1c6e
Add I/O error handling and use filenames instead of file descriptors 2020-11-16 21:58:09 +01:00
William Wennerström
73f313b921
Refactor OMEMO download into AESGCMDownload tool 2020-11-16 21:58:09 +01:00
William Wennerström
4711fc62a3
Run make format on rebase 2020-11-16 21:58:09 +01:00
William Wennerström
a0cf0844ab
Remove unsafe Conent-Disposition inferring 2020-11-16 21:58:09 +01:00
William Wennerström
eebf54c859
Infer filename from content-disposition or URL
The Content-Disposition inferring is probably a bad idea security wise,
so I am going to remove it.
2020-11-16 21:58:09 +01:00
William Wennerström
9499df6585
Add http_download tool 2020-11-16 21:58:09 +01:00
William Wennerström
e98644f631
Add guards for OMEMO 2020-11-16 21:58:08 +01:00
William Wennerström
d5b1dc0eb6
Move setup for AESGCM to omemo/crypto 2020-11-16 21:58:08 +01:00
William Wennerström
e9d5875782
Reformat HTTP get URL to AESGCM scheme 2020-11-16 21:58:08 +01:00
William Wennerström
39c3290613
Refactor to use file stream 2020-11-16 21:58:08 +01:00
William Wennerström
3370418d71
Initial /sendfile OMEMO encryption 2020-11-16 21:58:07 +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
b5794a51bb bookmark_ignore.c: use gchar instead of char 2020-07-20 10:17:35 +02:00
Michael Vetter
1f90a41b89 Fix typo in comment 2020-07-15 11:18:27 +02:00
Michael Vetter
39315483a8 Remove /tiny command
boothj5 gave his okay too.

Fix https://github.com/profanity-im/profanity/issues/1370
2020-07-10 17:48:34 +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
e5ac12afa6 Remove prefs_free_string()
It just does a free.
Related to b580b9ef11
2020-07-02 11:34:12 +02:00
Dmitry Podgorny
ca3da61776 Add missed string.h
strdup(3) requires string.h
2020-06-24 03:07:53 +03:00
Michael Vetter
de91a99178 Fix memleak in autocomplete_remove_older_than_max* 2020-05-29 11:28:58 +02:00
Michael Vetter
bfaf737efa urlopen: get last URL first
Fix https://github.com/profanity-im/profanity/issues/1348
2020-05-29 11:26:18 +02:00
Michael Vetter
438552c14c Save bookmark ignore list 2020-05-25 13:49:24 +02:00