Disable message notifications from active chatrooms#2021
Disable message notifications from active chatrooms#2021Bionicgitman wants to merge 34 commits intoprofanity-im:masterfrom
Conversation
|
Thanks for this PR! |
|
I have yet to include the AFK portion, I will submit it soon |
3e1e63c to
6f1f43e
Compare
sjaeckel
left a comment
There was a problem hiding this comment.
I just had a look at the existing implementation and found that we already have PREF_NOTIFY_ROOM_CURRENT resp. PREF_NOTIFY_CHAT_CURRENT. Did you try enabling those before making these changes?
The main difference is then the check for the idle time, which should happen inside prefs_do_room_notify() resp. prefs_do_chat_notify() and the time should maybe be configurable? (CC @jubalh) The ChatState is only for 1on1 chats, so we can't use that.
Makes sense :) |
There was a problem hiding this comment.
Thanks for the PR. In general, as it was mentioned earlier, disabling notification for the current chat room is already enabled in a form of a preference, condition for which is being checked inside of the prefs_do_chat_notify, called to calculate notify variable.
profanity/src/config/preferences.c
Line 334 in 5385cc2
I suggest to instead make changes in the prefs_do_chat_notify and prefs_do_room_notify, using configurable preference for idling, as it was suggested earlier by @sjaeckel.
| mucwin->last_msg_timestamp = g_date_time_new_now_local(); | ||
|
|
||
| if (prefs_do_room_notify(is_current, mucwin->roomjid, mynick, message->from_jid->resourcepart, message->plain, mention, triggers != NULL)) { | ||
| if ((prefs_do_room_notify(is_current, mucwin->roomjid, mynick, message->from_jid->resourcepart, message->plain, mention, triggers != NULL) && !wins_is_current(window)) || ui_get_idle_time() > 1000) { |
There was a problem hiding this comment.
Same issue with conditions as explained in another comment.
|
@Bionicgitman ping |
Co-authored-by: Kerim Kabirov <the.privat33r+gh@pm.me>
|
Unfortunately, it still duplicates functionality of |
|
Started working on adding idle time as an option. Tell me if there are any problems with it or if it isn't complete. |
|
Well, what's strange for sure is that there are a couple of merge commits. Maybe get rid of them so the tree is clean. And in the future just rebase. |
|
Is it possible to clean up the commit history? |
Several users have reported segfaults when starting up profanity which has OMEMO support, but OMEMO is not set up yet. @StefanKropp has been able to reproduce this and tracked it down to `_load_identity()` calling `omemo_known_devices_keyfile_save()`. The latter then calls `save_keyfile()` which calls `g_key_file_save_to_file()`. This can then fail if one of the first two strings is NULL and won't set the `error` on return. In its error handling `save_keyfile()` unconditionally dereferences `error` which leads to the segfault. Fix this and also go through the entire codebase and verify that the usage of `GError` is done correctly. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
So one can easily see if there are two instances running, if they are logging to the same file. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
When setting up OMEMO for the first time via `/omemo gen` one had to reconnect in order to make OMEMO work. This is fixed now. Fixes: 5b6b513 ("Fix OMEMO keyfile loading") Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
With that command one can see the modifications of the runtime configuration vs. the saved configuration. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
First let's make clear we're currently using SHA1 & untangle the tlscerts API from fingerprint specific details. Related-to: #2068 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This also reads the certificate SHA256 and pubkey fingerprint from libstrophe, but doesn't store it persistently yet. Related-to: #2068 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
If a cert has a SHA256 use that one and only use SHA1 as fallback. Closes: #2068 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
... as much as possible ... subject and issuer details excluded. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* add can simply do a `memcpy()`. * in remove we don't have to put the array in a list in order to put it back into an array again. Also we don't have to `strdup()` each entry, which leads to even less allocations. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* use `gchar` instead of `char`. * improve situations when strings must be duplicated or can pass ownership. * encapsulate the X.509 name details into a struct. * prevent memory leaks if a name detail is contained multiple times. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* Add new TLS policy `direct` as a replacement for `legacy`. * Document that `/[command]?` prints the help of a command. * Add option to get help via `/command help`. * Fix `my-prof.supp` generation and tests for out-of-source builds. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* Less `GString`. * Don't `g_free()` a `strdup()`'ed string. * Don't lookup the `console` window X times, but only once. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
If one is running multiple instances of profanity, the behavior of the accounts module was to constantly overwrite the accounts file with the version that was on-disk of the first instance of profanity started. This is changed now in order to only write what we modified, we keep a copy of the accounts file and when "saving" we re-read accounts from disk and only update the values of the modified account. This is not 100% fool proof if one modifies the same account from two different instances, but still better than before. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* No need to call `g_key_file_has_key()` before calling a getter. * Add helper to convert `gcharv` to `glist`. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
No need to have a fixed list of keys, we can simply copy all existing ones. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
e.g. if one connects with an account for the first time and the server returns a `see-other-host` error. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Related-to: #2078 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Add /opt/homebrew/{include,lib} flags for apple silicon macs, which are not included as default search paths by Clang/GCC. (Homebrew uses /usr/local/{include,lib} on intel macs)
On macOS running ./configure --enable-omemo was failing to find gcrypt despite being installed.
653ccfd to
4fd2c4c
Compare
|
The commit history is even more of a mess now :) |
Closing this for this reason and due to polluted history. |
Currently Profanity sends notifications even if you are focused on the same chat window as the recipient message.
It should account for whenever profanity is the focused window or not.
See #1987 .