Skip to content

Commit

Permalink
Using a bit more fail save uid / msgNo by calling imap_msgno()
Browse files Browse the repository at this point in the history
  • Loading branch information
Webklex committed Sep 5, 2017
1 parent b79d44c commit 7af28d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/IMAP/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ public function setConfig(array $config) {
return $this;
}

/**
* Get the current imap resource
*
* @return resource
*/
public function getConnection(){
return $this->connection;
}

/**
* Set read only property and reconnect if it's necessary.
*
Expand Down
4 changes: 2 additions & 2 deletions src/IMAP/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class Message {
* @param $fetch_options
*/
public function __construct($uid, $msglist, Client $client, $fetch_options = null) {
$this->uid = $uid;
$this->msglist = $msglist;
$this->client = $client;
$this->uid = imap_msgno($this->client->getConnection(), $uid);

$this->setFetchOption($fetch_options);
$this->parseHeader();
Expand Down Expand Up @@ -258,7 +258,7 @@ private function parseHeader() {
$this->message_id = str_replace(['<', '>'], '', $header->message_id);
}
if (property_exists($header, 'Msgno')) {
$this->message_no = trim($header->Msgno);
$this->message_no = imap_msgno($this->client->getConnection(), trim($header->Msgno));
}
}

Expand Down

0 comments on commit 7af28d2

Please sign in to comment.