about summary refs log tree commit diff stats
path: root/src/common.c
Commit message (Collapse)AuthorAgeFilesLines
* use `g_mkdir_with_parents()` instead of home-baked solutionSteffen Jaeckel2022-03-141-32/+4
| | | | Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
* Fix random string generationMichael Vetter2021-04-171-1/+2
| | | | | | | | | | | | | 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()`.
* Get rid of asprintf and _GNU_SOURCE defineMichael Vetter2021-03-301-4/+3
| | | | | | | _GNU_SOURCE was even in some files where it was not needed at all (http*). Let's replace asprintf() with g_strdup_printf().
* Remove "file://" from file namesMaximilian Wuttke2021-03-091-0/+3
| | | | | Rationale: When copying an image in some application, a URL instead of a path is copied to the clipboard.
* Update copyrightMichael Vetter2021-01-081-1/+1
|
* Do not inherit stdin of main processWilliam Wennerström2020-12-151-1/+1
| | | | I see no reason to inherit the stdin, so let's have it disabled.
* Refactor call_externalWilliam Wennerström2020-12-111-78/+21
|
* Remove stray +2 for path string in get_expanded_pathWilliam Wennerström2020-12-091-6/+6
|
* Allocate memory for realpath in both casesMichael Vetter2020-12-091-1/+1
| | | | Forgot about that :(
* Expand ~ in unique_filename_from_url()Michael Vetter2020-12-091-3/+27
| | | | | | | | 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
* Rework url to filenameWilliam Wennerström2020-12-061-29/+36
|
* Move unique_filename_from_url functions to commonWilliam Wennerström2020-12-041-0/+80
|
* Refactor for threaded external executable for built-in download methodsWilliam Wennerström2020-12-031-0/+20
|
* Declare counter var inside loopMichael Vetter2020-11-091-4/+2
| | | | We require c99/gnu99 anyways.
* Get rid of str_contains()Michael Vetter2020-11-021-12/+0
| | | | We can use strchr() here.
* Basic support for building on NetBSD.nia2020-09-041-0/+2
| | | | | | - Add NetBSD as a recognized platform without -ldl. - Allow building with NetBSD libcurses instead of ncurses. - Portability to NetBSD sh - use POSIX '=' instead of '=='.
* Apply coding styleMichael Vetter2020-07-071-91/+86
|
* Revert "Apply coding style"Michael Vetter2020-07-071-92/+98
| | | | | | This reverts commit 9b55f2dec0ea27a9ce4856e303425e12f866cea2. Sorting the includes creates some problems.
* Apply coding styleMichael Vetter2020-07-071-98/+92
| | | | Regards https://github.com/profanity-im/profanity/issues/1396
* get_mentions() Use gchar instead of charMichael Vetter2020-07-021-2/+2
|
* Fix reading/writing linked filesMichael Vetter2020-06-131-0/+1
| | | | | | "base" was not really base but the filename :-) Fix https://github.com/profanity-im/profanity/issues/1362
* Get output and error streams from the command spawned by external_call()Pierre Mazière2020-06-031-8/+83
| | | | Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
* Create call_external() helper functionMichael Vetter2020-05-201-0/+13
|
* Remove unneeded file_getline()Michael Vetter2020-04-201-44/+0
| | | | Not needed anymore since 0942d98c6116dc4b9b608e7483f1d6a8f62c84d7
* Free GError objectsDmitry Podgorny2020-04-141-0/+2
| | | | | | | | | | 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.
* Put getting mentions in own functionMichael Vetter2020-02-201-0/+15
| | | | | | So we can use it somewhere else too. Regards https://github.com/profanity-im/profanity/issues/1261
* Update my Copyright to 2020Michael Vetter2020-01-031-1/+1
|
* Add vim modelineMichael Vetter2019-11-131-0/+1
|
* Move code from jid_random_resource() into own functionMichael Vetter2019-10-161-0/+20
| | | | | Move the code that creates a random string into it's own function +get_random_string().
* Check errors in is_dir() is_regular_file()Michael Vetter2019-10-041-2/+10
| | | | | | | 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.
* Add myself to copyrightMichael Vetter2019-06-171-0/+1
| | | | Like discussed with James.
* Don't call mblen() to not depend on localeFrank Zschockelt2019-05-221-5/+2
| | | | | | | | | | 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).
* Check for new profanity version using new URLMichael Vetter2019-05-031-1/+1
| | | | Regards https://github.com/profanity-im/profanity/issues/1085
* Update copyright to include 2019Michael Vetter2019-01-221-1/+1
|
* Merge pull request #1011 from jubalh/sha1Michael Vetter2018-09-191-17/+0
|\ | | | | Get rid of p_sha1 dependency
| * Move p_sha1_hash() to stanza.cMichael Vetter2018-09-061-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Use libstrophe sha1 functionsMichael Vetter2018-09-051-10/+9
| | | | | | | | | | | | | | 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
* | Fix extended plugin handling PRPhilip Flohr2018-09-061-10/+4
| | | | | | | | Fixes problems found in PR #999
* | use gio functions for file copyPhilip Flohr2018-09-061-20/+15
|/
* Move ID generation to xmpp folderMichael Vetter2018-08-301-22/+0
| | | | | | | | | | | 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
* Use uuid in create_unique_id instead of counterMichael Vetter2018-08-141-11/+7
| | | | | | | | | | | | 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
* Update copyrightJames Booth2018-01-211-1/+1
|
* Set locale in unit testsJames Booth2017-04-291-2/+2
| | | | issue #901
* Use g_utf8_find_ functions for prof_occurrencesJames Booth2017-04-281-4/+11
| | | | issue #901
* Update Glib dependency to 2.40James Booth2017-03-251-48/+0
|
* Allow installing plugins from directoryJames Booth2017-02-051-0/+42
|
* Update CopyrightJames Booth2017-01-281-1/+1
|
* Fix multibyte chars in prof_occurrencesJames Booth2017-01-261-8/+14
| | | | issue #901
* Move window functions to window_list.cJames Booth2016-07-241-73/+0
|
* Move resource conversionsJames Booth2016-07-241-70/+1
|