+/**
+ * @brief Updates the gcontact table with actor data from the conversation
+ *
+ * @param object $actor The actor object that contains the contact data
+ */
+function ostatus_conv_fetch_actor($actor) {
+
+ // We set the generation to "3" since the data here is not as reliable as the data we get on other occasions
+ $contact = array("network" => NETWORK_OSTATUS, "generation" => 3);
+
+ if (isset($actor->url))
+ $contact["url"] = $actor->url;
+
+ if (isset($actor->displayName))
+ $contact["name"] = $actor->displayName;
+
+ if (isset($actor->portablecontacts_net->displayName))
+ $contact["name"] = $actor->portablecontacts_net->displayName;
+
+ if (isset($actor->portablecontacts_net->preferredUsername))
+ $contact["nick"] = $actor->portablecontacts_net->preferredUsername;
+
+ if (isset($actor->id))
+ $contact["alias"] = $actor->id;
+
+ if (isset($actor->summary))
+ $contact["about"] = $actor->summary;
+
+ if (isset($actor->portablecontacts_net->note))
+ $contact["about"] = $actor->portablecontacts_net->note;
+
+ if (isset($actor->portablecontacts_net->addresses->formatted))
+ $contact["location"] = $actor->portablecontacts_net->addresses->formatted;
+
+
+ if (isset($actor->image->url))
+ $contact["photo"] = $actor->image->url;
+
+ if (isset($actor->image->width))
+ $avatarwidth = $actor->image->width;
+
+ if (is_array($actor->status_net->avatarLinks))
+ foreach ($actor->status_net->avatarLinks AS $avatar) {
+ if ($avatarsize < $avatar->width) {
+ $contact["photo"] = $avatar->url;
+ $avatarsize = $avatar->width;
+ }
+ }
+
+ update_gcontact($contact);
+}
+
+