-
-
Notifications
You must be signed in to change notification settings - Fork 223
Disable message notifications from active chatrooms #2021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Disable message notifications from active chatrooms #2021
Conversation
jubalh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| if ((current_win == FALSE) || ((current_win == TRUE) && prefs_get_boolean(PREF_NOTIFY_CHAT_CURRENT))) { |
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.
src/event/server_events.c
Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue with conditions as explained in another comment.
|
@Bionicgitman ping |
Co-authored-by: Kerim Kabirov <[email protected]>
|
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. |
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 .