summaryrefslogtreecommitdiffstats
path: root/extensions/Push/lib/Connector/Base.pm
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Push/lib/Connector/Base.pm')
-rw-r--r--extensions/Push/lib/Connector/Base.pm99
1 files changed, 53 insertions, 46 deletions
diff --git a/extensions/Push/lib/Connector/Base.pm b/extensions/Push/lib/Connector/Base.pm
index ee41bd160..bd46fe6b4 100644
--- a/extensions/Push/lib/Connector/Base.pm
+++ b/extensions/Push/lib/Connector/Base.pm
@@ -18,59 +18,65 @@ use Bugzilla::Extension::Push::BacklogQueue;
use Bugzilla::Extension::Push::Backoff;
sub new {
- my ($class) = @_;
- my $self = {};
- bless($self, $class);
- ($self->{name}) = $class =~ /^.+:(.+)$/;
- $self->init();
- return $self;
+ my ($class) = @_;
+ my $self = {};
+ bless($self, $class);
+ ($self->{name}) = $class =~ /^.+:(.+)$/;
+ $self->init();
+ return $self;
}
sub name {
- my $self = shift;
- return $self->{name};
+ my $self = shift;
+ return $self->{name};
}
sub init {
- my ($self) = @_;
- # abstract
- # perform any initialisation here
- # will be run when created by the web pages or by the daemon
- # and also when the configuration needs to be reloaded
+ my ($self) = @_;
+
+ # abstract
+ # perform any initialisation here
+ # will be run when created by the web pages or by the daemon
+ # and also when the configuration needs to be reloaded
}
sub stop {
- my ($self) = @_;
- # abstract
- # run from the daemon only; disconnect from remote hosts, etc
+ my ($self) = @_;
+
+ # abstract
+ # run from the daemon only; disconnect from remote hosts, etc
}
sub should_send {
- my ($self, $message) = @_;
- # abstract
- # return boolean indicating if the connector will be sending the message.
- # this will be called each message, and should be a very quick simple test.
- # the connector can perform a more exhaustive test in the send() method.
- return 0;
+ my ($self, $message) = @_;
+
+ # abstract
+ # return boolean indicating if the connector will be sending the message.
+ # this will be called each message, and should be a very quick simple test.
+ # the connector can perform a more exhaustive test in the send() method.
+ return 0;
}
sub send {
- my ($self, $message) = @_;
- # abstract
- # deliver the message, daemon only
+ my ($self, $message) = @_;
+
+ # abstract
+ # deliver the message, daemon only
}
sub options {
- my ($self) = @_;
- # abstract
- # return an array of configuration variables
- return ();
+ my ($self) = @_;
+
+ # abstract
+ # return an array of configuration variables
+ return ();
}
sub options_validate {
- my ($class, $config) = @_;
- # abstract, static
- # die if a combination of options in $config is invalid
+ my ($class, $config) = @_;
+
+ # abstract, static
+ # die if a combination of options in $config is invalid
}
#
@@ -78,29 +84,30 @@ sub options_validate {
#
sub config {
- my ($self) = @_;
- if (!$self->{config}) {
- $self->load_config();
- }
- return $self->{config};
+ my ($self) = @_;
+ if (!$self->{config}) {
+ $self->load_config();
+ }
+ return $self->{config};
}
sub load_config {
- my ($self) = @_;
- my $config = Bugzilla::Extension::Push::Config->new($self->name, $self->options);
- $config->load();
- $self->{config} = $config;
+ my ($self) = @_;
+ my $config
+ = Bugzilla::Extension::Push::Config->new($self->name, $self->options);
+ $config->load();
+ $self->{config} = $config;
}
sub enabled {
- my ($self) = @_;
- return $self->config->{enabled} eq 'Enabled';
+ my ($self) = @_;
+ return $self->config->{enabled} eq 'Enabled';
}
sub backlog {
- my ($self) = @_;
- $self->{backlog} ||= Bugzilla::Extension::Push::BacklogQueue->new($self->name);
- return $self->{backlog};
+ my ($self) = @_;
+ $self->{backlog} ||= Bugzilla::Extension::Push::BacklogQueue->new($self->name);
+ return $self->{backlog};
}
1;