diff --git a/plugins/addons/mailqueue/class_parseMailQueue.inc b/plugins/addons/mailqueue/class_parseMailQueue.inc
index eabba97a7d64893a8f0eb612d0bd8f4d3b43d85d..b510cb3a7922294a90df9393a88cbb1cbf2efade 100644 (file)
/* Contructor
* $s_data specifies the data that shuold be parse
*/
- function parseMailQueue($s_data)
+ function parseMailQueue($s_data,$server)
{
$this->s_dataToParse = $s_data;
- $this->_parse();
+ $this->a_parsedData = array();
+ $this->_parse($s_data,$server);
}
/* Only keep entries that contains the $filter
* in any of the given $fields
*/
- function Search($filter,$fields)
+ function Search($filter,$fields,$bool = false)
{
/* Go through all entries */
foreach($this->a_parsedData as $key => $data){
$found = false;
foreach($fields as $attr){
- if(preg_match("/".str_replace("*",".*",$filter)."/i",$data[$attr])){
+ if(($bool)&&($data[$attr]==$filter)){
+ $found = true;
+ }elseif(preg_match("/".str_replace("*",".*",$filter)."/i",$data[$attr])){
$found= true;
}
}
function OrderBy($str = "Arrival",$type = "up" )
{
$tmp = array();
-
/* If the given field is not valid */
- if(!in_array($str,array("MailID","Size","Sender","Recipient","Arrival","Error"))){
+ if(!in_array($str,array("MailID","Size","Sender","Recipient","Arrival","Error","Server"))){
return(false);
}
for($i = strlen($data['Size']); $i < 10 ; $i++ ){
$struse .="0";
}
- $struse .= $data[$str].$data['MailID'];
+ $struse .= $data[$str].$data['MailID'].$data['Server'];
$tmp[$struse]= $data;
}
}else{
foreach($this->a_parsedData as $data){
- $tmp[strtolower($data[$str]).$data['MailID']]= $data;
+ $tmp[strtolower($data[$str]).$data['MailID']."-".$data['Server']]= $data;
}
}
ksort($tmp);
}
$this->a_parsedData = array();
foreach($tmp as $data){
- $this->a_parsedData[$data['MailID']] = $data;
+ $this->a_parsedData[$data['MailID']."-".$data['Server']] = $data;
}
+ return(true);
}
function GetAll()
/* Checks if the given MailID exists */
function IDExists($id)
{
- return(((isset($this->a_parsedData[$id]))&&(is_array($this->a_parsedData[$id]))));
+ foreach($this->a_parsedData as $entry){
+ if($entry['MailID'] == $id) return(true);
+ }
+ return(false);
+ }
+
+ function parseAdditionalQueue($str, $server)
+ {
+ $this->_parse($str, $server);
}
/* This function parses the given data
* it creates an array with all given queue entries
*/
- function _parse()
+ function _parse($str, $server)
{
$i = 0; // Temp var
$entries = array(); // Contains an array with the raw data for every single entry
/* Remove header
*/
- $this->s_dataToParse = preg_replace("/^.*------\n/","",$this->s_dataToParse);
+ $this->s_dataToParse = preg_replace("/^.*------\n/","",$str);
/* Create array with single entries
*/
$s_Error = $s_buffer[1];
$s_Recipient = $s_buffer[2];
+ /*
+ * The message is in the active queue, i.e. the message is
+ selected for delivery.
+
+ ! The message is in the hold queue, i.e. no further deliv-delivery
+ ery attempt will be made until the mail is taken off
+ hold.
+ */
+
+ $s_Hold = false;
+ if(preg_match("/\!/",$s_mailID)){
+ $s_mailID = preg_replace("/\!/","",$s_mailID);
+ $s_Hold = "true";
+ }
+
+ $s_Active = false;
+ if(preg_match("/\*/",$s_mailID)){
+ $s_mailID = preg_replace("/\*/","",$s_mailID);
+ $s_Active = true;
+ }
+
/* Append data */
- $this->a_parsedData[$s_mailID]['MailID'] = $s_mailID;
- $this->a_parsedData[$s_mailID]['Size'] = $s_Size;
- $this->a_parsedData[$s_mailID]['Arrival'] = $s_Arrival;
- $this->a_parsedData[$s_mailID]['Sender'] = $s_Sender;
- $this->a_parsedData[$s_mailID]['Recipient'] = $s_Recipient;
- $this->a_parsedData[$s_mailID]['Error'] = $this->_parseError($s_Error);
+ $this->a_parsedData[$s_mailID."-".$server]['Server'] = $server;
+ $this->a_parsedData[$s_mailID."-".$server]['MailID'] = $s_mailID;
+ $this->a_parsedData[$s_mailID."-".$server]['Size'] = $s_Size;
+ $this->a_parsedData[$s_mailID."-".$server]['Arrival'] = $s_Arrival;
+ $this->a_parsedData[$s_mailID."-".$server]['Sender'] = $s_Sender;
+ $this->a_parsedData[$s_mailID."-".$server]['Recipient'] = $s_Recipient;
+ $this->a_parsedData[$s_mailID."-".$server]['Hold'] = $s_Hold;
+ $this->a_parsedData[$s_mailID."-".$server]['Active'] = $s_Active;
+ $this->a_parsedData[$s_mailID."-".$server]['Error'] = $this->_parseError($s_Error);
}
return($this->a_parsedData);
}