messages() 공개 메소드

Return the list of UIDs currently on the device.
public messages ( ) : array
리턴 array The list of backend messages.
예제 #1
0
 public function testModseqUpdate()
 {
     $folder = new Horde_ActiveSync_Folder_Imap('INBOX', Horde_ActiveSync::CLASS_EMAIL);
     $status = array(Horde_ActiveSync_Folder_Imap::UIDVALIDITY => 100, Horde_ActiveSync_Folder_Imap::UIDNEXT => 105, Horde_ActiveSync_Folder_Imap::HIGHESTMODSEQ => 200);
     // Initial state
     $msg_changes = array(100, 101, 102, 103, 104);
     $flag_changes = array(100 => array('read' => 0, 'flagged' => 0), 101 => array('read' => 0, 'flagged' => 0), 102 => array('read' => 0, 'flagged' => 0), 103 => array('read' => 0, 'flagged' => 0), 104 => array('read' => 0, 'flagged' => 0));
     $folder->setChanges($msg_changes, $flag_changes);
     $this->assertEquals($msg_changes, $folder->added());
     $this->assertEquals($flag_changes, $folder->flags());
     $this->assertEquals(array(), $folder->changed());
     $this->assertEquals(array(), $folder->removed());
     $this->assertEquals(array(), $folder->messages());
     $folder->setStatus($status);
     $folder->updateState();
     $this->assertEquals(array(), $folder->added());
     $this->assertEquals(array(), $folder->flags());
     $this->assertEquals(array(), $folder->changed());
     $this->assertEquals(array(), $folder->removed());
     $this->assertEquals($msg_changes, $folder->messages());
     // Now simulate some flag changes and new messages.
     $msg_changes = array(100, 105);
     $flag_changes = array(100 => array('read' => 0, 'flagged' => 1), 105 => array('read' => 1, 'flagged' => 0));
     $folder->setChanges($msg_changes, $flag_changes);
     $this->assertEquals(array(105), $folder->added());
     $this->assertEquals(array(100), $folder->changed());
     $status[Horde_ActiveSync_Folder_Imap::UIDNEXT] = 106;
     $folder->setStatus($status);
     $folder->updateState();
 }
예제 #2
0
파일: Adapter.php 프로젝트: raz0rsdge/horde
 /**
  * Return an array of message UIDs from a list of Message-IDs.
  *
  * @param string $mid                           The Message-ID
  * @param Horde_ActiveSync_Folder_Imap $folder  The folder object to search.
  *
  * @return integer  The UID
  * @throws Horde_Exception_NotFound
  */
 public function getUidFromMid($mid, Horde_ActiveSync_Folder_Imap $folder)
 {
     $iids = new Horde_Imap_Client_Ids(array_diff($folder->messages(), $folder->removed()));
     $search_q = new Horde_Imap_Client_Search_Query();
     $search_q->ids($iids);
     $search_q->headerText('Message-ID', $mid);
     $mbox = new Horde_Imap_Client_Mailbox($folder->serverid());
     $results = $this->_getImapOb()->search($mbox, $search_q);
     $uid = $results['match']->ids;
     if (!empty($uid)) {
         return current($uid);
     }
     throw new Horde_Exception_NotFound('Message not found.');
 }