diff --git a/QvitterPlugin.php b/QvitterPlugin.php
index 7887994..a05e836 100644
--- a/QvitterPlugin.php
+++ b/QvitterPlugin.php
@@ -160,6 +160,10 @@ class QvitterPlugin extends Plugin {
// route/reroute urls
public function onRouterInitialized($m)
{
+
+ $m->connect('api/qvitter/statuses/user_timeline.:format',
+ array('action' => 'ApiQvitterTimelineUser',
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect(':nickname/mutes',
array('action' => 'qvitter',
'nickname' => Nickname::INPUT_FMT));
@@ -371,6 +375,10 @@ class QvitterPlugin extends Plugin {
array('action' => 'shownotice'),
array('notice' => '[0-9]+'),
'qvitter');
+ URLMapperOverwrite::overwrite_variable($m, 'user/:id',
+ array('action' => 'userbyid'),
+ array('id' => '[0-9]+'),
+ 'qvitter');
URLMapperOverwrite::overwrite_variable($m, 'conversation/:id',
array('action' => 'conversation'),
array('id' => '[0-9]+'),
@@ -397,6 +405,7 @@ class QvitterPlugin extends Plugin {
case 'api/favorites.json':
case 'api/statuses/friends_timeline.json':
case 'api/statuses/user_timeline.json':
+ case 'api/qvitter/statuses/user_timeline.json':
// add logged in user's user array
if (common_logged_in() && !isset($_GET['screen_name']) && !isset($_GET['id'])) {
@@ -409,13 +418,17 @@ class QvitterPlugin extends Plugin {
if(isset($_GET['screen_name'])) {
$user = User::getKV('nickname', $_GET['screen_name']);
+ if($user instanceof User) {
+ $profile = $user->getProfile();
+ }
}
elseif(isset($_GET['id'])) {
+ $profile = Profile::getKV('id', $_GET['id']);
$user = User::getKV('id', $_GET['id']);
}
- if($user instanceof User) {
- header('Qvitter-User-Array: '.json_encode($this->qvitterTwitterUserArray($user->getProfile())));
+ if(isset($profile) && $profile instanceof Profile) {
+ header('Qvitter-User-Array: '.json_encode($this->qvitterTwitterUserArray($profile)));
}
}
break;
diff --git a/actions/apiexternalusershow.php b/actions/apiexternalusershow.php
index dd6d13e..d39a4d3 100644
--- a/actions/apiexternalusershow.php
+++ b/actions/apiexternalusershow.php
@@ -46,14 +46,23 @@ class ApiExternalUserShowAction extends ApiPrivateAuthAction
{
parent::prepare($args);
- $this->format = 'json';
+ $this->format = 'json';
$profileurl = urldecode($this->arg('profileurl'));
$nickname = urldecode($this->arg('nickname'));
$this->profile = new stdClass();
- $this->profile->external = null;
+ $this->profile->external = null;
$this->profile->local = null;
+ $this->profile->ostatus = null;
+
+ // the user might not exist in our db yet, try to use the Ostatus plugin
+ // to get it in there
+ $validate = new Validate();
+ if ($validate->uri($profileurl)) {
+ $ostatus_profile = Ostatus_profile::ensureProfileURL($profileurl);
+ $local_profile = Profile::getKV('id',$ostatus_profile->profile_id);
+ }
// we can get urls of two types of urls (1) ://instance/nickname
// (2) ://instance/user/1234
@@ -97,7 +106,9 @@ class ApiExternalUserShowAction extends ApiPrivateAuthAction
}
// case (1)
- $local_profile = Profile::getKV('profileurl',$profileurl);
+ if(!isset($local_profile)) {
+ $local_profile = Profile::getKV('profileurl',$profileurl);
+ }
if($local_profile instanceof Profile) {
@@ -138,13 +149,9 @@ class ApiExternalUserShowAction extends ApiPrivateAuthAction
{
parent::handle();
- if(is_null($this->profile->local) && is_null($this->profile->external)) {
- $this->clientError(_('List not found.'), 404);
- } else {
- $this->initDocument('json');
- $this->showJsonObjects($this->profile);
- $this->endDocument('json');
- }
+ $this->initDocument('json');
+ $this->showJsonObjects($this->profile);
+ $this->endDocument('json');
}
/**
diff --git a/actions/apiqvittertimelineuser.php b/actions/apiqvittertimelineuser.php
new file mode 100644
index 0000000..19c26df
--- /dev/null
+++ b/actions/apiqvittertimelineuser.php
@@ -0,0 +1,181 @@
+ \\\\_\ ·
+ · \\) \____) ·
+ · ·
+ · ·
+ · ·
+ · Qvitter is free software: you can redistribute it and / or modify it ·
+ · under the terms of the GNU Affero General Public License as published by ·
+ · the Free Software Foundation, either version three of the License or (at ·
+ · your option) any later version. ·
+ · ·
+ · Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
+ · WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
+ · FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
+ · more details. ·
+ · ·
+ · You should have received a copy of the GNU Affero General Public License ·
+ · along with Qvitter. If not, see