wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[ljcom] r11515: LJSV-2037: (Logging twitter digest activ...

Committer: gprochaev
LJSV-2037: (Logging twitter digest activity)

U   trunk/cgi-bin/LJ/Client/Twitter.pm
U   trunk/cgi-bin/LJ/TwitterDigest.pm
Modified: trunk/cgi-bin/LJ/Client/Twitter.pm
===================================================================
--- trunk/cgi-bin/LJ/Client/Twitter.pm	2012-02-22 09:27:24 UTC (rev 11514)
+++ trunk/cgi-bin/LJ/Client/Twitter.pm	2012-02-22 10:38:39 UTC (rev 11515)
@@ -287,13 +287,12 @@
         $res = $ua->post( $request_url, $post_params );
     }
 
-    my $system = LJ::load_user ('system');
     if ($res->is_success) {
         return LJ::JSON->from_json($res->content);
     } else {
         if ($res->code eq '401' && $u) {
             warn "twitter error: 401 Unauthorized\n";
-            LJ::statushistory_add($u, $system, 'twitter_failed', '401 Unauthorized');
+            $u->log_event ("twitter_failed", { text => '401 Unauthorized' } );
 
             $u->clear_prop($_)
                 foreach qw(
@@ -317,12 +316,12 @@
             # 50x codes (which indicate a server error) only get
             # printed if we have an environment flag on
             if ( $ENV{'LJ_DEBUG_TWITTER_CONNECTIVITY'} ) {
-                LJ::statushistory_add($u, $system, 'twitter_failed', $res->status_line);
+                $u->log_event ("twitter_failed", { text => $res->status_line } );
                 die "twitter connectivity error: " . $res->status_line;
             }
             return;
         } else {
-            LJ::statushistory_add($u, $system, 'twitter_failed', $res->status_line);
+            $u->log_event ("twitter_failed", { text => $res->status_line } );
             die "twitter connectivity error: " . $res->status_line;
         }
         return undef;

Modified: trunk/cgi-bin/LJ/TwitterDigest.pm
===================================================================
--- trunk/cgi-bin/LJ/TwitterDigest.pm	2012-02-22 09:27:24 UTC (rev 11514)
+++ trunk/cgi-bin/LJ/TwitterDigest.pm	2012-02-22 10:38:39 UTC (rev 11515)
@@ -213,6 +213,7 @@
     my ($class, $u) = @_;
 
     my $twu = LJ::Client::Twitter->get_userinfo( 'user' => $u );
+
     return if ! $twu || $twu->protected;
 
     if (my $u_system = LJ::load_user('system')) {
@@ -234,8 +235,7 @@
 
     my $tweets = LJ::Client::Twitter->user_last_tweets($u);
     unless (@$tweets) {
-        my $system = LJ::load_user ('system');
-        LJ::statushistory_add($u, $system, 'twitter_skipped', "No tweets to import");
+        $u->log_event ("twitter_skipped", { text => "No tweets to import" });
         return;
     }
 
@@ -245,8 +245,7 @@
         @$tweets;
 
     unless (@tweets_filtered) {
-        my $system = LJ::load_user ('system');
-        LJ::statushistory_add($u, $system, 'twitter_skipped', "No filtered tweets to import");
+        $u->log_event ("twitter_skipped", { text => "No filtered tweets to import" });
         return;
     }
     
@@ -317,8 +316,7 @@
     }, \$errs, { 'noauth' => 1 });
 
     unless ($errs) {
-        my $system = LJ::load_user ('system');
-        LJ::statushistory_add($u, $system, 'twitter_success', $res->{'url'});
+        $u->log_event ("twitter_success", { text => $res->{'url'} });
     }
 
     warn $errs if $errs;

Tags: gprochaev, ljcom, pm, wisest-owl
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