Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r10382: LJSUP-8570 (new EventsFeed events for fo...

Committer: ailyin
LJSUP-8570 (new EventsFeed events for fotobilder)
A   trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryDelete.pm
A   trunk/cgi-bin/LJ/EventsFeed/FotobilderGallerySecChange.pm
A   trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryTouch.pm
A   trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicDelete.pm
A   trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicSecChange.pm
U   trunk/cgi-bin/LJ/Hooks/EventsFeed.pm
Added: trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryDelete.pm
===================================================================
--- trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryDelete.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryDelete.pm	2011-04-13 06:48:35 UTC (rev 10382)
@@ -0,0 +1,41 @@
+package LJ::EventsFeed::FotobilderGalleryDelete;
+use strict;
+use warnings;
+
+use base qw( LJ::EventsFeed );
+
+sub new {
+    my ( $class, $g ) = @_;
+
+    if ( ref $g eq 'HASH' ) {
+        # an call from (obsolete) FB::delete_gallery, let's
+        # make a proper object from that
+
+        $g = FB::Gallery->new( $g->{'userid'}, $g->{'gallid'} );
+    }
+
+    my $fbu = $g->{'u'};
+
+    return $class->SUPER::new(
+        'userid'      => FB::get_domain_userid($fbu),
+        'userlogin'   => $fbu->user,
+        'gallery_url' => $g->url,
+    );
+}
+
+sub as_xml {
+    my ($self) = @_;
+
+    my $params = $self->params;
+
+    my $ret = '';
+
+    $ret .= $self->xml_head('fotobilder_gallery_delete');
+    $ret .= "<journal name='$params->{userlogin}' id='$params->{userid}' />";
+    $ret .= "<gallery url='$params->{gallery_url}' />";
+    $ret .= $self->xml_footer;
+
+    return $ret;
+}
+
+1;

Added: trunk/cgi-bin/LJ/EventsFeed/FotobilderGallerySecChange.pm
===================================================================
--- trunk/cgi-bin/LJ/EventsFeed/FotobilderGallerySecChange.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/EventsFeed/FotobilderGallerySecChange.pm	2011-04-13 06:48:35 UTC (rev 10382)
@@ -0,0 +1,35 @@
+package LJ::EventsFeed::FotobilderGallerySecChange;
+use strict;
+use warnings;
+
+use base qw( LJ::EventsFeed );
+
+sub new {
+    my ( $class, $g, $secid ) = @_;
+
+    my $fbu = $g->{'u'};
+
+    return $class->SUPER::new(
+        'userid'      => FB::get_domain_userid($fbu),
+        'userlogin'   => $fbu->user,
+        'gallery_url' => $g->url,
+        'secid'       => $secid,
+    );
+}
+
+sub as_xml {
+    my ($self) = @_;
+
+    my $params = $self->params;
+
+    my $ret = '';
+
+    $ret .= $self->xml_head('fotobilder_gallery_sec_change');
+    $ret .= "<journal name='$params->{userlogin}' id='$params->{userid}' />";
+    $ret .= "<gallery url='$params->{gallery_url}' secid='$params->{secid}'/>";
+    $ret .= $self->xml_footer;
+
+    return $ret;
+}
+
+1;

Added: trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryTouch.pm
===================================================================
--- trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryTouch.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/EventsFeed/FotobilderGalleryTouch.pm	2011-04-13 06:48:35 UTC (rev 10382)
@@ -0,0 +1,34 @@
+package LJ::EventsFeed::FotobilderGalleryTouch;
+use strict;
+use warnings;
+
+use base qw( LJ::EventsFeed );
+
+sub new {
+    my ( $class, $g ) = @_;
+
+    my $fbu = $g->{'u'};
+
+    return $class->SUPER::new(
+        'userid'      => FB::get_domain_userid($fbu),
+        'userlogin'   => $fbu->user,
+        'gallery_url' => $g->url,
+    );
+}
+
+sub as_xml {
+    my ($self) = @_;
+
+    my $params = $self->params;
+
+    my $ret = '';
+
+    $ret .= $self->xml_head('fotobilder_gallery_touch');
+    $ret .= "<journal name='$params->{userlogin}' id='$params->{userid}' />";
+    $ret .= "<gallery url='$params->{gallery_url}' />";
+    $ret .= $self->xml_footer;
+
+    return $ret;
+}
+
+1;

Added: trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicDelete.pm
===================================================================
--- trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicDelete.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicDelete.pm	2011-04-13 06:48:35 UTC (rev 10382)
@@ -0,0 +1,34 @@
+package LJ::EventsFeed::FotobilderUpicDelete;
+use strict;
+use warnings;
+
+use base qw( LJ::EventsFeed );
+
+sub new {
+    my ( $class, $up ) = @_;
+
+    my $fbu = $up->{'u'};
+
+    return $class->SUPER::new(
+        'userid'      => FB::get_domain_userid($fbu),
+        'userlogin'   => $fbu->user,
+        'upic_url'    => $up->url_base,
+    );
+}
+
+sub as_xml {
+    my ($self) = @_;
+
+    my $params = $self->params;
+
+    my $ret = '';
+
+    $ret .= $self->xml_head('fotobilder_upic_delete');
+    $ret .= "<journal name='$params->{userlogin}' id='$params->{userid}' />";
+    $ret .= "<upic url='$params->{upic_url}' />";
+    $ret .= $self->xml_footer;
+
+    return $ret;
+}
+
+1;

Added: trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicSecChange.pm
===================================================================
--- trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicSecChange.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/EventsFeed/FotobilderUpicSecChange.pm	2011-04-13 06:48:35 UTC (rev 10382)
@@ -0,0 +1,35 @@
+package LJ::EventsFeed::FotobilderUpicSecChange;
+use strict;
+use warnings;
+
+use base qw( LJ::EventsFeed );
+
+sub new {
+    my ( $class, $up, $secid ) = @_;
+
+    my $fbu = $up->{'u'};
+
+    return $class->SUPER::new(
+        'userid'      => FB::get_domain_userid($fbu),
+        'userlogin'   => $fbu->user,
+        'upic_url'    => $up->url_base,
+        'secid'       => $secid,
+    );
+}
+
+sub as_xml {
+    my ($self) = @_;
+
+    my $params = $self->params;
+
+    my $ret = '';
+
+    $ret .= $self->xml_head('fotobilder_upic_sec_change');
+    $ret .= "<journal name='$params->{userlogin}' id='$params->{userid}' />";
+    $ret .= "<upic url='$params->{upic_url}' secid='$params->{secid}' />";
+    $ret .= $self->xml_footer;
+
+    return $ret;
+}
+
+1;

Modified: trunk/cgi-bin/LJ/Hooks/EventsFeed.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/EventsFeed.pm	2011-04-13 02:02:03 UTC (rev 10381)
+++ trunk/cgi-bin/LJ/Hooks/EventsFeed.pm	2011-04-13 06:48:35 UTC (rev 10382)
@@ -243,5 +243,38 @@
     LJ::EventsFeed::CommentsChanged->new($u, $entry)->fire();
 });
 
