made 3 options for incomming mail: reply on ticket, new ticket and nothing related to that. When it's nothing related to that the mail will stay in the mailbox untill it get's manually read and deleted!

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-08-17 19:07:00 +02:00
parent 483045c613
commit 69192712a0
3 changed files with 30 additions and 20 deletions

View file

@ -149,18 +149,19 @@ class Mail_Handler{
for ($i = 1; $i <= $message_count; ++$i) { for ($i = 1; $i <= $message_count; ++$i) {
//return task ID //return task ID
self::incoming_mail_handler($mbox, $i,$group); $tid = self::incoming_mail_handler($mbox, $i,$group);
$tid = 1; //self::ams_create_email($from, $subject, $txt, $html, $to, $from);
if($tid) { if($tid) {
//TODO: base file on Ticket + reply id //TODO: base file on Ticket + timestamp
/* $file = fopen($MAIL_DIR."/mail/".$tid, 'w'); $file = fopen($MAIL_DIR."/mail/ticket".$tid.".".time(), 'w');
fwrite($file, $entire_email); fwrite($file, $entire_email);
fclose($file); */ fclose($file);
}
//mark message $i of $mbox for deletion! //mark message $i of $mbox for deletion!
imap_delete($mbox, $i); imap_delete($mbox, $i);
} }
}
//delete marked messages //delete marked messages
imap_expunge($mbox); imap_expunge($mbox);
imap_close($mbox); imap_close($mbox);
@ -252,14 +253,15 @@ class Mail_Handler{
if((Ticket_User::isMod($user) or ($ticket->getAuthor() == $user->getTUserId())) and $txt != ""){ if((Ticket_User::isMod($user) or ($ticket->getAuthor() == $user->getTUserId())) and $txt != ""){
Ticket::createReply($txt, $user->getTUserId(), $ticket->getTId(), 0); Ticket::createReply($txt, $user->getTUserId(), $ticket->getTId(), 0);
} }
}
}else{ }
print("\n Email found that is a reply to a ticket!\n");
return $ticket_id;
}else if($from != "FALSE"){
//if ticket_id isn't found, create a new ticket! //if ticket_id isn't found, create a new ticket!
//if an existing email address mailed the ticket //if an existing email address mailed the ticket
if($from != "FALSE"){
$newTicketId = Ticket::create_Ticket($subject, $txt,1, $from, $from); $newTicketId = Ticket::create_Ticket($subject, $txt,1, $from, $from);
@ -267,8 +269,14 @@ class Mail_Handler{
if($group->getSGroupId()){ if($group->getSGroupId()){
Ticket::forwardTicket(0, $newTicketId, $group->getSGroupId()); Ticket::forwardTicket(0, $newTicketId, $group->getSGroupId());
} }
} print("\n Email found that is a new ticket!\n");
return $newTicketId;
}else{
//if it's a email that has nothing to do with ticketing, return 0;
print("\n Email found that isn't a reply or new ticket!\n");
return 0;
} }
} }

View file

@ -42,7 +42,7 @@ $cfg['db']['ring']['pass'] = '';
// To connect to a remote server replace "localhost" with the name or the IP address of the server you want to connect to. // To connect to a remote server replace "localhost" with the name or the IP address of the server you want to connect to.
//$cfg['mail']['server'] = '{localhost:110/pop3/novalidate-cert}INBOX'; //$cfg['mail']['server'] = '{localhost:110/pop3/novalidate-cert}INBOX';
$cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX'; $cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX';
$cfg['mail']['default_groupemail'] = 'support@ryzomcore.com'; $cfg['mail']['default_groupemail'] = 'amsryzom@gmail.com';
$cfg['mail']['default_groupname'] = 'Ryzomcore Support'; $cfg['mail']['default_groupname'] = 'Ryzomcore Support';
$cfg['mail']['default_username'] = 'amsryzom@gmail.com'; $cfg['mail']['default_username'] = 'amsryzom@gmail.com';
$cfg['mail']['default_password'] = 'lol123bol'; $cfg['mail']['default_password'] = 'lol123bol';

View file

@ -81,7 +81,9 @@ class WebUsers extends Users{
$dbw = new DBLayer("web"); $dbw = new DBLayer("web");
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Email=:email", array('email' => $email)); $statement = $dbw->execute("SELECT * FROM ams_user WHERE Email=:email", array('email' => $email));
$row = $statement->fetch(); $row = $statement->fetch();
if($row !== "FALSE"){ if(!empty($row)){
print "shouldn't be here!" . $row . "seee";
return $row['UId']; return $row['UId'];
}else{ }else{
return "FALSE"; return "FALSE";