package Plagger::Plugin::Notify::XMPP;
use strict;
use base qw( Plagger::Plugin );

our $VERSION = '0.06';

sub init {
    my $self = shift;
    $self->SUPER::init(@_);

    my $class  = 'Plagger::Plugin::Notify::XMPP::' . ($self->conf->{direct} =~ /yes/i ? 'Direct' : 'IKC');
    eval "require $class;";
    if ($@) {
        Plagger->context->error("failed to load $class");
    }
    bless $self, $class;
}

sub register {
    my($self, $context) = @_;

    $context->register_hook(
        $self,
        'plugin.init'      => $self->can('initialize'),
        'publish.entry'    => $self->can('notify'),
        'publish.finalize' => $self->can('finalize'),
       );
}

1;
__END__

=head1 NAME

Plagger::Plugin::Notify::XMPP - Notify feed updates to XMPP client

=head1 SYNOPSIS

jabber.org

  - module: Notify::XMPP
    config:
      jid: foo@jabber.org
      password: plahplahplah
      to:
        - bar@jabber.org
        - baz@gmail.com
        - qux@jabber.jp

Google Talk

  - module: Notify::XMPP
    config:
      jid: foo@gmail.com
      password: plahplahplah
      server_host: talk.google.com
      tls: 1
      to:
        - bar@jabber.org
        - baz@gmail.com
        - qux@jabber.jp

If you want to connect server directly (not via plagger-xmppbot),
add "direct: yes" to config section.

=head1 DESCRIPTION

This plugin allows you to notify feed updates to XMPP clients (jabber,
Google Talk).

=head1 AUTHOR

HIROSE Masaaki (hirose31)

=head1 SEE ALSO

L<Plagger>, L<plagger-xmppbot>,
L<Plagger::Plugin::Notify::XMPP::IKC>,
L<Plagger::Plugin::Notify::XMPP::Direct>

=cut
