summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-25 18:45:32 -0500
committerEvan Prodromou <evan@status.net>2010-02-25 18:45:32 -0500
commit4aa82f75ed692e254c573096168e1cd7c0890ac6 (patch)
tree9fb87849f1f09c69c1c8e1a7c93d76fa283d5330 /plugins
parent6578e0e1afed8e8738bbcb31d200927e10074f11 (diff)
parente254c660f66e1a04ac18220c95ef47aa88117e3c (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/actions/ostatussub.php14
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php40
2 files changed, 39 insertions, 15 deletions
diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php
index 12832cdcf..aae22f868 100644
--- a/plugins/OStatus/actions/ostatussub.php
+++ b/plugins/OStatus/actions/ostatussub.php
@@ -333,10 +333,18 @@ class OStatusSubAction extends Action
$group = $this->oprofile->localGroup();
if ($user->isMember($group)) {
$this->showForm(_m('Already a member!'));
- } elseif (Group_member::join($this->oprofile->group_id, $user->id)) {
- $this->successGroup();
+ return;
+ }
+ if (Event::handle('StartJoinGroup', array($group, $user))) {
+ $ok = Group_member::join($this->oprofile->group_id, $user->id);
+ if ($ok) {
+ Event::handle('EndJoinGroup', array($group, $user));
+ $this->successGroup();
+ } else {
+ $this->showForm(_m('Remote group join failed!'));
+ }
} else {
- $this->showForm(_m('Remote group join failed!'));
+ $this->showForm(_m('Remote group join aborted!'));
}
} else {
$local = $this->oprofile->localProfile();
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 300e38c05..f23017077 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -162,7 +162,7 @@ class Ostatus_profile extends Memcached_DataObject
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'gif' => 'image/gif');
- $extension = pathinfo(parse_url($avatarHref, PHP_URL_PATH), PATHINFO_EXTENSION);
+ $extension = pathinfo(parse_url($object->avatar, PHP_URL_PATH), PATHINFO_EXTENSION);
if (isset($map[$extension])) {
// @fixme this ain't used/saved yet
$object->avatarType = $map[$extension];
@@ -332,6 +332,9 @@ class Ostatus_profile extends Memcached_DataObject
*/
public function unsubscribe() {
$feedsub = FeedSub::staticGet('uri', $this->feeduri);
+ if (!$feedsub) {
+ return true;
+ }
if ($feedsub->sub_state == 'active') {
return $feedsub->unsubscribe();
} else if ($feedsub->sub_state == '' || $feedsub->sub_state == 'inactive' || $feedsub->sub_state == 'unsubscribe') {
@@ -356,7 +359,7 @@ class Ostatus_profile extends Memcached_DataObject
$count = $this->localProfile()->subscriberCount();
}
if ($count == 0) {
- common_log(LOG_INFO, "Unsubscribing from now-unused remote feed $oprofile->feeduri");
+ common_log(LOG_INFO, "Unsubscribing from now-unused remote feed $this->feeduri");
$this->unsubscribe();
return true;
} else {
@@ -638,7 +641,9 @@ class Ostatus_profile extends Memcached_DataObject
'uri' => $sourceUri,
'rendered' => $rendered,
'replies' => array(),
- 'groups' => array());
+ 'groups' => array(),
+ 'tags' => array());
+
// Check for optional attributes...
@@ -673,6 +678,16 @@ class Ostatus_profile extends Memcached_DataObject
}
}
+ // Atom categories <-> hashtags
+ foreach ($activity->categories as $cat) {
+ if ($cat->term) {
+ $term = common_canonical_tag($cat->term);
+ if ($term) {
+ $options['tags'][] = $term;
+ }
+ }
+ }
+
try {
$saved = Notice::saveNew($oprofile->profile_id,
$content,
@@ -1083,8 +1098,8 @@ class Ostatus_profile extends Memcached_DataObject
if ($object->type == ActivityObject::PERSON) {
$profile = new Profile();
+ $profile->created = common_sql_now();
self::updateProfile($profile, $object, $hints);
- $profile->created = common_sql_now();
$oprofile->profile_id = $profile->insert();
if (!$oprofile->profile_id) {
@@ -1092,6 +1107,7 @@ class Ostatus_profile extends Memcached_DataObject
}
} else {
$group = new User_group();
+ $group->uri = $homeuri;
$group->created = common_sql_now();
self::updateGroup($group, $object, $hints);
@@ -1171,19 +1187,19 @@ class Ostatus_profile extends Memcached_DataObject
{
$orig = clone($group);
- // @fixme need to make nick unique etc *hack hack*
$group->nickname = self::getActivityObjectNickname($object, $hints);
$group->fullname = $object->title;
- // @fixme no canonical profileurl; using homepage instead for now
- $group->homepage = $object->id;
+ if (!empty($object->link)) {
+ $group->mainpage = $object->link;
+ } else if (array_key_exists('profileurl', $hints)) {
+ $group->mainpage = $hints['profileurl'];
+ }
- // @fixme homepage
- // @fixme bio
- // @fixme tags/categories
- // @fixme location?
// @todo tags from categories
- // @todo lat/lon/location?
+ $group->description = self::getActivityObjectBio($object, $hints);
+ $group->location = self::getActivityObjectLocation($object, $hints);
+ $group->homepage = self::getActivityObjectHomepage($object, $hints);
if ($group->id) {
common_log(LOG_DEBUG, "Updating OStatus group $group->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true));