|
Revision 618, 1.6 kB
(checked in by hirose31, 12 months ago)
|
|
import Notify::XMPP::IKC (include bin/plagger-xmppbot) and Notify::XMPP::Direct
|
| Line | |
|---|
| 1 | package Plagger::Plugin::Notify::XMPP; |
|---|
| 2 | use strict; |
|---|
| 3 | use base qw( Plagger::Plugin ); |
|---|
| 4 | |
|---|
| 5 | our $VERSION = '0.06'; |
|---|
| 6 | |
|---|
| 7 | sub init { |
|---|
| 8 | my $self = shift; |
|---|
| 9 | $self->SUPER::init(@_); |
|---|
| 10 | |
|---|
| 11 | my $class = 'Plagger::Plugin::Notify::XMPP::' . ($self->conf->{direct} =~ /yes/i ? 'Direct' : 'IKC'); |
|---|
| 12 | eval "require $class;"; |
|---|
| 13 | if ($@) { |
|---|
| 14 | Plagger->context->error("failed to load $class"); |
|---|
| 15 | } |
|---|
| 16 | bless $self, $class; |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | sub register { |
|---|
| 20 | my($self, $context) = @_; |
|---|
| 21 | |
|---|
| 22 | $context->register_hook( |
|---|
| 23 | $self, |
|---|
| 24 | 'plugin.init' => $self->can('initialize'), |
|---|
| 25 | 'publish.entry' => $self->can('notify'), |
|---|
| 26 | 'publish.finalize' => $self->can('finalize'), |
|---|
| 27 | ); |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | 1; |
|---|
| 31 | __END__ |
|---|
| 32 | |
|---|
| 33 | =head1 NAME |
|---|
| 34 | |
|---|
| 35 | Plagger::Plugin::Notify::XMPP - Notify feed updates to XMPP client |
|---|
| 36 | |
|---|
| 37 | =head1 SYNOPSIS |
|---|
| 38 | |
|---|
| 39 | jabber.org |
|---|
| 40 | |
|---|
| 41 | - module: Notify::XMPP |
|---|
| 42 | config: |
|---|
| 43 | jid: foo@jabber.org |
|---|
| 44 | password: plahplahplah |
|---|
| 45 | to: |
|---|
| 46 | - bar@jabber.org |
|---|
| 47 | - baz@gmail.com |
|---|
| 48 | - qux@jabber.jp |
|---|
| 49 | |
|---|
| 50 | Google Talk |
|---|
| 51 | |
|---|
| 52 | - module: Notify::XMPP |
|---|
| 53 | config: |
|---|
| 54 | jid: foo@gmail.com |
|---|
| 55 | password: plahplahplah |
|---|
| 56 | server_host: talk.google.com |
|---|
| 57 | tls: 1 |
|---|
| 58 | to: |
|---|
| 59 | - bar@jabber.org |
|---|
| 60 | - baz@gmail.com |
|---|
| 61 | - qux@jabber.jp |
|---|
| 62 | |
|---|
| 63 | If you want to connect server directly (not via plagger-xmppbot), |
|---|
| 64 | add "direct: yes" to config section. |
|---|
| 65 | |
|---|
| 66 | =head1 DESCRIPTION |
|---|
| 67 | |
|---|
| 68 | This plugin allows you to notify feed updates to XMPP clients (jabber, |
|---|
| 69 | Google Talk). |
|---|
| 70 | |
|---|
| 71 | =head1 AUTHOR |
|---|
| 72 | |
|---|
| 73 | HIROSE Masaaki (hirose31) |
|---|
| 74 | |
|---|
| 75 | =head1 SEE ALSO |
|---|
| 76 | |
|---|
| 77 | L<Plagger>, L<plagger-xmppbot>, |
|---|
| 78 | L<Plagger::Plugin::Notify::XMPP::IKC>, |
|---|
| 79 | L<Plagger::Plugin::Notify::XMPP::Direct> |
|---|
| 80 | |
|---|
| 81 | =cut |
|---|