1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- defined('GNUSOCIAL') || die();
- class SearchSubUntrackCommand extends Command
- {
- public $keyword = null;
- public function __construct($user, $keyword)
- {
- parent::__construct($user);
- $this->keyword = $keyword;
- }
- public function handle($channel)
- {
- $cur = $this->user;
- $searchsub = SearchSub::pkeyGet(array('search' => $this->keyword,
- 'profile_id' => $cur->id));
- if (!$searchsub) {
-
-
- $channel->error($cur, sprintf(_m('You are not tracking the search "%s".'), $this->keyword));
- return;
- }
- try {
- SearchSub::cancel($cur->getProfile(), $this->keyword);
- } catch (Exception $e) {
-
-
- $channel->error($cur, sprintf(
- _m('Could not end a search subscription for query "%s".'),
- $this->keyword
- ));
- return;
- }
-
-
- $channel->output($cur, sprintf(
- _m('You are no longer subscribed to the search "%s".'),
- $this->keyword
- ));
- }
- }
|