aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-06-19 18:50:18 -0700
committerFriendika <info@friendika.com>2011-06-19 18:50:18 -0700
commitcc7c72be9048941167d2e911c0db4b2050acd4f8 (patch)
tree501f6e3419db19e23dbf1d90ebacae6175daed84
parentc2dcff0d02e3e4ca5b728b6d3e41a07601163011 (diff)
downloadvolse-hubzilla-cc7c72be9048941167d2e911c0db4b2050acd4f8.tar.gz
volse-hubzilla-cc7c72be9048941167d2e911c0db4b2050acd4f8.tar.bz2
volse-hubzilla-cc7c72be9048941167d2e911c0db4b2050acd4f8.zip
statusnet API posting (untested as behind firewall at the moment)
-rw-r--r--include/api.php35
1 files changed, 33 insertions, 2 deletions
diff --git a/include/api.php b/include/api.php
index 84cb7b38f..ef41c411c 100644
--- a/include/api.php
+++ b/include/api.php
@@ -233,7 +233,6 @@
'lang' => 'en', #XXX: fix me
'description' => '',
'followers_count' => $countfriends, #XXX: fix me
- 'lang' => 'en', #XXX: fix me
'favourites_count' => 0,
'contributors_enabled' => false,
'follow_request_sent' => false,
@@ -301,7 +300,39 @@
}
api_register_func('api/account/verify_credentials','api_account_verify_credentials', true);
+
+ // TODO - media uploads and alternate 'source'
+ function api_post_message(&$a, $type) {
+ if (local_user()===false) return false;
+ $user_info = api_get_user($a);
+
+ // convert $_POST array items to the form we use for web posts.
+
+ $_POST['body'] = urldecode($_POST['status']);
+ $_POST['parent'] = $_POST['in_reply_to_status_id'];
+ if($_POST['lat'] && $_POST['long'])
+ $_POST['coord'] = sprintf("%s %s",$_POST['lat'],$_POST['long']);
+ $_POST['profile_uid'] = local_user();
+ if($_POST['parent'])
+ $_POST['type'] = 'net-comment';
+ else
+ $_POST['type'] = 'wall';
+
+ // set this so that the item_post() function is quiet and doesn't redirect or emit json
+
+ $_POST['api_source'] = true;
+
+ // call out normal post function
+
+ require_once('mod/item.php');
+ item_post($a);
+
+ // this should output the last post (the one we just posted).
+ return api_users_show();
+ }
+ api_register_func('api/statuses/update','api_statuses_update', true);
+
/**
* Returns extended information of a given user, specified by ID or screen name as per the required id parameter.
@@ -396,7 +427,7 @@
'source' => 'web',
'url' => ($item['plink']!=''?$item['plink']:$item['author-link']),
'truncated' => False,
- 'in_reply_to_status_id' => ($item['parent']!=$item['id']?$item['id']:''),
+ 'in_reply_to_status_id' => ($item['parent']!=$item['id']?$item['parent']:''),
'in_reply_to_user_id' => '',
'favorited' => false,
'in_reply_to_screen_name' => '',