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

134 Commits

Author SHA1 Message Date
Michael Vetter
1330ad4e1e Update copyright year 2022-05-09 15:43:33 +02:00
Steffen Jaeckel
705b6f7806 use g_mkdir_with_parents() instead of home-baked solution
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-14 13:17:46 +01:00
Michael Vetter
8e588d6764 Fix random string generation
Our variable `alphabet` contains 62 alphanumeric symbols + '\0'.
When we use sizeof(alphabet) we will get 63 due to that.
But we want to choose a random numbers from the 62 alphanumeric letters only.

This mistake caused us to have strings with a max length of `length`
instead of the exact length.

When doing https://github.com/profanity-im/profanity/issues/1520
this caused our algo for muc reflection to not catch since we expect the
random ID to be exactly 15 symbols long in `message_is_sent_by_us()`.
2021-04-17 22:37:21 +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
Maximilian Wuttke
1576ac11cb Remove "file://" from file names
Rationale: When copying an image in some application, a URL instead of a
path is copied to the clipboard.
2021-03-09 20:45:29 +01:00
Michael Vetter
8c08e64f37 Update copyright 2021-01-08 16:36:30 +01:00
William Wennerström
0437fae1a8
Do not inherit stdin of main process
I see no reason to inherit the stdin, so let's have it disabled.
2020-12-15 15:48:51 +01:00
William Wennerström
32cfea4bd2
Refactor call_external 2020-12-11 15:51:01 +01:00
William Wennerström
073412b845
Remove stray +2 for path string in get_expanded_path 2020-12-09 19:24:15 +01:00
Michael Vetter
b525befe67 Allocate memory for realpath in both cases
Forgot about that :(
2020-12-09 16:22:06 +01:00
Michael Vetter
a2291b36c4 Expand ~ in unique_filename_from_url()
unique_filename_from_url() is used for `/url save`.
It doesn't recognize ~ by itself, we need to expand it first.

Mentioned in
https://github.com/profanity-im/profanity/pull/1375#pullrequestreview-547892462
2020-12-09 08:44:26 +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
Michael Vetter
35aecd425f Declare counter var inside loop
We require c99/gnu99 anyways.
2020-11-09 11:33:33 +01:00
Michael Vetter
3d307fe341 Get rid of str_contains()
We can use strchr() here.
2020-11-02 18:52:25 +01:00
nia
52e9be4abc Basic support for building on NetBSD.
- Add NetBSD as a recognized platform without -ldl.
- Allow building with NetBSD libcurses instead of ncurses.
- Portability to NetBSD sh - use POSIX '=' instead of '=='.
2020-09-04 12:55:20 +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
f4159d8168 get_mentions() Use gchar instead of char 2020-07-02 12:17:23 +02:00
Michael Vetter
914c6752dd Fix reading/writing linked files
"base" was not really base but the filename :-)

Fix https://github.com/profanity-im/profanity/issues/1362
2020-06-13 15:02:43 +02:00
Pierre Mazière
d92c576aa5 Get output and error streams from the command spawned by external_call()
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2020-06-03 13:09:29 +02:00
Michael Vetter
fc5fa62951 Create call_external() helper function 2020-05-20 10:54:58 +02:00
Michael Vetter
a6fa8e8e0d Remove unneeded file_getline()
Not needed anymore since 0942d98c61
2020-04-20 15:42:01 +02:00
Dmitry Podgorny
b3eea13125 Free GError objects
glib functions can allocate a GError object that must be freed with
g_error_free(). Otherwise a memory leak happens.

There are similar unfixed places in omemo, check:
    grep "&error" src/omemo/omemo.c

Fixes #1304.
2020-04-14 03:26:49 +03:00
Michael Vetter
1ddac7b9c6 Put getting mentions in own function
So we can use it somewhere else too.

Regards https://github.com/profanity-im/profanity/issues/1261
2020-02-20 10:03:36 +01:00
Michael Vetter
be13e98fe7 Update my Copyright to 2020 2020-01-03 19:52:31 +01:00
Michael Vetter
46fd7150e5 Add vim modeline 2019-11-13 12:11:05 +01:00
Michael Vetter
f9eb302a59 Move code from jid_random_resource() into own function
Move the code that creates a random string into it's own function
+get_random_string().
2019-10-16 10:39:35 +02:00
Michael Vetter
c135f989ec Check errors in is_dir() is_regular_file()
In case of error print the error. And return right value.

