X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FApp%2FClifton%2FChain.pm;h=36416131bbdffb7b17de91362991bfef79a65c4f;hb=327a4b1a20939c6f165dc432ace73d24624047a4;hp=400ee9ba698496c6779a9fd965d476592b76b10a;hpb=06185cf5ccc6d8e40da2853a8783643ed278cd8f;p=scpubgit%2FClifton.git diff --git a/lib/App/Clifton/Chain.pm b/lib/App/Clifton/Chain.pm index 400ee9b..3641613 100644 --- a/lib/App/Clifton/Chain.pm +++ b/lib/App/Clifton/Chain.pm @@ -2,7 +2,28 @@ package App::Clifton::Chain; use Moo; +extends 'App::Clifton::Component'; + has jabber_user => (is => 'ro', required => 1); has irc_channel => (is => 'ro', required => 1); +has jabber_tower => (is => 'ro', required => 1); +has irc_tower => (is => 'ro', required => 1, weak_ref => 1); + +sub handle_xmpp_message { + my ($self, $msg) = @_; + $self->irc_tower->send_irc_message({ + to => $self->irc_channel, + text => $msg->body + }); +} + +sub handle_irc_message { + my ($self, $message, $hints) = @_; + $self->jabber_tower->send_xmpp_message({ + to => $self->jabber_user, + body => join(': ', $hints->{prefix_name}, $hints->{text}) + }); +} + 1;