Skip to content

Commit

Permalink
Fetch and store the gateway prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Apr 2, 2017
1 parent e09e674 commit 44567f9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/widgets/Roster/Roster.php
Expand Up @@ -5,6 +5,7 @@
use Moxl\Xec\Action\Roster\RemoveItem;
use Moxl\Xec\Action\Presence\Subscribe;
use Moxl\Xec\Action\Presence\Unsubscribe;
use Moxl\Xec\Action\IqGateway;

class Roster extends \Movim\Widget\Base
{
Expand All @@ -16,6 +17,7 @@ function load()
$this->registerEvent('roster_additem_handle', 'onAdd');
$this->registerEvent('roster_removeitem_handle', 'onDelete');
$this->registerEvent('roster_updateitem_handle', 'onUpdate');
$this->registerEvent('iqgateway_get_handle', 'onIqGatewayGet');
$this->registerEvent('roster', 'onChange');
$this->registerEvent('presence', 'onPresence', 'contacts');
}
Expand Down Expand Up @@ -64,6 +66,15 @@ function onRoster()
$this->onUpdate();
}

function onIqGatewayGet($packet)
{
if(!isset($this->_iqGateway)) {
$this->_iqGateway = array();
}

$this->_iqGateway[$packet->from] = $packet->content;
}

/**
* @brief Force the roster refresh
* @returns
Expand Down Expand Up @@ -103,6 +114,11 @@ function ajaxDisplaySearch($jid = null)
if($jid === null) {
$gateways = $this->gateways();
$view->assign('gateways', $gateways);

foreach($gateways as $gateway => $caps) {
$get = new IqGateway\Get();
$get->setTo($gateway)->request();
}
}

Dialog::fill($view->draw('_roster_search', true));
Expand Down

0 comments on commit 44567f9

Please sign in to comment.