mirror of
https://github.com/brmlab/brmdoor.git
synced 2025-06-11 05:03:59 +02:00
brmd::WWW notify_update(): Merge in notify_manual_update()
This commit is contained in:
parent
59cc7c1489
commit
fba2427e44
1 changed files with 7 additions and 14 deletions
21
brmd/brmd.pl
21
brmd/brmd.pl
|
@ -61,10 +61,9 @@ sub status_update {
|
||||||
|
|
||||||
if ($manual) {
|
if ($manual) {
|
||||||
$poe_kernel->post($door, 'status_override', $status);
|
$poe_kernel->post($door, 'status_override', $status);
|
||||||
$poe_kernel->post($irc, 'notify_manual_update', 'brmstatus', $nick );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$poe_kernel->post( $irc, 'notify_update', 'brmstatus', $st );
|
$poe_kernel->post( $irc, 'notify_update', 'brmstatus', $st, undef, $manual, $nick );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub record_update {
|
sub record_update {
|
||||||
|
@ -387,7 +386,7 @@ sub web_brmstatus_switch {
|
||||||
|
|
||||||
my $newstatus = not $status;
|
my $newstatus = not $status;
|
||||||
foreach (@{$self->{observers}}) {
|
foreach (@{$self->{observers}}) {
|
||||||
$poe_kernel->post($_, 'status_update', $newstatus, 'manual', $nick);
|
$poe_kernel->post($_, 'status_update', $newstatus, 'web', $nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
$response->protocol("HTTP/1.1");
|
$response->protocol("HTTP/1.1");
|
||||||
|
@ -419,7 +418,7 @@ sub new {
|
||||||
object_states => [
|
object_states => [
|
||||||
$self => [ qw(_start _default
|
$self => [ qw(_start _default
|
||||||
irc_001 irc_public irc_332 irc_topic
|
irc_001 irc_public irc_332 irc_topic
|
||||||
notify_update notify_manual_update
|
notify_update
|
||||||
notify_door_unauth notify_door_unlocked) ],
|
notify_door_unauth notify_door_unlocked) ],
|
||||||
],
|
],
|
||||||
heap => { irc => $irc, connector => $connector },
|
heap => { irc => $irc, connector => $connector },
|
||||||
|
@ -511,21 +510,15 @@ sub topic_update {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub notify_update {
|
sub notify_update {
|
||||||
my ($sender, $comp, $status, $extra) = @_[SENDER, ARG0 .. ARG2];
|
my ($sender, $comp, $status, $extra, $manual, $nick) = @_[SENDER, ARG0 .. ARG4];
|
||||||
my $irc = $_[HEAP]->{irc};
|
my $irc = $_[HEAP]->{irc};
|
||||||
my $msg = "[$comp] update: \002$status";
|
my $msg = "[$comp] update: \002$status\002";
|
||||||
$extra and $msg .= "\002 $extra";
|
$extra and $msg .= " $extra";
|
||||||
|
$manual and $msg .= " ($manual manual override by $nick)";
|
||||||
$irc->yield (privmsg => $channel => $msg );
|
$irc->yield (privmsg => $channel => $msg );
|
||||||
topic_update($irc);
|
topic_update($irc);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub notify_manual_update {
|
|
||||||
my ($sender, $comp, $nick) = @_[SENDER, ARG0];
|
|
||||||
my $irc = $_[HEAP]->{irc};
|
|
||||||
my $msg = "[$comp] Manual override by $nick (web)";
|
|
||||||
$irc->yield (privmsg => $channel => $msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
sub notify_door_unauth {
|
sub notify_door_unauth {
|
||||||
my ($sender) = $_[SENDER];
|
my ($sender) = $_[SENDER];
|
||||||
my $irc = $_[HEAP]->{irc};
|
my $irc = $_[HEAP]->{irc};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue