//return self::import_comment($importer, $sender, $fields);
case "conversation":
- return self::import_conversation($importer, $fields);
+ return true;
+ //return self::import_conversation($importer, $fields);
case "like":
return true;
return self::import_retraction($importer, $fields);
case "status_message":
- return true;
- //return self::import_status_message($importer, $fields, $msg, $data2);
+ //return true;
+ return self::import_status_message($importer, $fields);
default:
logger("Unknown message type ".$type);
}
// Only some message types have signatures. So we quit here for the other types.
- if (!in_array($type, array("comment", "conversation", "message", "like")))
+ if (!in_array($type, array("comment", "message", "like")))
return true;
// No author_signature? This is a must, so we quit.
$messages = $xml->message;
if(! count($messages)) {
- logger('diaspora_conversation: empty conversation');
+ logger('empty conversation');
return;
}
$author = notags(unxmlify($data->author));
// likes on comments aren't supported by Diaspora - only on posts
- if ($parent_type !== "Post")
- return false;
-
- // "positive" = "false" would be a Dislike - wich isn't currently supported by Diaspora
- if ($positive === "false") {
+ // But maybe this will be supported in the future, so we will accept it.
+ if (!in_array($parent_type, array("Post", "Comment")))
return false;
- }
$contact = self::get_allowed_contact_by_handle($importer, $sender, true);
if (!$contact)
// Fetch the contact id - if we know this contact
$author_contact = self::get_author_contact_by_url($contact, $person, $importer["uid"]);
+ // "positive" = "false" would be a Dislike - wich isn't currently supported by Diaspora
+ // We would accept this anyhow.
+ if ($positive === "true")
+ $verb = ACTIVITY_LIKE;
+ else
+ $verb = ACTIVITY_DISLIKE;
+
$datarray = array();
$datarray["uid"] = $importer["uid"];
$datarray["uri"] = $author.":".$guid;
$datarray["type"] = "activity";
- $datarray["verb"] = ACTIVITY_LIKE;
+ $datarray["verb"] = $verb;
$datarray["gravity"] = GRAVITY_LIKE;
$datarray["parent-uri"] = $parent_item["uri"];
$created_at = notags(unxmlify($data->created_at));
$provider_display_name = notags(unxmlify($data->provider_display_name));
+ /// @todo enable support for polls
+ if ($data->poll) {
+ foreach ($data->poll AS $poll)
+ print_r($poll);
+ die("poll!\n");
+ }
$contact = self::get_allowed_contact_by_handle($importer, $author, false);
if (!$contact)
return false;
- if (self::message_exists($importer["uid"], $guid))
- return false;
-
- /// @todo enable support for polls
- // if ($data->poll) {
- // print_r($data->poll);
- // die("poll!\n");
- // }
+ //if (self::message_exists($importer["uid"], $guid))
+ // return false;
$address = array();
if ($data->location)
$body = diaspora2bb($raw_message);
if ($data->photo)
- for ($i = 0; $i < count($data->photo); $i++)
- $body = "[img]".$data->photo[$i]->remote_photo_path.$data->photo[$i]->remote_photo_name."[/img]\n".$body;
+ foreach ($data->photo AS $photo)
+ $body = "[img]".$photo->remote_photo_path.$photo->remote_photo_name."[/img]\n".$body;
$datarray = array();