]> git.mxchange.org Git - friendica.git/commitdiff
Diaspora: Messages are now looking better
authorMichael Vogel <icarus@dabo.de>
Sat, 23 Jun 2012 10:42:01 +0000 (12:42 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 23 Jun 2012 10:42:01 +0000 (12:42 +0200)
include/diaspora.php

index bd38511564face94855d74062c84eda4d3ea4504..a0a1df00e18fa4a9eb874d9cc3862a654d15b130 100755 (executable)
@@ -2005,6 +2005,7 @@ function diaspora_share($me,$contact) {
        ));
 
        $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey'])));
+       //$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey']));
 
        return(diaspora_transmit($owner,$contact,$slap, false));
 }
@@ -2022,6 +2023,7 @@ function diaspora_unshare($me,$contact) {
        ));
 
        $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey'])));
+       //$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey']));
 
        return(diaspora_transmit($owner,$contact,$slap, false));
 
@@ -2062,11 +2064,19 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
                }
        }
 */
-       if(strlen($title))
-               $body = "[b]".html_entity_decode($title)."[/b]\n\n".$body;
+       // Removal of tags
+       $body = preg_replace('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $body);
+
+       //if(strlen($title))
+       //      $body = "[b]".html_entity_decode($title)."[/b]\n\n".$body;
 
+       // convert to markdown
        $body = xmlify(html_entity_decode(bb2diaspora($body)));
+       //$body = bb2diaspora($body);
 
+       // Adding the title
+       if(strlen($title))
+               $body = "## ".html_entity_decode($title)."\n\n".$body;
 
        if($item['attach']) {
                $cnt = preg_match_all('/href=\"(.*?)\"(.*?)title=\"(.*?)\"/ism',$item['attach'],$matches,PREG_SET_ORDER);
@@ -2096,6 +2106,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
        logger('diaspora_send_status: ' . $owner['username'] . ' -> ' . $contact['name'] . ' base message: ' . $msg, LOGGER_DATA);
 
        $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
+       //$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
 
        $return_code = diaspora_transmit($owner,$contact,$slap,$public_batch);
 
@@ -2140,6 +2151,7 @@ function diaspora_send_images($item,$owner,$contact,$images,$public_batch = fals
 
                logger('diaspora_send_photo: base message: ' . $msg, LOGGER_DATA);
                $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
+               //$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
 
                diaspora_transmit($owner,$contact,$slap,$public_batch);
        }
@@ -2203,6 +2215,7 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
        logger('diaspora_followup: base message: ' . $msg, LOGGER_DATA);
 
        $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
+       //$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
 
        return(diaspora_transmit($owner,$contact,$slap,$public_batch));
 }
@@ -2333,6 +2346,7 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
 
 
        $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
+       //$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
 
        return(diaspora_transmit($owner,$contact,$slap,$public_batch));
 
@@ -2367,6 +2381,7 @@ function diaspora_send_retraction($item,$owner,$contact,$public_batch = false) {
        ));
 
        $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
+       //$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
 
        return(diaspora_transmit($owner,$contact,$slap,$public_batch));
 }
@@ -2427,6 +2442,7 @@ function diaspora_send_mail($item,$owner,$contact) {
        logger('diaspora_conversation: ' . print_r($xmsg,true), LOGGER_DATA);
 
        $slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($xmsg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],false)));
+       //$slap = 'xml=' . urlencode(diaspora_msg_build($xmsg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],false));
 
        return(diaspora_transmit($owner,$contact,$slap,false));