]> git.mxchange.org Git - friendica-addons.git/blobdiff - twitter/twitter.php
There is no LOGGER_ERROR - log problems instead at default (LOGGER_NORMAL)
[friendica-addons.git] / twitter / twitter.php
index 32b4980f55a2df4ebba7486150a29b1cc9729d5f..05c9cf91681fd86e50aa86fdeb15e02155b07827 100755 (executable)
@@ -2,7 +2,7 @@
 /**
  * Name: Twitter Connector
  * Description: Relay public postings to a connected Twitter account
- * Version: 1.0.3
+ * Version: 1.0.4
  * Author: Tobias Diekershoff <http://diekershoff.homeunix.net/friendika/profile/tobias>
  */
 
@@ -301,9 +301,9 @@ function twitter_post_hook(&$a,&$b) {
                 // shorten all the links in a 200000 character long essay.
                 if (! $b['title']=='') {
                     $tmp = $b['title'] . ' : '. $b['body'];
-                    $tmp = substr($tmp, 0, 4*$max_char);
+//                    $tmp = substr($tmp, 0, 4*$max_char);
                 } else {
-                    $tmp = substr($b['body'], 0, 3*$max_char);
+                    $tmp = $b['body']; // substr($b['body'], 0, 3*$max_char);
                 }
                 // if [url=bla][img]blub.png[/img][/url] get blub.png
                 $tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\]\[img\](\\w+.*?)\\[\\/img\]\\[\\/url\]/i', '$2', $tmp);
@@ -357,7 +357,10 @@ function twitter_post_hook(&$a,&$b) {
                // and now tweet it :-)
                if(strlen($msg)) {
                        $result = $tweet->post('statuses/update', array('status' => $msg));
-                       logger('twitter_post send' , LOGGER_DEBUG);
+                       logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
+                       if ($result->error) {
+                               logger('Send to Twitter failed: "' . $result->error . '"');
+                       }
                }
        }
 }