summaryrefslogtreecommitdiff
path: root/actions/twitapidirect_messages.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-03-12 11:56:23 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-03-12 11:56:23 -0400
commitb3a0eea3b66e95becb6c4595ed71c7fe71ed6437 (patch)
tree76666150701f03205bfff77e7d034dfa724f8764 /actions/twitapidirect_messages.php
parent399669b1fb955d2d8c18098a7b551184d534a94c (diff)
parente185c0395a6cd250ccd7c8e385c54830be73f937 (diff)
Merge branch '0.7.x' into 0.8.x
Conflicts: classes/Notice.php lib/action.php lib/router.php lib/twitter.php
Diffstat (limited to 'actions/twitapidirect_messages.php')
-rw-r--r--actions/twitapidirect_messages.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index db55e8cd0..7101db8df 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -38,7 +38,6 @@ class Twitapidirect_messagesAction extends TwitterapiAction
function show_messages($args, $apidata, $type)
{
-
$user = $apidata['user'];
$count = $this->arg('count');
@@ -102,7 +101,17 @@ class Twitapidirect_messagesAction extends TwitterapiAction
$this->show_rss_dmsgs($message, $title, $link, $subtitle);
break;
case 'atom':
- $this->show_atom_dmsgs($message, $title, $link, $subtitle);
+ $selfuri = common_root_url() . 'api/direct_messages';
+ $selfuri .= ($type == 'received') ? '.atom' : '/sent.atom';
+ $taguribase = common_config('integration', 'taguri');
+
+ if ($type == 'sent') {
+ $id = "tag:$taguribase:SentDirectMessages:" . $user->id;
+ } else {
+ $id = "tag:$taguribase:DirectMessages:" . $user->id;
+ }
+
+ $this->show_atom_dmsgs($message, $title, $link, $subtitle, $selfuri, $id);
break;
case 'json':
$this->show_json_dmsgs($message);
@@ -190,7 +199,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
$this->init_document('xml');
$this->elementStart('direct-messages', array('type' => 'array'));
- if (is_array($messages)) {
+ if (is_array($message)) {
foreach ($message as $m) {
$twitter_dm = $this->twitter_dmsg_array($m);
$this->show_twitter_xml_dmsg($twitter_dm);
@@ -261,16 +270,17 @@ class Twitapidirect_messagesAction extends TwitterapiAction
}
- function show_atom_dmsgs($message, $title, $link, $subtitle)
+ function show_atom_dmsgs($message, $title, $link, $subtitle, $selfuri, $id)
{
$this->init_document('atom');
$this->element('title', null, $title);
- $siteserver = common_config('site', 'server');
- $this->element('id', null, "tag:$siteserver,2008:DirectMessage");
+ $this->element('id', null, $id);
$this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null);
- $this->element('updated', null, common_date_iso8601(strftime('%c')));
+ $this->element('link', array('href' => $selfuri, 'rel' => 'self',
+ 'type' => 'application/atom+xml'), null);
+ $this->element('updated', null, common_date_iso8601('now'));
$this->element('subtitle', null, $subtitle);
if (is_array($message)) {