Improvement based on @pasis advice in https://github.com/profanity-im/profanity/pull/1036
Applying in preparation to merge that PR.
2019-10-04 23:29:10 +02:00
Michael Vetter
40b72ffe55 Add myself to copyright
Like discussed with James.
2019-06-17 10:44:08 +02:00
Frank Zschockelt
56e925ed03 Don't call mblen() to not depend on locale
mblen will fail with return code -1 if the locale used by the unit tests
isn't available on the machine. This will lead to an off by one error in some
tests where the needle is at the end of the haystack.

Since prof_occurrences expect null-terminated strings, the character after
the needle can simply be found by incrementing the address of the found needle
with strlen(needle).
2019-05-22 19:57:52 +02:00
Michael Vetter
1446ac15cb Check for new profanity version using new URL
Regards https://github.com/profanity-im/profanity/issues/1085
2019-05-03 10:33:46 +02:00
Michael Vetter
706af9a900 Update copyright to include 2019 2019-01-22 11:31:45 +01:00
Michael Vetter
bb87122af9
Merge pull request #1011 from jubalh/sha1
Get rid of p_sha1 dependency
2018-09-19 11:45:19 +02:00
Michael Vetter
82f8083b85 Move p_sha1_hash() to stanza.c
Move `p_sha1_hash()` from `common.c` to	`xmpp/stanza.c` as it is only
used in this file and now depends on libstrophe so xmpp is a better
namespace folder.
Renaming it as `_stanza_create_sha1_hash()`. And making static since
only used here.

The function cannot be tested in the unit tests anymore.
Once functional tests are working again we should write a test for the
sha1 functionality.
2018-09-06 20:40:09 +02:00
Philip Flohr
054267d738 Fix extended plugin handling PR
Fixes problems found in PR #999
2018-09-06 19:54:29 +03:00
Philip Flohr
e4ddced420 use gio functions for file copy 2018-09-06 19:28:02 +03:00
Michael Vetter
dcc249a616 Use libstrophe sha1 functions
Using libstrophes sha1 functions in p_sha1_hash() to get rid of the
p_sha1.c dependency.

Relates to https://github.com/boothj5/profanity/issues/882
2018-09-05 11:31:33 +02:00
Michael Vetter
6d80700329 Move ID generation to xmpp folder
create_unique_id() was changed to use UUIDs instead of a counter in the
last commit. Since now it depends on connection_create_uuid() which is
in the xmpp subfolder the function should also be moved there.

Renamed it to connection_create_stanza_id() and moved it to
src/xmpp/connection.c.

Discussion happened in https://github.com/boothj5/profanity/pull/1010
2018-08-30 11:17:04 +02:00
Michael Vetter
f4fb61b0c8 Use uuid in create_unique_id instead of counter
Message IDs should be unique so they can be used by XEPs like delivery receipts, chat markers, message correction.

So far it used a counter so restarting profanity will cause the counter
to be 0 again.

Let's rather use an UUID since we have such a function in the
xmpp/xmpp.h already.

Closes https://github.com/boothj5/profanity/issues/998
2018-08-14 15:51:18 +02:00
James Booth
250e972b7a Update copyright 2018-01-21 15:00:02 +00:00
James Booth
d52355d72c Set locale in unit tests
issue #901
2017-04-29 20:33:28 +01:00
James Booth
3e18aab9f3 Use g_utf8_find_ functions for prof_occurrences
issue #901
2017-04-28 21:41:55 +01:00
James Booth
97edebadcb Update Glib dependency to 2.40 2017-03-25 02:07:27 +00:00
James Booth
286fecf38d Allow installing plugins from directory 2017-02-05 21:09:03 +00:00
James Booth
68a3daedb9 Update Copyright 2017-01-28 17:24:22 +00:00
James Booth
6679b890a0 Fix multibyte chars in prof_occurrences
issue #901
2017-01-26 00:52:13 +00:00
James Booth
6cc4abedc5 Move window functions to window_list.c 2016-07-24 17:02:09 +01:00