+
+ function show_xml_dmsgs($message) {
+
+ $this->init_document('xml');
+ common_element_start('direct-messages', array('type' => 'array'));
+
+ if (is_array($messages)) {
+ foreach ($message as $m) {
+ $twitter_dm = $this->twitter_dmsg_array($m);
+ $this->show_twitter_xml_dmsg($twitter_dm);
+ }
+ } else {
+ while ($message->fetch()) {
+ $twitter_dm = $this->twitter_dmsg_array($message);
+ $this->show_twitter_xml_dmsg($twitter_dm);
+ }
+ }
+
+ common_element_end('direct-messages');
+ $this->end_document('xml');
+
+ }
+
+ function show_json_dmsgs($message) {
+
+ $this->init_document('json');
+
+ $dmsgs = array();
+
+ if (is_array($message)) {
+ foreach ($message as $m) {
+ $twitter_dm = $this->twitter_dmsg_array($m);
+ array_push($dmsgs, $twitter_dm);
+ }
+ } else {
+ while ($message->fetch()) {
+ $twitter_dm = $this->twitter_dmsg_array($message);
+ array_push($dmsgs, $twitter_dm);
+ }
+ }
+
+ $this->show_json_objects($dmsgs);
+ $this->end_document('json');
+
+ }
+
+ function show_rss_dmsgs($message, $title, $link, $subtitle) {
+
+ $this->init_document('rss');
+
+ common_element_start('channel');
+ common_element('title', NULL, $title);
+
+ common_element('link', NULL, $link);
+ common_element('description', NULL, $subtitle);
+ common_element('language', NULL, 'en-us');
+ common_element('ttl', NULL, '40');
+
+ if (is_array($message)) {
+ foreach ($message as $m) {
+ $entry = $this->twitter_rss_dmsg_array($m);
+ $this->show_twitter_rss_item($entry);
+ }
+ } else {
+ while ($message->fetch()) {
+ $entry = $this->twitter_rss_dmsg_array($message);
+ $this->show_twitter_rss_item($entry);
+ }
+ }
+
+ common_element_end('channel');
+ $this->end_twitter_rss();
+
+ }
+
+ function show_atom_dmsgs($message, $title, $link, $subtitle) {
+
+ $this->init_document('atom');
+
+ common_element('title', NULL, $title);
+ $siteserver = common_config('site', 'server');
+ common_element('id', NULL, "tag:$siteserver,2008:DirectMessage");
+ common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
+ common_element('updated', NULL, common_date_iso8601(strftime('%c')));
+ common_element('subtitle', NULL, $subtitle);
+
+ if (is_array($message)) {
+ foreach ($message as $m) {
+ $entry = $this->twitter_rss_dmsg_array($m);
+ $this->show_twitter_atom_entry($entry);
+ }
+ } else {
+ while ($message->fetch()) {
+ $entry = $this->twitter_rss_dmsg_array($message);
+ $this->show_twitter_atom_entry($entry);
+ }
+ }
+
+ $this->end_document('atom');
+ }
+
+ // swiped from MessageAction. Should it be place in util.php?
+ function notify($from, $to, $message) {
+ mail_notify_message($message, $from, $to);
+ # XXX: Jabber, SMS notifications... probably queued
+ }
+
+}