From 63f91fb6eed3b668d29fe52c43062cd8b4a327ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Quelin?= Date: Thu, 31 Jul 2008 14:12:26 +0200 Subject: [PATCH] implemented event pl.rm() --- lib/POE/Component/Client/MPD.pm | 2 +- lib/POE/Component/Client/MPD/Playlist.pm | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/POE/Component/Client/MPD.pm b/lib/POE/Component/Client/MPD.pm index 44b2880..f5e32a6 100644 --- a/lib/POE/Component/Client/MPD.pm +++ b/lib/POE/Component/Client/MPD.pm @@ -134,7 +134,7 @@ sub _onpub_default { pl.as_items pl.items_changed_since pl.add pl.delete pl.deleteid pl.clear pl.crop pl.shuffle pl.swap pl.swapid pl.move pl.moveid - pl.load pl.save + pl.load pl.save pl.rm }; my @ok_events = ( @ok_events_commands, @ok_events_playlist ); return unless $event ~~ [ @ok_events ]; diff --git a/lib/POE/Component/Client/MPD/Playlist.pm b/lib/POE/Component/Client/MPD/Playlist.pm index 1f68f49..461d3b9 100644 --- a/lib/POE/Component/Client/MPD/Playlist.pm +++ b/lib/POE/Component/Client/MPD/Playlist.pm @@ -306,25 +306,21 @@ sub _do_save { $k->post( $h->{socket}, 'send', $msg ); } -=pod - # -# event: pl.save( $playlist ); +# event: pl.rm( $playlist ); # # Delete playlist named $playlist from MPD's playlist directory. # -sub _onpub_rm { - my $msg = $_[ARG0]; - my $playlist = $msg->_params->[0]; +sub _do_rm { + my ($self, $k, $h, $msg) = @_; + my $playlist = $msg->params->[0]; - $msg->_answer ( $DISCARD ); - $msg->_commands ( [ qq[rm "$playlist"] ] ); $msg->_cooking ( $RAW ); - $_[KERNEL]->post( $_HUB, '_send', $msg ); + $msg->_commands ( [ qq[rm "$playlist"] ] ); + $k->post( $h->{socket}, 'send', $msg ); } -=cut 1; -- 2.11.4.GIT