Fork 0
Commit Graph

123 Commits

Author SHA1 Message Date
Michael Vetter 569e37f018 Update copyright to 2024 2024-01-22 16:03:48 +01:00
Steffen Jaeckel 5657aac33d Fix some more `char*` -> `gchar*`.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-08-31 23:14:02 +02:00
Michael Vetter e853c121d9 Fix my email address
in all files
2023-07-31 16:51:58 +02:00
John Hernandez 8304ac86ff `g_free()` to `auto_gfree`, introduce `auto_guchar`
Fix 11 potential mem leaks in theme.c
2023-07-13 17:04:59 +02:00
John Hernandez e1d137f4e6 Change char->free to auto_char char for autocleanup
Replace `gchar` and `g_free` to `auto_gchar`
Correct certain  `char` functions/variables to `gchar`

Related to #1819.

Edited by @jubalh.
2023-07-11 13:26:37 +02:00
Daniel Santos c7f05c9ebf Fix typos and update codespell configuration
* Fix typos.
 * Add words that are not typos to codespell's ignore words list and
 ignore regex.
 * Make codespell ignore URIs.
 * Make `make doublecheck` throw no error.

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2023-04-03 13:25:25 +01:00
Steffen Jaeckel e9aaba938b minor changes
* fix typo
* less code duplication
* less `GString` usage
* more `auto_gchar` usage
* document connecting to servers supporting SASL ANONYMOUS
* ignore valgrind output

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-01-18 20:02:46 +01:00
Michael Vetter 3adc399da0 Update copyright year 2023-01-10 10:37:25 +01:00
Steffen Jaeckel 25e56fb494 less strdup()+free()
Improvement of f8ff93234e

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-09-07 12:42:15 +02:00
Michael Vetter 9312333ba2 log: put static functions on top 2022-06-28 20:13:55 +02:00
Michael Vetter 585f68f4f7 Split log.c into log.c and chatlog.c 2022-06-28 20:08:38 +02:00
Michael Vetter b302c604ab Display log level information in preferences 2022-06-22 13:05:11 +02:00
Michael Vetter ff8065eaca Rename _log_string_from_level to _log_abbreviation_string_from_level 2022-06-22 13:05:11 +02:00
Michael Vetter 1330ad4e1e Update copyright year 2022-05-09 15:43:33 +02:00
Michael Vetter 82a2b17c1f Use profanity.001.log instead of profanity.log.001 for rotated logs
Rotated log files will now be: `.local/share/profanity/logs/profanity.001.log`
We only use logrotation if we use the default log file ending with .log.
So Replacing the `.` should be fine.

User supplied log files are not rotated.
2022-04-29 19:19:01 +02:00
Michael Vetter 188afc58da Use 3 digits for rotated logfiles
profanity.log.001 -> 999.
2022-04-29 15:40:56 +02:00
Michael Vetter 4220a1832d Use ISO8601 for log files 2022-04-29 13:05:02 +02:00
Michael Vetter 534ed34d73 Use ISO8601 for chatlogs
For both 1:1 and groupchat.
2022-04-29 13:04:16 +02:00
Steffen Jaeckel 7da2e6d9f3 Fix logging (this time for real)
... I hope ...

We also need to create the path where the logs are stored.

Fixup of d82f2f293b

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-04-01 14:56:08 +02:00
Steffen Jaeckel d82f2f293b fix path where logs are stored
43e5f15e66 broke the creation of the path
where chatlogs are stored. This is fixed now.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-04-01 14:17:44 +02:00
Steffen Jaeckel 43e5f15e66 refactor logfile-name creation
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-03-14 13:17:46 +01:00
Michael Vetter f21595597f Format code correctly 2021-10-05 10:01:27 +02:00
Michael Vetter 5022aeb337 Fix log rotation
Fix https://github.com/profanity-im/profanity/issues/1518
2021-07-05 11:52:06 +02:00
Michael Vetter 482f8955d7 Fix log rotation
See https://github.com/profanity-im/profanity/issues/1518
It has a good explanation of what happened:

Apparently, the _rotate_log_file function tried to extract user-provided
name from currently used mainlogfile and restart logging to the same
place after rotation, but currently this is interpreted as a full path
instead. As I understand, the log rotation is no longer done with
user-provided paths at all so this should be simply skipped altogether
now as passing any non-NULL value is interpreted as user-provided.
Replacing start with NULL appears to fix it for me.

In log_msg() we only rotate the log if not user_provided_log.

https://github.com/profanity-im/profanity/pull/1455 changed the
behaviour from user defined filename in the log dir to using full path.
2021-06-28 17:41:48 +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 0277ffe6ae Only rotate logs if user didn't specify a log file 2020-12-11 11:33:34 +01:00
Michael Vetter 57666bcb77 Remove log_reinit()
Not needed anymore.
2020-12-11 11:18:24 +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 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
Stefan Kropp b8207207f4
Rework logging
Changed default logging from INFO to WARN.

