Use twitter's new id_str field from the JSON response.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 10 Dec 2010 17:25:02 +0000 (12:25 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 10 Dec 2010 17:26:07 +0000 (12:26 -0500)
Required since twitter moved to their "SnowFlake" id generator -
which produces 64bit unsigned integers.

horde/services/twitter.php
horde/templates/block/twitter_tweet.html.php

index f58825b..7f6e1d1 100644 (file)
@@ -70,7 +70,7 @@ case 'getPage':
     }
     $html = '';
     if (count($stream)) {
-        $newest = $stream[0]->id;
+        $newest = $stream[0]->id_str;
     } else {
         $newest = $params['since_id'];
         $oldest = 0;
@@ -81,7 +81,7 @@ case 'getPage':
     foreach ($stream as $tweet) {
 
         /* Don't return the max_id tweet, since we already have it */
-        if (!empty($params['max_id']) && $params['max_id'] == $tweet->id) {
+        if (!empty($params['max_id']) && $params['max_id'] == $tweet->id_str) {
             continue;
         }
 
@@ -107,7 +107,7 @@ case 'getPage':
         $view->clientText = $filter->filter($tweet->source, 'xss');
         $view->tweet = $tweet;
         $view->instanceid = $instance;
-        $oldest = $tweet->id;
+        $oldest = $tweet->id_str;
         $html .= $view->render('twitter_tweet');
     }
 
index 8664a72..83d9162 100644 (file)
@@ -31,8 +31,8 @@
     </div>
     <?php endif; ?>
     <div class="hordeSmStreaminfo">
-      <?php echo Horde::selfUrl()->link(array('onclick' => 'Horde[\'twitter' . $this->instanceid . '\'].buildReply(\'' . $this->tweet->id . '\', \'' . $this->tweet->user->screen_name . '\', \'' . $this->tweet->user->name . '\'); return false;')) .  _("Reply") ?></a>
-      &nbsp;|&nbsp; <?php echo Horde::selfUrl()->link(array('onclick' => 'Horde[\'twitter' . $this->instanceid . '\'].retweet(\'' . $this->tweet->id . '\'); return false;')) . _("Retweet") ?></a>
+      <?php echo Horde::selfUrl()->link(array('onclick' => 'Horde[\'twitter' . $this->instanceid . '\'].buildReply(\'' . (string)$this->tweet->id_str . '\', \'' . $this->tweet->user->screen_name . '\', \'' . $this->tweet->user->name . '\'); return false;')) .  _("Reply") ?></a>
+      &nbsp;|&nbsp; <?php echo Horde::selfUrl()->link(array('onclick' => 'Horde[\'twitter' . $this->instanceid . '\'].retweet(\'' . (string)$this->tweet->id_str . '\'); return false;')) . _("Retweet") ?></a>
     </div>
     <div class="clear">&nbsp;</div>
   </div>