repeated items from ostatus and diaspora are now using the share-element.

Some design changes to repeated items in "vier".
This commit is contained in:
Michael Vogel 2012-12-19 12:18:52 +01:00
parent 9ab34f8857
commit c22f65bafa
9 changed files with 56 additions and 20 deletions

View file

@ -251,11 +251,11 @@ function bb_ShareAttributes($match) {
if ($avatar != "")
$headline .= '<img src="'.$avatar.'" height="32" width="32" >';
$headline .= sprintf(t('<span><a href="%s">%s</a> wrote the following <a href="%s">post</a>:</span>'), $profile, $author, $link);
$headline .= sprintf(t('<span><a href="%s" target="external-link">%s</a> wrote the following <a href="%s" target="external-link">post</a>:</span>'), $profile, $author, $link);
$headline .= "</div>";
$text = "<br />".$headline.'<blockquote class="shared_content">'.trim($match[2])."</blockquote>";
$text = $headline.'<blockquote class="shared_content">'.trim($match[2])."</blockquote>";
return($text);
}
@ -314,6 +314,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// We'll emulate it.
$Text = trim($Text);
$Text = str_replace("\r\n","\n", $Text);
$Text = str_replace(array("\r","\n"), array('<br />','<br />'), $Text);

View file

@ -439,14 +439,14 @@ function delivery_run(&$argv, &$argc){
}
if(! $it)
break;
$local_user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
if(! count($local_user))
break;
$reply_to = '';
$r1 = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($uid)
@ -482,12 +482,21 @@ function delivery_run(&$argv, &$argc){
if($it['uri'] !== $it['parent-uri']) {
$headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n";
if(!strlen($it['title'])) {
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
dbesc($it['parent-uri']));
if(!$it['title']) {
$r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($it['parent-uri']),
intval($uid));
if(count($r) AND ($r[0]['title'] != ''))
$subject = $r[0]['title'];
else {
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($it['parent-uri']),
intval($uid));
if(count($r) AND ($r[0]['title'] != ''))
$subject = $r[0]['title'];
}
}
if(strncasecmp($subject,'RE:',3))
$subject = 'Re: '.$subject;

View file

@ -923,6 +923,7 @@ function diaspora_reshare($importer,$xml,$msg) {
$orig_guid = notags(unxmlify($xml->root_guid));
$source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml';
$orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
$x = fetch_url($source_url);
if(! $x)
$x = fetch_url(str_replace('https://','http://',$source_url));
@ -1032,10 +1033,14 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
$datarray['body'] = $body;
} else {
$prefix = "[share author='".$person['name'].
"' profile='".$person['url'].
"' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']).
"' link='".$orig_url."']";
$datarray['author-name'] = $contact['name'];
$datarray['author-link'] = $contact['url'];
$datarray['author-avatar'] = $contact['thumb'];
$datarray['body'] = $prefix . $body;
$datarray['body'] = $prefix.$body."[/share]";
}
$datarray['tag'] = $str_tags;

View file

@ -798,6 +798,7 @@ function get_atom_elements($feed,$item) {
logger('get_atom_elements: Looking for status.net repeated message');
$message = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["content"][0]["data"];
$orig_uri = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["id"][0]["data"];
$author = $child[SIMPLEPIE_NAMESPACE_ATOM_10]["author"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10];
$uri = $author["uri"][0]["data"];
$name = $author["name"][0]["data"];
@ -805,17 +806,22 @@ function get_atom_elements($feed,$item) {
$avatar = $avatar["href"];
if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) {
logger('get_atom_elements: fixing sender of repeated message');
logger('get_atom_elements: fixing sender of repeated message. '.print_r($child, true));
$res["owner-name"] = $res["author-name"];
/*$res["owner-name"] = $res["author-name"];
$res["owner-link"] = $res["author-link"];
$res["owner-avatar"] = $res["author-avatar"];
$res["author-name"] = $name;
$res["author-link"] = $uri;
$res["author-avatar"] = $avatar;
$res["author-avatar"] = $avatar;*/
$res["body"] = html2bbcode($message);
$prefix = "[share author='".$name.
"' profile='".$uri.
"' avatar='".$avatar.
"' link='".$orig_uri."']";
$res["body"] = $prefix.html2bbcode($message)."[/share]";
}
}

View file

@ -791,12 +791,21 @@ function notifier_run(&$argv, &$argc){
if($it['uri'] !== $it['parent-uri']) {
$headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n";
if(!strlen($it['title'])) {
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
dbesc($it['parent-uri']));
if(!$it['title']) {
$r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($it['parent-uri']),
intval($uid));
if(count($r) AND ($r[0]['title'] != ''))
if(count($r) AND ($r[0]['title'] != ''))
$subject = $r[0]['title'];
else {
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($it['parent-uri']),
intval($uid));
if(count($r) AND ($r[0]['title'] != ''))
$subject = $r[0]['title'];
}
}
if(strncasecmp($subject,'RE:',3))
$subject = 'Re: '.$subject;

View file

@ -405,8 +405,9 @@ function onepoll_run(&$argv, &$argc){
// If it seems to be a reply but a header couldn't be found take the last message with matching subject
if(!x($datarray,'parent-uri') and $reply) {
$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) ORDER BY `created` DESC LIMIT 1",
dbesc(protect_sprintf($datarray['title'])));
$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) AND `uid` = %d ORDER BY `created` DESC LIMIT 1",
dbesc(protect_sprintf($datarray['title'])),
intval($importer_uid));
if(count($r))
$datarray['parent-uri'] = $r[0]['parent-uri'];
}

View file

@ -982,6 +982,9 @@ function prepare_body($item,$attach = false) {
$s = $prep_arr['html'];
if(! $attach) {
// Replace the blockquotes with quotes that are used in mails
$mailquote = '<blockquote type="cite" class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">';
$s = str_replace(array('<blockquote>', '<blockquote class="spoiler">', '<blockquote class="author">'), array($mailquote, $mailquote, $mailquote), $s);
return $s;
}

View file

@ -2081,3 +2081,5 @@ $a->strings["Post to Drupal by default"] = "Veröffentliche öffentliche Beiträ
$a->strings["OEmbed settings updated"] = "OEmbed Einstellungen aktualisiert.";
$a->strings["Use OEmbed for YouTube videos"] = "OEmbed für Youtube Videos verwenden";
$a->strings["URL to embed:"] = "URL zum Einbetten:";
$a->strings['<span><a href="%s" target="external-link">%s</a> wrote the following <a href="%s" target="external-link">post</a>:</span>'] =
'<span><a href="%s" target="external-link">%s</a> hat diesen <a href="%s" target="external-link">Beitrag</a> ursprünglich gepostet:</span>';

View file

@ -356,8 +356,8 @@ div.pager, .birthday-notice {
height: 32px;
color: #999;
border-top: 1px solid #D2D2D2;
padding-top: 16px;
margin-top: 16px;
padding-top: 5px;
margin-top: 5px;
}
.shared_header img {