summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp1
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp6
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp81
3 files changed, 65 insertions, 23 deletions
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp
index dafb429..c355f09 100644
--- a/noncore/net/wellenreiter/gui/logwindow.cpp
+++ b/noncore/net/wellenreiter/gui/logwindow.cpp
@@ -34,2 +34,3 @@ void MLogWindow::log( QString text )
ledit->append( line );
+ qDebug( line );
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index 189a12d..398b42d 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -46,3 +46,7 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
{
- qDebug( "decorating scanlist item" );
+ qDebug( "decorating scanlist item %s / %s / %s [%d]",
+ (const char*) type,
+ (const char*) essid,
+ (const char*) macaddr,
+ channel );
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 9c8630f..6d62fa8 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -21,2 +21,3 @@
+#include <assert.h>
#include <unistd.h>
@@ -86,3 +87,3 @@ typedef struct {
- qDebug( "Sniffer sent: '%s'", (const char*) &buffer );
+ // qDebug( "Sniffer sent: '%s'", (const char*) buffer );
hexwindow->log( (const char*) &buffer );
@@ -91,3 +92,2 @@ typedef struct {
{
- logwindow->log( "(i) found new network" );
qDebug( "Sniffer said: new network found." );
@@ -102,3 +102,3 @@ typedef struct {
QString type;
-
+
if ( n.net_type == 1 )
@@ -107,3 +107,3 @@ typedef struct {
type = "adhoc";
-
+
addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 );
@@ -140,3 +140,6 @@ void Wellenreiter::timerEvent( QTimerEvent* e )
- if ( hasMessage() )
+ int result = hasMessage();
+ qDebug( "hasMessage() returned %d", result );
+
+ if ( result )
{
@@ -153,7 +156,15 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo
// FIXME: this code belongs in customized QListView, not into this class
+ // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
- // search, if we had an item with this essid once before
-
- //MScanListItem* item = dynamic_cast<MScanListItem*>( netview->firstChild() );
- MScanListItem* item = static_cast<MScanListItem*>( netview->firstChild() );
+ qDebug( "Wellenreiter::addNewItem( %s / %s / %s [%d]",
+ (const char*) type,
+ (const char*) essid,
+ (const char*) macaddr,
+ channel );
+
+ // search, if we already have seen this net
+
+ QString s;
+ MScanListItem* network;
+ MScanListItem* item = (MScanListItem*) netview->firstChild();
@@ -162,3 +173,3 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo
qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
- item = dynamic_cast<MScanListItem*>( item->itemBelow() );
+ item = item->itemBelow();
}
@@ -166,24 +177,50 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo
{
- qDebug( "found!" );
+ // we have already seen this net, check all childs if MAC exists
- // check, if it is the same item (based on MACaddr)
+ network = item;
- if ( macaddr == item->text( 2 ) )
+ item = item->firstChild();
+ assert( item ); // this shouldn't fail
+
+ while ( item && ( item->text( 2 ) != macaddr ) )
{
- qDebug( "already had item with mac %s", (const char*) item->text( 2 ) );
- return;
+ qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
+ item = item->itemBelow();
}
-
- // another item belonging to the same net, so: insert the new item as child
- new MScanListItem( item, type, essid, macaddr, wep, channel, signal );
+ if ( item )
+ {
+ // we have already seen this item, it's a dupe
+ qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
+ return;
+ }
}
-
else
{
- qDebug( "inserting new network" );
- MScanListItem* network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 );
+ s.sprintf( "(i) new network: '%s'", (const char*) essid );
+ logwindow->log( s );
+
+ network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 );
+ }
+
+
+ // insert new station as child from network
+
+ // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
+
+ qDebug( "inserting new station %s", (const char*) macaddr );
- new MScanListItem( network, type, essid, macaddr, wep, channel, signal );
+ new MScanListItem( network, type, "", macaddr, wep, channel, signal );
+
+ if ( type == "managed" )
+ {
+ s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
+ }
+ else
+ {
+ s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
}
+
+ logwindow->log( s );
+
}