+### BEGIN FOTOBILDER EVENTS ###
 
+LJ::register_hook( 'fotobilder_gallery_touch' => sub {
+    my ($g) = @_;
+    return unless LJ::is_enabled('events-feed-fotobilder');
+    LJ::EventsFeed::FotobilderGalleryTouch->new($g)->fire;
+});
+
+LJ::register_hook( 'fotobilder_gallery_sec_change' => sub {
+    my ( $g, $secid ) = @_;
+    return unless LJ::is_enabled('events-feed-fotobilder');
+    LJ::EventsFeed::FotobilderGallerySecChange->new( $g, $secid )->fire;
+});
+
+LJ::register_hook( 'fotobilder_gallery_delete' => sub {
+    my ($g) = @_;
+    return unless LJ::is_enabled('events-feed-fotobilder');
+    LJ::EventsFeed::FotobilderGalleryDelete->new($g)->fire;
+});
+
+LJ::register_hook( 'fotobilder_upic_sec_change' => sub {
+    my ( $up, $secid ) = @_;
+    return unless LJ::is_enabled('events-feed-fotobilder');
+    LJ::EventsFeed::FotobilderUpicSecChange->new( $up, $secid )->fire;
+});
+
+LJ::register_hook( 'fotobilder_upic_delete' => sub {
+    my ($up) = @_;
+    return unless LJ::is_enabled('events-feed-fotobilder');
+    LJ::EventsFeed::FotobilderUpicDelete->new($up)->fire;
+});
+
+### END FOTOBILDER EVENTS ###
+
 1;

Tags: andy, ljcom, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments