From 1cf81e53b86da8990f32c694f94a2509fe8f0082 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 16 Aug 2004 12:31:23 +0000 Subject: merge with waproamd version --- perl-install/standalone/drakroam | 49 +++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'perl-install/standalone/drakroam') diff --git a/perl-install/standalone/drakroam b/perl-install/standalone/drakroam index c3f53b815..20e717cf1 100755 --- a/perl-install/standalone/drakroam +++ b/perl-install/standalone/drakroam @@ -54,10 +54,10 @@ my $device; my %available_roaming_daemons = ( wlandetect => { - config_file => '/etc/wlandetect.conf', + config_location => '/etc/wlandetect.conf', binary => '/usr/sbin/wlandetect', start_options => sub { - my ($interval) = @_; + my ($interval, $device) = @_; "-d -t $interval"; }, read_config => sub { @@ -96,6 +96,33 @@ my %available_roaming_daemons = ( } output($config, @contents); }, + add_net => sub {}, + remove_net => sub {}, + }, + waproamd => { + config_location => '/etc/waproamd/scripts', + binary => '/usr/sbin/waproamd', + start_options => sub { + my ($interval, $device) = @_; + "-i $device -t $interval"; + }, + read_config => sub { + my ($config) = @_; + foreach my $net (all($config)) { + $net eq "default" or next; + print "Adding net $net\n"; + push @{$KnownList->{data}}, [$net]; + } + }, + write_config => sub {}, + add_net => sub { + my ($config, $essid) = @_; + output("$config/$essid", qq(# essid specific config file)); + }, + remove_net => sub { + my ($config, $essid) = @_; + system("rm -f $config/$essid"); + }, }, ); @@ -172,7 +199,7 @@ gtkadd(gtkset_border_width($w->{window}, 2), 0, gtkpack(create_hbox(), gtksignal_connect(Gtk2::Button->new("Remove"), clicked => sub { my ($selected) = $KnownList->get_selected_indices; - splice @{$KnownList->{data}}, $selected, 1; + &RemoveNet($selected); }), gtksignal_connect(Gtk2::Button->new("Connect"), clicked => sub { my ($selected) = $KnownList->get_selected_indices; @@ -237,7 +264,7 @@ sub UpdateStatus() { my $CurrentWEP = ""; my $CurrentSignal = "-"; print("Updating\n"); - foreach (run_program::get_stdout($IWConfig)) { + foreach (run_program::get_stdout($IWConfig, $device)) { /ESSID:"(\S*)"/ and $CurrentNet = $1; /Mode:(\S*)\s/ and $CurrentMode = $1; /key:(\S*)\s/ and $CurrentWEP = $1; @@ -280,14 +307,23 @@ sub AddNet { my ($essid, $mode, $channel, $key, $dhcp) = @_; print "Adding net $essid\n"; push @{$KnownList->{data}}, [ $essid, $mode, $channel, $key, $dhcp ]; + $_->{add_net}($_->{config_location}, $essid) foreach values %available_roaming_daemons; +} + +sub RemoveNet { + my ($selected) = @_; + my $essid = $KnownList->{data}[$selected][0]; + print "Removing net $essid\n"; + splice @{$KnownList->{data}}, $selected, 1; + $_->{remove_net}($_->{config_location}, $essid) foreach values %available_roaming_daemons; } sub ReadConfig() { - $_->{read_config}($_->{config_file}) foreach values %available_roaming_daemons; + $_->{read_config}($_->{config_location}) foreach values %available_roaming_daemons; } sub WriteConfig() { - $_->{write_config}($_->{config_file}) foreach values %available_roaming_daemons; + $_->{write_config}($_->{config_location}) foreach values %available_roaming_daemons; } sub StartRoam() { @@ -338,6 +374,7 @@ sub ConnectNow { } sub Disconnect { + print("Dropping $device\n"); system("$IFDown $device"); &UpdateStatus; } -- cgit v1.2.1