/** * Notify remote user that a people tag has been removed * - untag verb is queued * - the subscription is undone immediately if not required * i.e garbageCollect()'d * * @param Profile_tag $ptag the people tag that was deleted * @return hook return value */ function onEndUntagProfile($ptag) { $oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged); if (empty($oprofile)) { return true; } $plist = $ptag->getMeta(); if ($plist->private) { return true; } $act = new Activity(); $tagger = $plist->getTagger(); $tagged = Profile::staticGet('id', $ptag->tagged); $act->verb = ActivityVerb::UNTAG; $act->id = TagURI::mint('untag_profile:%d:%d:%s', $plist->tagger, $plist->id, common_date_iso8601(time())); $act->time = time(); // TRANS: Title for unlisting a remote profile. $act->title = _m('TITLE', 'Unlist'); // TRANS: Success message for remote list removal through OStatus. // TRANS: %1$s is the list creator's name, %2$s is the removed list member, %3$s is the list name. $act->content = sprintf(_m('%1$s removed %2$s from the list %3$s.'), $tagger->getBestName(), $tagged->getBestName(), $plist->getBestName()); $act->actor = ActivityObject::fromProfile($tagger); $act->objects = array(ActivityObject::fromProfile($tagged)); $act->target = ActivityObject::fromPeopletag($plist); $oprofile->notifyDeferred($act, $tagger); // unsubscribe to PuSH feed if no more required $oprofile->garbageCollect(); return true; }