IRC.pm 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package Cpanel::iContact::Provider::IRC;
  2. use strict;
  3. use warnings;
  4. use parent 'Cpanel::iContact::Provider';
  5. sub send {
  6. my ($self) = @_;
  7. my $args_hr = $self->{'args'};
  8. my @errs;
  9. my $subject_copy = $args_hr->{'subject'};
  10. my $body_copy = ${ $args_hr->{'text_body'} };
  11. require Encode;
  12. my $subject = Encode::decode_utf8( $subject_copy, $Encode::FB_QUIET );
  13. my $body = Encode::decode_utf8( $body_copy, $Encode::FB_QUIET );
  14. foreach my $destination ( @{ $args_hr->{'to'} } ) {
  15. local $@;
  16. eval {
  17. my $response;
  18. $self->_send(
  19. 'destination' => $destination,
  20. 'subject' => $subject,
  21. 'content' => $body
  22. );
  23. };
  24. push( @errs, $@ ) if $@;
  25. }
  26. if (@errs) {
  27. die "One or more notification attempts failed. Details below:\n"
  28. . join( "\n", @errs );
  29. }
  30. return 1;
  31. }
  32. sub _send {
  33. my ( $self, %args ) = @_;
  34. # TODO research what is installed on cP boxes to see what I can use here
  35. return;
  36. }
  37. 1;