summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoel Uckelman <uckelman@nomic.net>2012-02-27 05:08:35 +0100
committerJoel Uckelman <uckelman@nomic.net>2012-02-27 05:08:35 +0100
commit809671070efe8ff29c633e9be03d0d41a5cf6560 (patch)
tree2206afee144a8141fcd22053370b9ddd0c84f5e4 /src
parent8f10606385c6e0a77177e48d4072b5eb7c52da68 (diff)
Renamed functions in build_email.php.
Diffstat (limited to 'src')
-rw-r--r--src/PhpBB3ToMailman.php12
-rw-r--r--src/build_email.php31
2 files changed, 22 insertions, 21 deletions
diff --git a/src/PhpBB3ToMailman.php b/src/PhpBB3ToMailman.php
index 08fb244..9e90b28 100644
--- a/src/PhpBB3ToMailman.php
+++ b/src/PhpBB3ToMailman.php
@@ -104,11 +104,11 @@ class PhpBB3ToMailman {
dirname($_SERVER['SCRIPT_NAME']);
$editId = $this->bridge->reserveEditId($postId);
- $messageId = build_message_id($postId, $editId,
- $time, $_SERVER['SERVER_NAME']);
+ $messageId = build_email_message_id($postId, $editId,
+ $time, $_SERVER['SERVER_NAME']);
# Assemble the message headers
- $headers = build_headers(
+ $headers = build_email_headers(
$userName,
$userEmail,
$to,
@@ -125,10 +125,10 @@ class PhpBB3ToMailman {
# Build the message body
$parser = new BBCodeParser();
$text = $parser->parse($data['message'], $data['bbcode_uid']);
- $text = build_text($text, $mode == 'edit');
+ $text = build_email_text($text, $mode == 'edit');
# Build the bridge footer
- $footer = build_footer($postId, $forumURL);
+ $footer = build_email_footer($postId, $forumURL);
$attachments = array();
foreach ($data['attachment_data'] as $a) {
@@ -146,7 +146,7 @@ class PhpBB3ToMailman {
}
# Build the message body
- $body = build_body($headers, $text, $attachments, $footer);
+ $body = build_email_body($headers, $text, $attachments, $footer);
# Register the message
$seen = !$this->bridge->registerByEditId($editId, $messageId, $inReplyTo);
diff --git a/src/build_email.php b/src/build_email.php
index cad2968..a5bb7bd 100644
--- a/src/build_email.php
+++ b/src/build_email.php
@@ -2,7 +2,7 @@
require_once(__DIR__ . '/Util.php');
-function build_text($text, $edit) {
+function build_email_text($text, $edit) {
if ($edit) {
$edit_notice = <<<EOF
[This message has been edited.]
@@ -16,7 +16,7 @@ EOF;
return $text;
}
-function build_footer($postId, $forumURL) {
+function build_email_footer($postId, $forumURL) {
$postURL = "$forumURL/viewtopic.php?p=$postId#p$postId";
$footer = <<<EOF
@@ -28,7 +28,7 @@ EOF;
return $footer;
}
-function build_body(array &$headers, $text, $attachments, $footer) {
+function build_email_body(array &$headers, $text, $attachments, $footer) {
$body = null;
# Handle attachements, if any
@@ -48,7 +48,7 @@ function build_body(array &$headers, $text, $attachments, $footer) {
$mime = new Mail_mimePart('', $params);
# Build the main body
- build_text_part($mime, $text);
+ build_email_text_part($mime, $text);
# Build each attachment
foreach ($attachments as $a) {
@@ -57,7 +57,7 @@ function build_body(array &$headers, $text, $attachments, $footer) {
throw new Exception('failed to read file: ' . $a['path']);
}
- build_attachment(
+ build_email_attachment(
$mime,
$adata['mimetype'],
$adata['real_filename'],
@@ -67,7 +67,7 @@ function build_body(array &$headers, $text, $attachments, $footer) {
}
# Build footer
- build_text_part($mime, $footer);
+ build_email_text_part($mime, $footer);
# Encode the message
$msg = $mime->encode();
@@ -78,7 +78,7 @@ function build_body(array &$headers, $text, $attachments, $footer) {
return $body;
}
-function build_from($name, $email) {
+function build_email_from($name, $email) {
$qname = '';
if (is_ascii($name)) {
@@ -112,10 +112,11 @@ function build_email_subject($forumtag, $reply, $subject) {
return utf8_quote_non_ascii($subject);
}
-function build_headers($userName, $userEmail, $to, $sender, $subject, $edit,
- $time, $messageId, $forumURL, $inReplyTo, $references) {
-
- $from = build_from($userName, $userEmail);
+function build_email_headers(
+ $userName, $userEmail, $to, $sender, $subject, $edit,
+ $time, $messageId, $forumURL, $inReplyTo, $references)
+{
+ $from = build_email_from($userName, $userEmail);
$subject = utf8_quote_non_ascii($subject);
$date = date(DATE_RFC2822, $time);
@@ -145,7 +146,7 @@ function build_headers($userName, $userEmail, $to, $sender, $subject, $edit,
return $headers;
}
-function build_text_part(Mail_mimePart $mime, $text) {
+function build_email_text_part(Mail_mimePart $mime, $text) {
$params = array(
'content_type' => 'text/plain',
'charset' => 'utf-8',
@@ -155,8 +156,8 @@ function build_text_part(Mail_mimePart $mime, $text) {
$mime->addSubPart($text, $params);
}
-function build_attachment(Mail_mimePart $mime, $type,
- $filename, $descr, $data) {
+function build_email_attachment(Mail_mimePart $mime, $type,
+ $filename, $descr, $data) {
$params = array(
'content_type' => $type,
'encoding' => 'base64',
@@ -167,7 +168,7 @@ function build_attachment(Mail_mimePart $mime, $type,
$mime->addSubPart($data, $params);
}
-function build_message_id($postId, $editId, $time, $forumHost) {
+function build_email_message_id($postId, $editId, $time, $forumHost) {
return "<$time.$postId.$editId.bridge@$forumHost>";
}