diff options
author | Friendika <info@friendika.com> | 2011-06-20 19:08:40 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-06-20 19:08:40 -0700 |
commit | 55112cfdd0dc63c8ad7f719aea5b46db37fcf081 (patch) | |
tree | bdd28ad235fdc20dc2b711c77d14c2f53f0a3868 /include | |
parent | db336929cd1211e6704914c77dc332d7555decff (diff) | |
download | volse-hubzilla-55112cfdd0dc63c8ad7f719aea5b46db37fcf081.tar.gz volse-hubzilla-55112cfdd0dc63c8ad7f719aea5b46db37fcf081.tar.bz2 volse-hubzilla-55112cfdd0dc63c8ad7f719aea5b46db37fcf081.zip |
item source
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 8 | ||||
-rw-r--r-- | include/conversation.php | 4 | ||||
-rw-r--r-- | include/items.php | 10 | ||||
-rw-r--r-- | include/salmon.php | 3 |
4 files changed, 17 insertions, 8 deletions
diff --git a/include/api.php b/include/api.php index 2d9007126..cab1431d3 100644 --- a/include/api.php +++ b/include/api.php @@ -315,7 +315,7 @@ api_register_func('api/account/verify_credentials','api_account_verify_credentials', true); - // TODO - media uploads and alternate 'source' + // TODO - media uploads function api_statuses_update(&$a, $type) { if (local_user()===false) return false; @@ -379,7 +379,7 @@ 'created_at' => api_date($lastwall['created']), 'id' => $lastwall['contact-id'], 'text' => strip_tags(bbcode($lastwall['body'])), - 'source' => 'web', + 'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'), 'truncated' => false, 'in_reply_to_status_id' => $in_reply_to_status_id, 'in_reply_to_user_id' => $in_reply_to_user_id, @@ -436,7 +436,7 @@ 'created_at' => api_date($lastwall['created']), 'id' => $lastwall['contact-id'], 'text' => strip_tags(bbcode($lastwall['body'])), - 'source' => 'web', + 'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'), 'truncated' => false, 'in_reply_to_status_id' => $in_reply_to_status_id, 'in_reply_to_user_id' => $in_reply_to_user_id, @@ -492,7 +492,7 @@ 'id' => $item['id'], 'text' => strip_tags(bbcode($item['body'])), 'html' => bbcode($item['body']), - 'source' => 'web', + 'source' => (($item['app']) ? $item['app'] : 'web'), 'url' => ($item['plink']!=''?$item['plink']:$item['author-link']), 'truncated' => False, 'in_reply_to_status_id' => ($item['parent']!=$item['id']?$item['parent']:''), diff --git a/include/conversation.php b/include/conversation.php index b536fed5f..1fd9c31ec 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -191,7 +191,7 @@ function conversation(&$a, $items, $mode, $update) { '$thumb' => $profile_avatar, '$title' => $item['title'], '$body' => $body, - '$ago' => relative_date($item['created']), + '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), '$location' => $location, '$indent' => '', '$owner_url' => $owner_url, @@ -464,7 +464,7 @@ function conversation(&$a, $items, $mode, $update) { '$sparkle' => $sparkle, '$title' => $item['title'], '$body' => $body, - '$ago' => relative_date($item['created']), + '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), '$lock' => $lock, '$location' => $location, '$indent' => $indent, diff --git a/include/items.php b/include/items.php index a003b84bb..5bcdaef99 100644 --- a/include/items.php +++ b/include/items.php @@ -336,6 +336,12 @@ function get_atom_elements($feed,$item) { } } + $apps = $item->get_item_tags(NAMESPACE_STATUSNET,'notice_info'); + if($apps && $apps[0]['attribs']['']['source']) { + $res['app'] = $apps[0]['attribs']['']['source']; + if($res['app'] === 'web') + $res['app'] = 'OStatus'; + } /** * If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it. @@ -685,6 +691,7 @@ function item_store($arr,$force_parent = false) { $arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : ''); $arr['tag'] = ((x($arr,'tag')) ? notags(trim($arr['tag'])) : ''); $arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : ''); + $arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : ''); if($arr['parent-uri'] === $arr['uri']) { $parent_id = 0; @@ -1620,7 +1627,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) { if($item['extid']) $o .= '<dfrn:extid>' . $item['extid'] . '</dfrn:extid>' . "\r\n"; - + if($item['app']) + $o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . $item['app'] . '" ></statusnet:notice_info>'; $verb = construct_verb($item); $o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n"; $actobj = construct_activity_object($item); diff --git a/include/salmon.php b/include/salmon.php index d7060b0f7..74da98c93 100644 --- a/include/salmon.php +++ b/include/salmon.php @@ -129,7 +129,8 @@ $namespaces = <<< EOT xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:poco="http://portablecontacts.net/spec/1.0" - xmlns:ostatus="http://ostatus.org/schema/1.0" > + xmlns:ostatus="http://ostatus.org/schema/1.0" + xmlns:statusnet="http://status.net/schema/api/1/" > > EOT; $slap = str_replace('<entry>',$namespaces,$slap); |