return $xs->getString();
}
+ /**
+ * Extra profile info for atom entries
+ *
+ * Clients use some extra profile info in the atom stream.
+ * This gives it to them.
+ *
+ * @param User $cur Current user
+ *
+ * @return array representation of <statusnet:profile_info> element
+ */
+
+ function profileInfo($cur)
+ {
+ $profileInfoAttr = array();
+
+ if ($cur != null) {
+ // Whether the current user is a subscribed to this profile
+ $profileInfoAttr['following'] = $cur->isSubscribed($this) ? 'true' : 'false';
+ // Whether the current user is has blocked this profile
+ $profileInfoAttr['blocking'] = $cur->hasBlocked($this) ? 'true' : 'false';
+ }
+
+ return array('statusnet:profile_info', $profileInfoAttr, null);
+ }
+
/**
* Returns an XML string fragment with profile information as an
* Activity Streams <activity:actor> element.
if ($author) {
$this->actor->outputTo($xs, 'author');
+
+ // XXX: Remove <activity:actor> ASAP! Author information
+ // has been moved to the author element in the Activity
+ // Streams spec. We're outputting actor only for backward
+ // compatibility with clients that can only parse
+ // activities based on older versions of the spec.
+
+ $depMsg = 'Deprecation warning: activity:actor is present '
+ . 'only for backward compatibility. It will be '
+ . 'removed in the next version of StatusNet.';
+ $xs->comment($depMsg);
+ $this->actor->outputTo($xs, 'activity:actor');
}
if ($this->verb != ActivityVerb::POST || count($this->objects) != 1) {
$ao = ActivityObject::fromGroup($group);
- $this->addAuthorRaw($ao->asString('author').
- $ao->asString('activity:subject'));
+ $this->addAuthorRaw($ao->asString('author'));
+
+ $depMsg = 'Deprecation warning: activity:subject is present '
+ . 'only for backward compatibility. It will be '
+ . 'removed in the next version of StatusNet.';
+
+ $this->addAuthorRaw(
+ "<!--$depMsg-->\n"
+ . $ao->asString('activity:subject')
+ );
$this->addLink($group->homeUrl());
}
parent::__construct($cur, $indent);
$this->user = $user;
if (!empty($user)) {
+
$profile = $user->getProfile();
+
$ao = ActivityObject::fromProfile($profile);
+
+ $ao->extra[] = $profile->profileInfo($cur);
+
+ // XXX: For users, we generate an author _AND_ an <activity:subject>
+ // This is for backward compatibility with clients (especially
+ // StatusNet's clients) that assume the Atom will conform to an
+ // older version of the Activity Streams API. Subject should be
+ // removed in future versions of StatusNet.
+
$this->addAuthorRaw($ao->asString('author'));
+
+ $depMsg = 'Deprecation warning: activity:subject is present '
+ . 'only for backward compatibility. It will be '
+ . 'removed in the next version of StatusNet.';
+
+ $this->addAuthorRaw(
+ "<!--$depMsg-->\n"
+ . $ao->asString('activity:subject')
+ );
}
// TRANS: Title in atom user notice feed. %s is a user name.