Bug 189401 - two AWAY commands are sent to the server with /away and /back
Summary: two AWAY commands are sent to the server with /away and /back
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks: 187307
  Show dependency treegraph
 
Reported: 2009-04-11 20:53 UTC by larvid
Modified: 2009-04-17 22:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
fixes the bug by adding checks (1.82 KB, patch)
2009-04-17 07:31 UTC, Travis McHenry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description larvid 2009-04-11 20:53:10 UTC
Version:           1.1.75+ build 3400 (using KDE 4.2.2)
Compiler:          gcc 4.3.3 
OS:                Linux
Installed from:    Compiled From Sources

When using /away and /back in order to set/unset my status on IRC as away, two AWAY commands are sent to the server instead of just one.

If I once type "/away afk", Konversation will display:

[Away] You are now marked as being away.
[Away] You are now marked as being away.

And in the raw log:

<< AWAY :afk
<< AWAY :Gone away for now


When typing "/back" in order to unset the away status, Konversation displays:

[Away] You are no longer marked as being away.
[Away] You are not marked as being away.

And the raw log:

<< AWAY
<< AWAY
Comment 1 Travis McHenry 2009-04-17 07:31:47 UTC
Created attachment 32883 [details]
fixes the bug by adding checks

Took me awhile to track this down, I made notes to help so I'll just copy those to explain what I saw/did.

on /away:
setAway emits awayState
connect(server, SIGNAL(awayState(bool)), this, SIGNAL(connectionChangedAwayState(bool)));
connect(m_connectionManager, SIGNAL(connectionChangedAwayState(bool)), m_awayManager, SLOT(updateGlobalAwayAction(bool)));
updateGlobalAwayAction runs: awayAction->setChecked(true);
connect(awayAction, SIGNAL(toggled(bool)), KonversationApplication::instance()->getAwayManager(), SLOT(toggleGlobalAway(bool)));
toggleGlobalAway runs: requestAll(un)Away();
which calls setAway again.

Explanation: When the checkbox is updated with the new state, it runs the action as if the user asked for it.

Solution: Add checks to toggleGlobalAway.
Comment 2 Eike Hein 2009-04-17 20:39:25 UTC
Fixed in SVN rev 955470 (using a simpler approach that just takes care of the underlying porting fallout - the behavior of the toggled(bool) signal for toggle actions has effectively changed between KDE 3 and 4; triggered(bool) is the right one to use here now).