Bug 78836 - Connection Status plugin doesn't work
Summary: Connection Status plugin doesn't work
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Connection Status Plugin (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Chris Howells
URL:
Keywords:
: 88148 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-01 01:30 UTC by meldroc
Modified: 2004-12-07 20:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description meldroc 2004-04-01 01:30:35 UTC
Version:            (using KDE KDE 3.2.1)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc (GCC) 3.3.3 (Debian 20040321) 
OS:          Linux

For me, the Connection Status plugin doesn't.  From what I've googled, this plugin uses netstat -rn to see if a default gateway exists.

When I'm offline, netstat -rn gives me 

meldroc@localhost:~$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

Online, I get

meldroc@localhost:~$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
170.147.45.137  0.0.0.0         255.255.255.255 UH        0 0          0 ppp0
0.0.0.0         170.147.45.137  0.0.0.0         UG        0 0          0 ppp0

which theoretically should let Kopete know when I'm on or not.  Nevertheless, if I disconnect using kppp, kopete shows my status as still online, and if I start kopete while offline, then go online, kopete shows the pulsating connecting icons for each service forever (or until I manually disconnect all & connect all.)

The current method strikes me as being very brittle.  Maybe Kopete should use DCOP messaging to talk to kppp and fetch connection status.  I guess this is also a feature request for kppp - a DCOP interface that allows other apps to query it for connection status.
Comment 1 Bernhard Übelacker 2004-04-18 11:37:34 UTC
I had this problem too.

I made kopete use 'netstat -r' instead of 'netstat -rn'.
This give the desired 'default' in the netstats output.

The second issue was, that I had set my ICQ account
to 'automatically connect at startup' _and_ used the
connectionstatusplugin at the same time. This way the
status shown in kopete was always at connecting and
didn't change when I was going online.

When disabling this 'automatically connect at startup'
the connectionstatusplugin worked as expected.

System: SuSE 9.0 with KDE 3.2.0, Qt 3.3.0
Kopete: cvs 20040416

Mit freundlichen Grüßen
Bernhard Übelacker
Comment 2 Matt Rogers 2004-04-18 15:52:06 UTC
will changing it from 'netstat -rn' to just 'netstat -r' work for everyone or will it just give problems for other people. Chris, do you have any ideas?
Comment 3 meldroc 2004-04-19 10:37:02 UTC
As a workaround for this problem, I tried a different approach.  Instead of trying to get the connection status plugin to work, I started by making a couple shell scripts:

Connection script:
#!/bin/sh

sleep 10
dcop kopete KopeteIface connect AIMProtocol username
dcop kopete KopeteIface connect ICQProtocol username


Disconnection script:
#!/bin/sh

dcop kopete KopeteIface disconnect AIMProtocol username
dcop kopete KopeteIface disconnect ICQProtocol username


I then used the feature in KPPP that allows the user to run programs before & after connection & disconnection to run the connection script right after the link goes up, and the disconnection script right before the link goes down.  This scheme works quite nicely for me.

One idea would be to set up some additional DCOP functionality in Kopete for this purpose - perhaps connectAll and disconnectAll functions.  
Comment 4 Ryan Winter 2004-08-06 19:20:19 UTC
Whats happening with this bug?

I still have this problem in kopete 0.8.3 because using -n report "0.0.0.0" instead of "default".

Seems like a simple fix to me.
Comment 5 Olivier Goffart 2004-09-02 14:09:01 UTC
*** Bug 88148 has been marked as a duplicate of this bug. ***
Comment 6 Matt Rogers 2004-12-07 20:00:45 UTC
CVS commit by mattr: 

Fix bug 78836 by removing the n parameter from netstat.

CCBUG: 78836


  M +1 -1      connectionstatusplugin.cpp   1.23


--- kdenetwork/kopete/plugins/connectionstatus/connectionstatusplugin.cpp  #1.22:1.23
@@ -66,5 +66,5 @@ void ConnectionStatusPlugin::slotCheckSt
         // default gateway. If so, we're connected, if not, we're offline
         m_process = new KProcess;
-        *m_process << "netstat" << "-rn";
+        *m_process << "netstat" << "-r";
 
         connect( m_process, SIGNAL( receivedStdout( KProcess *, char *, int ) ), this, SLOT( slotProcessStdout( KProcess *, char *, int ) ) );


Comment 7 Matt Rogers 2004-12-07 20:01:51 UTC
CVS commit by mattr: 

Backport of fix for bug 78836. Should be in KDE 3.3.3 if there is one.

BUG: 78836


  M +1 -1      connectionstatusplugin.cpp   1.20.4.1


--- kdenetwork/kopete/plugins/connectionstatus/connectionstatusplugin.cpp  #1.20:1.20.4.1
@@ -66,5 +66,5 @@ void ConnectionStatusPlugin::slotCheckSt
         // default gateway. If so, we're connected, if not, we're offline
         m_process = new KProcess;
-        *m_process << "netstat" << "-rn";
+        *m_process << "netstat" << "-r";
 
         connect( m_process, SIGNAL( receivedStdout( KProcess *, char *, int ) ), this, SLOT( slotProcessStdout( KProcess *, char *, int ) ) );