//// parse project_name, sender, bug_id and the message from the incoming mail text//require 'path/to/src/IDF/conf/path.php';require 'Pluf.php';Pluf::start('path/to/src/IDF/conf/idf.php');class UserException extends Exception {}try{ try { $project = IDF_Project::getOr404($project_name); } catch (Pluf_HTTP_Error404 $e) { throw new UserException("project $project_name not found"); } $guser = new Pluf_User(); $sql = new Pluf_SQL('login=%s', $sender); $users = $guser->getList(array('filter' => $sql->gen())); if ($users->count() != 1) { throw new UserException("user $sender not found"); } $user = $users[0]; if (!$user->active) { throw new UserException("user $sender is not active"); } $conf = new IDF_Conf(); $conf->setProject($project); $request = new StdClass(); $request->user = $user; $request->conf = $conf; $request->project = $project; if (!IDF_Precondition::accessIssues($request)) { throw new UserException("user $sender has no authorization to access the issues for $project_name"); } $gissue = new IDF_Issue(); $sql = new Pluf_SQL('id=%d AND project=%d', $bug_id, $project_id); $issues = $gissue->getList(array('filter' => $sql->gen())); if ($issues->count() != 1) { // FIXME: eventually simply create this issue anew throw new UserException("issue $bug_id not found for project $project_name"); } $issue = $issues[0]; $comment = new IDF_IssueComment(); $comment->issue = $issue; $comment->content = $message; $comment->submitter = $user; $comment->create(); // FIXME eventually parse out tag changes and set them here as well // // notify the user by email that his request was processed //}catch (UserException $e){ $msg = $e->getMessage(); // mail back to the sender of the mail that his request was not processed // eventually log this incident}catch (Exception $e){ $msg = $e->getMessage(); // mail back to the sender that some server error occurred // log this incident and inform the admins}//// delete the message file or mark it as processed//