summaryrefslogtreecommitdiff
path: root/lib/twitterapi.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2008-09-29 01:08:26 -0400
committerZach Copley <zach@controlyourself.ca>2008-09-29 01:08:26 -0400
commit924491f08a24201c7bda45b4d4be16ccebba97c0 (patch)
treeeefba7055dd15b443d59834da9cdacef653570f1 /lib/twitterapi.php
parent10f4ee7abb889aeb21b45efb563ebe5c2f4d9c94 (diff)
Twitter-compatible API: Direct messages work (everything but destroy())
darcs-hash:20080929050826-7b5ce-201624b32e174ae85b906b92353e39aa043838fa.gz
Diffstat (limited to 'lib/twitterapi.php')
-rw-r--r--lib/twitterapi.php40
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index d427a7b4e..5bcb538f9 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -121,7 +121,7 @@ class TwitterapiAction extends Action {
}
- function twitter_dm_array($message) {
+ function twitter_dmsg_array($message) {
$twitter_dm = array();
@@ -214,7 +214,21 @@ class TwitterapiAction extends Action {
exit();
}
- function show_twitter_xml_dm($twitter_dm) {
+ function show_single_xml_dmsg($message) {
+ $this->init_document('xml');
+ $dmsg = $this->twitter_dmsg_array($message);
+ $this->show_twitter_xml_dmsg($dmsg);
+ $this->end_document('xml');
+ }
+
+ function show_single_json_dmsg($message) {
+ $this->init_document('json');
+ $dmsg = $this->twitter_dmsg_array($message);
+ $this->show_twitter_json_dm($dmsg);
+ $this->end_document('json');
+ }
+
+ function show_twitter_xml_dmsg($twitter_dm) {
common_element_start('direct_message');
foreach($twitter_dm as $element => $value) {
if ($element == 'sender' || $element == 'recipient') {
@@ -405,4 +419,26 @@ class TwitterapiAction extends Action {
}
return;
}
+
+ function get_user($id) {
+ if (is_numeric($id)) {
+ return User::staticGet($id);
+ } else {
+ return User::staticGet('nickname', $id);
+ }
+ }
+
+ function get_profile($id) {
+ if (is_numeric($id)) {
+ return Profile::staticGet($id);
+ } else {
+ $user = User::staticGet('nickname', $id);
+ if ($user) {
+ return $user->getProfile();
+ } else {
+ return NULL;
+ }
+ }
+ }
+
} \ No newline at end of file