3 * StatusNet, the distributed open-source microblogging tool
5 * Show/add/remove list subscribers.
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
25 * @link http://status.net/
28 if (!defined('STATUSNET')) {
32 require_once INSTALLDIR . '/lib/apilistusers.php';
34 class ApiListSubscribersAction extends ApiListUsersAction
39 * @return boolean success
43 $result = Profile_tag_subscription::add($this->list,
48 // TRANS: Client error displayed when an unknown error occurs in the list subscribers action.
49 _('An error occured.'),
56 switch($this->format) {
58 $this->showSingleXmlList($this->list);
61 $this->showSingleJsonList($this->list);
65 // TRANS: Client error displayed when coming across a non-supported API method.
66 _('API method not found.'),
75 function handleDelete()
77 $args = array('profile_tag_id' => $this->list->id,
78 'profile_id' => $this->auth_user->id);
79 $ptag = Profile_tag_subscription::pkeyGet($args);
83 // TRANS: Client error displayed when trying to unsubscribe from a non-subscribed list.
84 _('You are not subscribed to this list.'),
91 Profile_tag_subscription::remove($this->list, $this->auth_user);
95 // TRANS: Client error displayed when an unknown error occurs unsubscribing from a list.
96 _('An error occured.'),
103 switch($this->format) {
105 $this->showSingleXmlList($this->list);
108 $this->showSingleJsonList($this->list);
112 // TRANS: Client error displayed when coming across a non-supported API method.
113 _('API method not found.'),
125 $fn = array($this->list, 'getSubscribers');
126 list($this->users, $this->next_cursor, $this->prev_cursor) =
127 Profile_list::getAtCursor($fn, array(), $this->cursor, 20);