Hi!
It seems that diaspora is formatting their messages in a special way:
For example:
"... die sie kriegen können ([siehe auch](
https://blog.fefe.de/?ts=b595b908)), aber jetzt mit dem ..."
That means that the description of a link is between [ and ] and the url is between ( and ) where some characters are escaped (for example "_").
Is there a plugin that can decode these postings so that they are looking good?
Thanks!
Michael
Comments
I could write a php script that does this, myself, I believe (basically, it's just regex replacements), but I'm not yet knowledgeable enough to know how precisely to plug that in to statusnet so that SN recognizes an incoming diaspora post and acts accordingly.
<?php
if (!defined('LACONICA')) {
exit(1);
}
class DiasporaPlugin extends Plugin
{
function __construct()
{
parent::__construct();
}
function onStartShowNoticeItem($notice)
{
$content = $notice->notice->rendered;
if (((strpos(" ".$content, "http") OR strpos(" ".$content, "#")) and !strpos($content, "href")) or (strpos($notice->notice->content, "
notice->content);
$rendered = Markdown($content);
if (substr($rendered, 0, 3) == "
")
$rendered = substr($rendered, 3, -5);
$rendered = trim(preg_replace("@(\s|:|>)(http|https)://(.*?)(\s|<|:)@", '$1<a href="$2://$3">$2://$3$4', " ".$rendered." "));
$rendered = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/ue', "'\\1#'.common_tag_link('\\2')", $rendered);
$notice->notice->rendered = $rendered;
//print_r($notice->notice);
}
return true;
}
}