namespace Friendica\Model;
use Friendica\Database\DBA;
-use Friendica\Database\DBM;
+use Friendica\Util\DateTimeFormat;
require_once "include/dba.php";
class Conversation
{
- const PROTOCOL_UNKNOWN = 0;
- const PROTOCOL_DFRN = 1;
- const PROTOCOL_DIASPORA = 2;
- const PROTOCOL_OSTATUS_SALMON = 3;
- const PROTOCOL_OSTATUS_FEED = 4; // Deprecated
- const PROTOCOL_GS_CONVERSATION = 5; // Deprecated
- const PROTOCOL_SPLITTED_CONV = 6;
+ /*
+ * These constants represent the parcel format used to transport a conversation independently of the message protocol.
+ * It currently is stored in the "protocol" field for legacy reasons.
+ */
+ const PARCEL_UNKNOWN = 0;
+ const PARCEL_DFRN = 1;
+ const PARCEL_DIASPORA = 2;
+ const PARCEL_SALMON = 3;
+ const PARCEL_FEED = 4; // Deprecated
+ const PARCEL_SPLIT_CONVERSATION = 6;
/**
* @brief Store the conversation data
*/
public static function insert($arr) {
if (in_array(defaults($arr, 'network', NETWORK_PHANTOM), [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && !empty($arr['uri'])) {
- $conversation = ['item-uri' => $arr['uri'], 'received' => DBM::date()];
+ $conversation = ['item-uri' => $arr['uri'], 'received' => DateTimeFormat::utcNow()];
if (isset($arr['parent-uri']) && ($arr['parent-uri'] != $arr['uri'])) {
$conversation['reply-to-uri'] = $arr['parent-uri'];
$fields = ['item-uri', 'reply-to-uri', 'conversation-uri', 'conversation-href', 'protocol', 'source'];
$old_conv = DBA::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
- if (DBM::is_result($old_conv)) {
+ if (DBA::isResult($old_conv)) {
// Don't update when only the source has changed.
// Only do this when there had been no source before.
if ($old_conv['source'] != '') {