Bug 310946

Summary: No notification sound when a new message comes in in an active chat window
Product: [Frameworks and Libraries] telepathy Reporter: roman <fraese.roman>
Component: generalAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, mklapetek
Priority: NOR    
Version: 0.5.1   
Target Milestone: Future   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 0.5.2

Description roman 2012-11-30 20:18:03 UTC
I would like to get a notification sound even while the chat window is active because I'm not always watching my screen. 

In the setupdialog the sounds are working when I click the play button. All other notifications are working properly.

Reproducible: Always

Steps to Reproduce:
1. Set up a notification sound for incoming messages in active windows
2. activate the chat window an wait for an incoming message
3. nothing is going to happen
Actual Results:  
no notification sound was played

Expected Results:  
getting a notification sound :)
Comment 1 Martin Klapetek 2012-11-30 22:24:55 UTC
Thanks for the report!

That behavior is actually correct as it notifies only when the window does not have focus, otherwise you'd get the notification sound with absolutely every single message and I can imagine that being annoying after a while. Even facebook plays no sound when the chat is focused (though they do play a sound when the pause in the chat is longer than N).

In fact, you can probably try it on yourself with very simple patch (if you are using self-compiled install, otherwise it won't work):

Open ktp-text-ui/lib/chat-widget.cpp and change line 676, in the codeblock looking like this:

    if(isOnTop()) {
        kDebug() << "Widget is on top, not doing anything";
        return;
    }

and change it into

    if(isOnTop()) {
        kDebug() << "Widget is on top, not doing anything";
        //return;
    }


Recompile and install. And then try using it for a while. I'm pretty sure it will get annoying :)
Comment 2 David Edmundson 2012-11-30 22:29:14 UTC
Martin, that's not quite true. 

We have a separate notification for if it's the active chat (which by default does nothing). There's a FIXME in the code (just above the part you posted). I think that's the one the reporter is talking about.

It's not connected up in the code, there's a FIXME above the part you pasted. I see no reason why that's the case.
Will fix.
Comment 3 Martin Klapetek 2012-11-30 22:38:16 UTC
Hah, indeed there is! I just did a grep through the code. Let's fix it then!
Comment 4 David Edmundson 2012-11-30 22:54:57 UTC
Git commit 2aa32aa5db66c3a06d16001ce092c7906e68f844 by David Edmundson.
Committed on 30/11/2012 at 23:54.
Pushed by davidedmundson into branch 'kde-telepathy-0.5'.

Correctly emit notifications for messages recieved in an active chat
Fixed-In: 0.5.2

M  +6    -8    lib/chat-widget.cpp

http://commits.kde.org/telepathy-text-ui/2aa32aa5db66c3a06d16001ce092c7906e68f844
Comment 5 David Edmundson 2012-11-30 22:55:33 UTC
Git commit 3b5f8196497f09bc333338e1713fe32ba2d47ac1 by David Edmundson.
Committed on 30/11/2012 at 23:54.
Pushed by davidedmundson into branch 'master'.

Correctly emit notifications for messages recieved in an active chat
Fixed-In: 0.5.2

M  +6    -8    lib/chat-widget.cpp

http://commits.kde.org/telepathy-text-ui/3b5f8196497f09bc333338e1713fe32ba2d47ac1