aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop/adjust_usernames.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-04-09 20:26:12 +0200
committerJoas Schilling <nickvergessen@gmx.de>2015-04-09 20:26:12 +0200
commit313a224c688fa1e2575b22092384458ae23d5147 (patch)
tree2aa238d4a9ac695cde78883e54ba13107901098c /phpBB/develop/adjust_usernames.php
parent17620bba46138ec48a6748a4147986b1d21a48fd (diff)
downloadforums-313a224c688fa1e2575b22092384458ae23d5147.tar
forums-313a224c688fa1e2575b22092384458ae23d5147.tar.gz
forums-313a224c688fa1e2575b22092384458ae23d5147.tar.bz2
forums-313a224c688fa1e2575b22092384458ae23d5147.tar.xz
forums-313a224c688fa1e2575b22092384458ae23d5147.zip
Update version to 3.1.4-RC1
Diffstat (limited to 'phpBB/develop/adjust_usernames.php')
0 files changed, 0 insertions, 0 deletions
ref='#n92'>92 93 94 95 96 97 98 99 100
package network::connection::cellular;

use base qw(network::connection::ppp);

use strict;
use lib qw(/usr/lib/libDrakX);   # helps perl_checker
use common;

my $cellular_d = "/etc/sysconfig/network-scripts/cellular.d";

sub get_providers {
    # manually-defined providers
    require network::connection::providers::cellular;
    # providers imported from mobile-broadband-provider-info
    require network::connection::providers::cellular_extra;
    # combine custom providers with m.b.p.i. imported ones,
    # filtering out CDMA-only providers which we do not support for now
    my %providers = (
        %network::connection::providers::cellular::data,
        grep_each { !$::b->{cdma} } %network::connection::providers::cellular_extra::data
    );
    (\%providers, '|');
}

sub get_cellular_settings_file {
    my ($self) = @_;
    my $network = $self->get_selected_network or return;
    $::prefix . $cellular_d . '/' . $network->{name};
}

sub load_cellular_settings {
    my ($self) = @_;
    my $file = $self->get_cellular_settings_file or return;
    -f $file && { getVarsFromSh($file) };
}

sub network_is_configured {
    my ($self, $_network) = @_;
    #- only one network is supported, assume it is configured if settings are available
    defined($self->load_cellular_settings);
}

sub write_cellular_settings {
    my ($self) = @_;
    my $file = $self->get_cellular_settings_file or return;
    setVarsInShMode($file, 0600, { map { (uc($_) => $self->{access}{$_}) } qw(login password apn) });
}

sub guess_apn_from_chat {
    my ($self) = @_;
    my $chat = cat_($::prefix . $self->get_chat_file);
    $chat =~ /\bAT\+CGDCONT=\d+,"IP","([^"]+)"/ && $1;
}

sub guess_provider_settings {
    my ($self) = @_;
    my $settings = $self->load_cellular_settings;
    my $apn = $settings && $settings->{APN} || $self->guess_apn_from_chat;
    if ($apn) {
        my @providers_data = $self->get_providers;
        $self->{provider_name} ||= find { $providers_data[0]{$_}{apn} eq $apn } keys %{$providers_data[0]};
        return;
    }
    $self->SUPER::guess_provider_settings;
}

sub guess_access_settings {
    my ($self, $o_provider_only) = @_;
    my $settings = !$o_provider_only && $self->load_cellular_settings || {};