diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2003-02-18 00:49:54 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2003-02-18 00:49:54 +0000 |
commit | 57d2483bb80f36992fa724c8ad20f64abeea93be (patch) | |
tree | ee591441a22eb5c1c98f4a4ad5afada2336b1a01 /perl-install/printer/main.pm | |
parent | f0bcda57c0cd9f923a90a41bdd9d25f80101af06 (diff) | |
download | drakx-57d2483bb80f36992fa724c8ad20f64abeea93be.tar drakx-57d2483bb80f36992fa724c8ad20f64abeea93be.tar.gz drakx-57d2483bb80f36992fa724c8ad20f64abeea93be.tar.bz2 drakx-57d2483bb80f36992fa724c8ad20f64abeea93be.tar.xz drakx-57d2483bb80f36992fa724c8ad20f64abeea93be.zip |
- "BrowsePoll" support in the CUPS configuration dialog.
- Fixes on error message windows in the dialog for printer sharing
destinations.
Diffstat (limited to 'perl-install/printer/main.pm')
-rw-r--r-- | perl-install/printer/main.pm | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index df75d892c..d2ca76d10 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -1062,7 +1062,7 @@ sub makesharehostlist { $sharehosthash{$host} = N("Local network(s)"); } elsif ($host =~ /\@IF\((.*)\)/i) { $sharehosthash{$host} = N("Interface \"%s\"", $1); - } elsif ($host =~ /(\/|^\*|\*$|^\.)/i) { + } elsif ($host =~ /(\/|^\*|\*$|^\.)/) { $sharehosthash{$host} = N("Network %s", $host); } else { $sharehosthash{$host} = N("Host %s", $host); @@ -1076,6 +1076,34 @@ sub makesharehostlist { invhash => \%sharehosthash_inv }; } +sub makebrowsepolllist { + + # Human-readable strings for hosts from which the print queues are + # polled + + my ($printer) = @_; + + my @browsepolllist; + my %browsepollhash; + for my $host (@{$printer->{cupsconfig}{BrowsePoll}}) { + my ($ip, $port); + if ($host =~ /^([^:]+):([^:]+)$/) { + $ip = $1; + $port = $2; + } else { + $ip = $host; + $port = '631'; + } + $browsepollhash{$host} = N("%s (Port %s)", $ip, $port); + push(@browsepolllist, $browsepollhash{$host}); + } + my %browsepollhash_inv = reverse %browsepollhash; + + return { list => \@browsepolllist, + hash => \%browsepollhash, + invhash => \%browsepollhash_inv }; +} + sub is_network_ip { # Determine whwther the given string is a valid network IP @@ -1129,6 +1157,11 @@ sub read_cups_config { handle_configs::read_unique_directive($printer->{cupsconfig}{cupsd_conf}, 'BrowseOrder', 'deny,allow'); + # Keyword "BrowsePoll" + @{$printer->{cupsconfig}{BrowsePoll}} = + handle_configs::read_directives($printer->{cupsconfig}{cupsd_conf}, + 'BrowsePoll'); + # Root location @{$printer->{cupsconfig}{rootlocation}} = read_location($printer->{cupsconfig}{cupsd_conf}, '/'); @@ -1256,6 +1289,17 @@ sub write_cups_config { } } + # Set "BrowsePoll" lines + if ($#{$printer->{cupsconfig}{BrowsePoll}} >= 0) { + handle_configs::set_directive($printer->{cupsconfig}{cupsd_conf}, + 'BrowsePoll ' . + join ("\nBrowsePoll ", + @{$printer->{cupsconfig}{BrowsePoll}})); + } else { + handle_configs::comment_directive($printer->{cupsconfig}{cupsd_conf}, + 'BrowsePoll'); + } + } sub clean_cups_config { |