Skip to content

Commit

Permalink
Don't send implicit poll information to smartmobile
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Mar 7, 2014
1 parent b703dac commit 52230a4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
3 changes: 2 additions & 1 deletion imp/lib/Ajax/Application.php
Expand Up @@ -116,7 +116,8 @@ protected function _init()
$this->queue->poll(
empty($poll)
? $injector->getInstance('IMP_Ftree')->poll->getPollList()
: IMP_Mailbox::formFrom($poll)
: IMP_Mailbox::formFrom($poll),
true
);
}
}
Expand Down
5 changes: 4 additions & 1 deletion imp/lib/Ajax/Application/Handler/Smartmobile.php
Expand Up @@ -31,6 +31,9 @@ public function __construct(Horde_Core_Ajax_Application $base)

/* Disable quota - not used in smartmobile for now. */
$base->queue->quota(null);

/* Disable implicit polling - not used in smartmobile for now. */
$base->queue->poll(null);
}

/**
Expand Down Expand Up @@ -78,7 +81,7 @@ public function smartmobileFolderTree()
$ftree = $GLOBALS['injector']->getInstance('IMP_Ftree');

/* Poll all mailboxes on initial display. */
$this->_base->queue->poll($ftree->poll->getPollList());
$this->_base->queue->poll($ftree->poll->getPollList(), true);

$iterator = new AppendIterator();

Expand Down
24 changes: 20 additions & 4 deletions imp/lib/Ajax/Queue.php
Expand Up @@ -90,6 +90,8 @@ class IMP_Ajax_Queue
/**
* Poll mailboxes.
*
* If null, don't output polled information unless explicitly told to.
*
* @var array
*/
protected $_poll = array();
Expand Down Expand Up @@ -269,8 +271,10 @@ public function add(IMP_Ajax_Application $ajax)

/* Add poll information. */
$poll = $poll_list = array();
foreach ($this->_poll as $val) {
$poll_list[strval($val)] = 1;
if (!empty($this->_poll)) {
foreach ($this->_poll as $val) {
$poll_list[strval($val)] = 1;
}
}

if (count($poll_list)) {
Expand Down Expand Up @@ -528,10 +532,22 @@ public function setMailboxOpt($name, $value)
/**
* Add poll entry to response queue.
*
* @param mixed $mboxes A mailbox name or list of mailbox names.
* @param mixed $mboxes A mailbox name or list of mailbox names.
* @param boolean $explicit If true, explicitly output poll information.
* Otherwise, add only if not disabled.
*/
public function poll($mboxes)
public function poll($mboxes, $explicit = false)
{
if (is_null($this->_poll)) {
if (!$explicit) {
return;
}
$this->_poll = array();
} elseif (empty($this->_poll) && is_null($mboxes)) {
$this->_poll = null;
return;
}

if (!is_array($mboxes)) {
$mboxes = array($mboxes);
}
Expand Down

0 comments on commit 52230a4

Please sign in to comment.