Issue: #1353
2020-07-03 18:47:16 +02:00
Michael Vetter 9c433e3033 log.c: Format code 2020-07-02 15:06:17 +02:00
Michael Vetter f8ff93234e log.c: Use gchar* instead of GString for mainlogfile 2020-07-02 15:00:09 +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
Michael Vetter 74e061165a Define POSIX macro to have strdup
sets C99 as standard.

strdup() is not part of C99.

For now set `-D_POSIX_C_SOURCE=200809L` macro to have strdup() in C99.
Using `gnu99` instead would be another option.

We should take more care to use glib functions whenever possible.

Regards https://github.com/profanity-im/profanity/issues/1357
2020-06-12 16:12:21 +02:00
Michael Vetter de8975c008 Add and use connection_get_barejid()
Instead of connection_get_fulljid() and then creating a Jid from it.
2020-05-25 13:04:19 +02:00
Michael Vetter 25dbebab17 log: don't log dt
Use another name.
2020-04-20 15:48:01 +02:00
Michael Vetter 5a42883c27 log: Dont shadow logp
Let's use another name.
2020-04-20 15:46:27 +02:00
Michael Vetter 180ec2b474 Add to_jid field to ProfMessage struct
Is usefult in many cases if we want cleaner code.
Hope this edit didn't break anything though ;-)
2020-04-11 17:11:53 +02:00
Michael Vetter 3524a53c7c Add type field to ProfMessage
The mucuser boolean is not now needed anymore.
2020-04-06 19:15:02 +02:00
Michael Vetter 0942d98c61 Remove chat_log_get_previous()
We now dont get the log files from the text files via chat_log_get_previous() anymore.
We use the sql backend via log_database_get_previous_chat().

So far it just has the same behaviour like chat_log_get_previous(),
except that in _chatwin_history() we don't pass the sender to
win_print_history() which should be fixed in a commit soon.

And log_database_get_previous_chat() can later easily be expanded to fix
2020-04-06 14:42:52 +02:00
Michael Vetter a4b53550ca Rename PROF_MSG_ENC_PLAIN to PROF_MSG_ENC_NONE 2020-04-06 10:50:20 +02:00
Michael Vetter c08d0e9ce8 Fix errors in log.c 2020-02-22 09:27:04 +01:00
Michael Vetter 55f49f1259 get_log_file_location () should return const char*
Make clear that result should never be freed.
2020-02-21 21:19:54 +01:00
Michael Vetter 75cfe38808 Allow setting custom log file via -f FILENAME
`profanity -f TEST` will use `~/.local/share/profanity/logs/TEST.log` as
the log file.
2020-02-21 21:10:00 +01:00
Michael Vetter 46fd7150e5 Add vim modeline 2019-11-13 12:11:05 +01:00
Michael Vetter 8c8c18c6fd Actually log MUC PM messages
If I'm not mistaken MUC PMs have not been logged at all if there was no
other client sending carbons.
This should add MUC PM logging functionality.

We still need to make sure carbons log to the same file.

Regards https://github.com/profanity-im/profanity/issues/1214
2019-10-28 23:36:42 +01:00
Michael Vetter 40d9dcae87 Properly display chatwin history
So far if one had enabled `/history` and did `/msg somenick` the history
was loaded from file and displayed like this:

04-04-17 15:23 - 3/4/2017:
01-01-00 10:30 - me: ....
01-01-00 10:31 - somebody: ....
01-01-00 10:32 - somebody: ....

So the first line contained the actual date. But the date used in each
line was always 01-01-2000. This date was for some reason hardcoded.

This commit now actually uses that date to build the proper GDateTime
instead of just printing it.

Fix https://github.com/profanity-im/profanity/issues/922
2019-10-21 15:26:40 +02:00
Michael Vetter b3ed213668 Improve MUC 1:1 logging
If we get a private message from a user in a MUC profanity shows this
`profanity@roomsASDF.dismail.de/Martin: Hi`

This was so far logged at:
`~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de/2019_09_04.log` as:

10:48:13 - profanity@rooms.dismail.de: Hi

So the nickname was not saved anywhere. This is due to us not knowing
whether we got a regular message from user@server.org/resource or a MUC
PM from room@server.org/user.

We now check for `<x xmlns='http://jabber.org/protocol/muc#user' />` and
add the resourcepart to the logging if we get it.

The file will be created at
`~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de_nick` and look like:

23:59:43 - nick: Hi

Fix https://github.com/profanity-im/profanity/issues/1184
2019-10-07 00:05:37 +02:00