vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r9995: LJSUP-7770: Add some events to event str...

Committer: vsukhanov
LJSUP-7770: Add some events to event stream
U   trunk/cgi-bin/LJ/Hooks/EventsFeed.pm
Modified: trunk/cgi-bin/LJ/Hooks/EventsFeed.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/EventsFeed.pm	2011-02-04 11:59:33 UTC (rev 9994)
+++ trunk/cgi-bin/LJ/Hooks/EventsFeed.pm	2011-02-07 08:06:41 UTC (rev 9995)
@@ -153,4 +153,83 @@
     LJ::EventsFeed::EmailChanged->new($u)->fire;
 });
 
+LJ::register_hook('account_changed', sub { ## Called on account rename
+    # account_changed 
+    my $params = shift;
+    my $userid = $params->{userid};
+    my $from   = $params->{from};
+    my $to     = $params->{to};
+
+    LJ::EventsFeed::UserRename->new($from, $to)->fire();
+});
+
+
+LJ::register_hook('postpost', sub {
+    my $params     = shift;
+    my $entry    = $params->{entry};
+    my $journal  = $params->{journal}; 
+    
+    LJ::EventsFeed::NewEntry->new($journal, $entry)->fire;
+});
+
+LJ::register_hook('editpost', sub {
+    # editpost
+    my $entry = shift;
+    my $u     = $entry->journal;
+    LJ::EventsFeed::EntryUpdated->new($u, $entry)->fire();
+});
+
+LJ::register_hook('deletepost', sub {
+    # deletepost
+    my ($jid, $jitemid, $anum) = @_;
+    my $u     = LJ::load_userid($jid);
+    my $entry = LJ::Entry->new($u, jitemid => $jitemid);
+    LJ::EventsFeed::EntryUpdated->new($u, $entry)->fire();
+});
+
+LJ::register_hook('new_comment', sub {
+    # new_comment
+    my ($userid, $jitemid, $jtalkid) = @_;
+    my $u     = LJ::load_userid($userid);
+    my $entry = LJ::Entry->new($u, jitemid => $jitemid);
+    LJ::EventsFeed::CommentsChanged->new($u, $entry)->fire();
+});
+
+LJ::register_hook('edit_comment', sub {
+    # edit_comment
+    my ($userid, $jitemid, $talkid) = @_;
+
+    my $u     = LJ::load_userid($userid);
+    my $entry = LJ::Entry->new($u, jitemid => $jitemid);
+    LJ::EventsFeed::CommentsChanged->new($u, $entry)->fire();
+});
+
+LJ::register_hook('delete_comment', sub {
+    # delete_comment
+    my ($jid, $jitemid, $talkid) = @_;
+
+    my $u     = LJ::load_userid($jid);
+    my $entry = LJ::Entry->new($u, jitemid => $jitemid);
+    LJ::EventsFeed::CommentsChanged->new($u, $entry)->fire();
+});
+
+LJ::register_hook('screen_comment', sub {
+    # screen_comment
+    my ($userid, $jitemid) = @_;
+
+    my $u     = LJ::load_userid($userid);
+    my $entry = LJ::Entry->new($u, jitemid => $jitemid);
+    LJ::EventsFeed::CommentsChanged->new($u, $entry)->fire();
+});
+
+LJ::register_hook('unscreen_comment', sub {
+    # unscreen_comment
+    my ($userid, $jitemid) = @_;
+
+    my $u     = LJ::load_userid($userid);
+    my $entry = LJ::Entry->new($u, jitemid => $jitemid);
+    LJ::EventsFeed::CommentsChanged->new($u, $entry)->fire();
+});
+
+
 1;

Tags: ljcom, pm, vadvs
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