summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-11 11:38:08 -0500
committerEvan Prodromou <evan@status.net>2009-12-11 11:38:08 -0500
commit60754fc6de8f73b3e74dbec30d91fffe11b094c6 (patch)
tree168dff88fe89417b22cd28efbde54b36b018407c
parent81843f2acd5375a9072d091fd58c6a6af079295e (diff)
parent89256fa754c1e03b822b8eeac388cc822b3c58ca (diff)
Merge branch '0.9.x' into forward
-rw-r--r--actions/apistatusesupdate.php29
-rw-r--r--actions/newnotice.php10
-rw-r--r--classes/Notice.php15
-rw-r--r--lib/command.php5
-rw-r--r--lib/oauthstore.php5
-rw-r--r--plugins/Facebook/facebookaction.php5
6 files changed, 42 insertions, 27 deletions
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index 85a7c8c08..dabbea92f 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -231,19 +231,22 @@ class ApiStatusesUpdateAction extends ApiAuthAction
}
}
- $this->notice = Notice::saveNew(
- $this->user->id,
- html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'),
- $this->source,
- 1,
- $reply_to,
- null,
- null,
- empty($location) ? null : $location->lat,
- empty($location) ? null : $location->lon,
- empty($location) ? null : $location->location_id,
- empty($location) ? null : $location->location_ns
- );
+ $content = html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8');
+
+ $options = array('reply_to' => $reply_to);
+
+ if (!empty($location)) {
+ $options['lat'] = $location->lat;
+ $options['lon'] = $location->lon;
+ $options['location_id'] = $location->location_id;
+ $options['location_ns'] = $location->location_ns;
+ }
+
+ $this->notice =
+ Notice::saveNew($this->user->id,
+ $content,
+ $this->source,
+ $options);
if (isset($upload)) {
$upload->attachToNotice($this->notice);
diff --git a/actions/newnotice.php b/actions/newnotice.php
index dd6da0b01..c6c70e326 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -187,10 +187,12 @@ class NewnoticeAction extends Action
}
}
- $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
- ($replyto == 'false') ? null : $replyto,
- null, null,
- $lat, $lon, $location_id, $location_ns);
+ $notice = Notice::saveNew($user->id, $content_shortened, 'web',
+ array('reply_to' => ($replyto == 'false') ? null : $replyto,
+ 'lat' => $lat,
+ 'lon' => $lon,
+ 'location_id' => $location_id,
+ 'location_ns' => $location_ns));
if (isset($upload)) {
$upload->attachToNotice($notice);
diff --git a/classes/Notice.php b/classes/Notice.php
index 0a2f16271..228201188 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -169,9 +169,18 @@ class Notice extends Memcached_DataObject
}
}
- static function saveNew($profile_id, $content, $source=null,
- $is_local=Notice::LOCAL_PUBLIC, $reply_to=null, $uri=null, $created=null,
- $lat=null, $lon=null, $location_id=null, $location_ns=null) {
+ static function saveNew($profile_id, $content, $source, $options=null) {
+
+ if (!empty($options)) {
+ extract($options);
+ if (!isset($reply_to)) {
+ $reply_to = NULL;
+ }
+ }
+
+ if (empty($is_local)) {
+ $is_local = Notice::LOCAL_PUBLIC;
+ }
$profile = Profile::staticGet($profile_id);
diff --git a/lib/command.php b/lib/command.php
index 450db9da3..085331f82 100644
--- a/lib/command.php
+++ b/lib/command.php
@@ -433,8 +433,9 @@ class ReplyCommand extends Command
return;
}
- $notice = Notice::saveNew($this->user->id, $this->text, $channel->source(), 1,
- $notice->id);
+ $notice = Notice::saveNew($this->user->id, $this->text, $channel->source(),
+ array('reply_to' => $notice->id));
+
if ($notice) {
$channel->output($this->user, sprintf(_('Reply to %s sent'), $recipient->nickname));
} else {
diff --git a/lib/oauthstore.php b/lib/oauthstore.php
index e34bf8a5e..df63cc151 100644
--- a/lib/oauthstore.php
+++ b/lib/oauthstore.php
@@ -359,9 +359,8 @@ class StatusNetOAuthDataStore extends OAuthDataStore
$notice = Notice::saveNew($author->id,
$omb_notice->getContent(),
'omb',
- false,
- null,
- $omb_notice->getIdentifierURI());
+ array('is_local' => Notice::REMOTE_OMB,
+ 'uri' => $omb_notice->getIdentifierURI()));
common_broadcast_notice($notice, true);
}
diff --git a/plugins/Facebook/facebookaction.php b/plugins/Facebook/facebookaction.php
index 705bb2780..24bf215fd 100644
--- a/plugins/Facebook/facebookaction.php
+++ b/plugins/Facebook/facebookaction.php
@@ -445,8 +445,9 @@ class FacebookAction extends Action
$replyto = $this->trimmed('inreplyto');
try {
- $notice = Notice::saveNew($user->id, $content,
- 'web', 1, ($replyto == 'false') ? null : $replyto);
+ $notice = Notice::saveNew($user->id, $content, 'web',
+ array('reply_to' => ($replyto == 'false') ? null : $replyto));
+
} catch (Exception $e) {
$this->showPage($e->getMessage());
return;