]> git.mxchange.org Git - friendica-addons.git/blobdiff - buffer/buffer.php
Merge pull request #192 from annando/master
[friendica-addons.git] / buffer / buffer.php
index f6d16eaedaa498e65d5daa95f6531905ae36a418..766cef4a5b079c2537eebcd7b81c1c670f4c1124 100644 (file)
@@ -326,6 +326,7 @@ function buffer_send(&$a,&$b) {
                                                $post["preview"] = $a->get_baseurl() . "/privacy_image_cache/".privacy_image_cache_cachename($post["preview"]);
                                }
 
+                               //if ($profile->service == "twitter") {
                                if ($includedlinks) {
                                        if (isset($post["url"]))
                                                $post["url"] = short_link($post["url"]);
@@ -337,8 +338,20 @@ function buffer_send(&$a,&$b) {
 
                                // Seems like a bug to me
                                // Buffer doesn't add links to Twitter and App.net (but pictures)
-                               if ($includedlinks AND isset($post["url"]))
+                               //if ($includedlinks AND isset($post["url"]))
+                               if (($profile->service == "twitter") AND isset($post["url"]))
                                        $post["text"] .= " ".$post["url"];
+                               elseif (($profile->service == "appdotnet") AND isset($post["url"]) AND isset($post["title"])) {
+                                       $maxdesclength = $limit - (strlen($post["text"]) + 1);
+                                       if (strlen($post["title"]) > $maxdesclength)
+                                               $posttitle = trim(substr($post["title"], 0, $maxdesclength - 3))."...";
+                                       else
+                                               $posttitle = trim($post["title"]);
+
+                                       $post["text"] .= "\n[".$posttitle."](".$post["url"].")";
+                               } elseif (($profile->service == "appdotnet") AND isset($post["url"]))
+                                       $post["text"] .= " ".$post["url"];
+
 
                                $message = array();
                                $message["text"] = $post["text"];