-- ------------------------------------------
-- Friendica 2020.03-dev (Dalmatian Bellflower)
--- DB_UPDATE_VERSION 1334
+-- DB_UPDATE_VERSION 1335
-- ------------------------------------------
`conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
`conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
`protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
+ `direction` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'How the message arrived here: 1=push, 2=pull',
`source` mediumtext COMMENT 'Original source',
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
PRIMARY KEY(`item-uri`),
const PARCEL_TWITTER = 67;
const PARCEL_UNKNOWN = 255;
+ /**
+ * Unknown message direction
+ */
+ const UNKNOWN = 0;
+ /**
+ * The message had been pushed to this sytem
+ */
+ const PUSH = 1;
+ /**
+ * The message had been fetched by our system
+ */
+ const PULL = 2;
+
public static function getByItemUri($item_uri)
{
return DBA::selectFirst('conversation', [], ['item-uri' => $item_uri]);
$conversation['protocol'] = $arr['protocol'];
}
+ if (isset($arr['direction'])) {
+ $conversation['direction'] = $arr['direction'];
+ }
+
if (isset($arr['source'])) {
$conversation['source'] = $arr['source'];
}
}
if (isset($activity['push'])) {
- $push_app = $activity['push'] ? '📨' : '🚜';
- if (!empty($item['app'])) {
- $item['app'] .= ' (' . $push_app . ')';
- } else {
- $item['app'] .= $push_app;
- }
+ $item['direction'] = $activity['push'] ? Conversation::PUSH : Conversation::PULL;
}
$item['plink'] = $activity['alternate-url'] ?? $item['uri'];
/**
* Prepare the object array
*
- * @param array $activity
- * @param integer $uid User ID
- * @param $trust_source
+ * @param array $activity Array with activity data
+ * @param integer $uid User ID
+ * @param boolean $push Message had been pushed to our system
+ * @param boolean $trust_source Do we trust the source?
*
* @return array with object data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @param string $body
* @param integer $uid User ID
* @param boolean $trust_source Do we trust the source?
+ * @param boolean $push Message had been pushed to our system
* @throws \Exception
*/
public static function processActivity($activity, $body = '', $uid = null, $trust_source = false, $push = false)
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1334);
+ define('DB_UPDATE_VERSION', 1335);
}
return [
"conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation URI"],
"conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation link"],
"protocol" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "255", "comment" => "The protocol of the item"],
+ "direction" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "How the message arrived here: 1=push, 2=pull"],
"source" => ["type" => "mediumtext", "comment" => "Original source"],
"received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Receiving date"],
],