Skip to content

Commit 6f1f43e

Browse files
Bionicgitmansjaeckel
authored andcommitted
Allow notifications of selected window whenever the client is inactive
1 parent 4d24aa1 commit 6f1f43e

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/event/server_events.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,6 @@ sv_ev_room_message(ProfMessage* message)
389389
if (triggers) {
390390
mucwin->unread_triggers = TRUE;
391391
}
392-
393-
if (prefs_do_room_notify(is_current, mucwin->roomjid, mynick, message->from_jid->resourcepart, message->plain, mention, triggers != NULL)) {
394-
auto_jid Jid* jidp = jid_create(mucwin->roomjid);
395-
if (jidp) {
396-
notify_room_message(message->from_jid->resourcepart, jidp->localpart, num, message->plain);
397-
}
398-
}
399392
}
400393

401394
// save timestamp of last received muc message
@@ -404,6 +397,12 @@ sv_ev_room_message(ProfMessage* message)
404397
}
405398
mucwin->last_msg_timestamp = g_date_time_new_now_local();
406399

400+
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) {
401+
auto_jid Jid* jidp = jid_create(mucwin->roomjid);
402+
if (jidp) {
403+
notify_room_message(message->from_jid->resourcepart, jidp->localpart, num, message->plain);
404+
}
405+
}
407406

408407
if (triggers) {
409408
g_list_free_full(triggers, free);

src/ui/chatwin.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,6 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
382382
if (show_message) {
383383
win_print_incoming(window, display_name, message);
384384
}
385-
386-
if (notify) {
387-
notify_message(display_name, num, message->plain);
388-
}
389385
}
390386

391387
if (!message->is_mam) {
@@ -397,6 +393,9 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
397393
}
398394
}
399395

396+
if ((notify && !wins_is_current(window)) || ui_get_idle_time() > 1000) {
397+
notify_message(display_name, num, message->plain);
398+
}
400399
plugins_post_chat_message_display(message->from_jid->barejid, message->from_jid->resourcepart, message->plain);
401400

402401
message->plain = old_plain;

0 commit comments

Comments
 (0)