summaryrefslogtreecommitdiff
path: root/xmppdaemon.php
diff options
context:
space:
mode:
Diffstat (limited to 'xmppdaemon.php')
-rwxr-xr-xxmppdaemon.php31
1 files changed, 3 insertions, 28 deletions
diff --git a/xmppdaemon.php b/xmppdaemon.php
index d9b706454..7977dc804 100755
--- a/xmppdaemon.php
+++ b/xmppdaemon.php
@@ -223,36 +223,11 @@ class XMPPDaemon {
}
function add_notice(&$user, &$pl) {
- $notice = new Notice();
- $notice->is_local = 1;
- $notice->profile_id = $user->id;
- $notice->content = trim(substr($pl['body'], 0, 140));
- $notice->rendered = common_render_content($notice->content, $notice);
- $notice->created = DB_DataObject_Cast::dateTime();
- $notice->query('BEGIN');
- $id = $notice->insert();
- if (!$id) {
- $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
- $this->log(LOG_ERR,
- 'Could not insert ' . common_log_objstring($notice) .
- ' for user ' . common_log_objstring($user) .
- ': ' . $last_error->message);
- return;
- }
- $orig = clone($notice);
- $notice->uri = common_notice_uri($notice);
- $result = $notice->update($orig);
- if (!$result) {
- $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
- $this->log(LOG_ERR,
- 'Could not add URI to ' . common_log_objstring($notice) .
- ' for user ' . common_log_objstring($user) .
- ': ' . $last_error->message);
+ $notice = Notice::saveNew($user->id, trim(substr($pl['body'], 0, 140)), 'xmpp');
+ if (is_string($notice)) {
+ $this->log(LOG_ERR, $notice);
return;
}
- $notice->query('COMMIT');
- common_save_replies($notice);
- $notice->saveTags();
common_real_broadcast($notice);
$this->log(LOG_INFO,
'Added notice ' . $notice->id . ' from user ' . $user->nickname);