summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Põldaru2012-10-05 07:41:24 (GMT)
committer Mattias Põldaru2012-10-05 07:41:24 (GMT)
commit038bf70dacb3c1ee5463de7d24878cdfcabbd106 (patch)
treee32301cfca28f5cd2d0ea6b98826cc58a8277478
parenta594e25ab2236b592a6caeefe7ef0d3790243fb4 (diff)
by mahfiaz: Changed og_mailinglist_log_email_sent function's arguments and function name _og_mailinglist_get_nid_from_parent_messageid to _og_mailinglist_get_nid_from_messageid.
-rw-r--r--og_mailinglist_api.inc34
-rw-r--r--og_mailinglist_phpmailer.inc2
-rw-r--r--og_mailinglist_transport.inc6
3 files changed, 34 insertions, 8 deletions
diff --git a/og_mailinglist_api.inc b/og_mailinglist_api.inc
index d8d95a5..b249cd2 100644
--- a/og_mailinglist_api.inc
+++ b/og_mailinglist_api.inc
@@ -207,10 +207,27 @@ function og_mailinglist_delete_thread_subscription($nid, $uid) {
return $result;
}
-/*
- * Log successful sent email.
+/**
+ * Log when email has been successfully sent.
+ *
+ * @param string $source
+ * Indicates where the email came from, could be 'web' or 'email'.
+ * @param int $nid
+ * Node ID.
+ * @param int $cid
+ * Comment ID.
+ * @param string $parent_message_id
+ * Parent email's message ID, could be something like <123.431@example.org>
+ * @param array $headers
+ * Email headers as used in e.g _og_mailinglist_email_node_email()
+ * @return boolean
+ * Indicates whether the logging was successful.
*/
-function og_mailinglist_log_email_sent($source, $nid, $cid = 0, $message_id = 0, $in_reply_to = 0, $references = 0, $parent_message_id = 0) {
+function og_mailinglist_log_email_sent($source, $nid, $cid = 0, $parent_message_id = 0, $headers = array()) {
+ $message_id = isset($headers['message-id']) ? $headers['message-id'] : 0;
+ $in_reply_to = isset($headers['in-reply-to']) ? $headers['in-reply-to'] : 0;
+ $references = isset($headers['references']) ? $headers['references'] : 0;
+
$data = array(
'nid' => $nid,
'cid' => $cid,
@@ -292,7 +309,16 @@ function _og_mailinglist_get_thread_parent_messageid(&$headers) {
}
}
-function _og_mailinglist_get_nid_from_parent_messageid($message_id) {
+/**
+ * Get the node ID from the email's message ID.
+ *
+ * @param string $message_id
+ * Email message ID, something like <13251.1353@example.com> or
+ * <node-1-comment-3@example.org>
+ * @return int
+ * Node nid of the thread.
+ */
+function _og_mailinglist_get_nid_from_messageid($message_id) {
return db_query("SELECT nid
FROM {og_mailinglist_source}
WHERE message_id = :message_id",
diff --git a/og_mailinglist_phpmailer.inc b/og_mailinglist_phpmailer.inc
index fe9db1c..818de96 100644
--- a/og_mailinglist_phpmailer.inc
+++ b/og_mailinglist_phpmailer.inc
@@ -186,7 +186,7 @@ function og_mailinglist_send_node_email($node, $gids) {
}
if ($success) {
- og_mailinglist_log_email_sent('web', $node->nid, 0, $headers['message-id'], 0, 0, $headers['message-id']);
+ og_mailinglist_log_email_sent('web', $node->nid, 0, $headers['message-id'], $headers);
}
else {
watchdog('og_mailinglist', "OG_Mailinglist couldn't send a new node email for node.", NULL, WATCHDOG_ERROR);
diff --git a/og_mailinglist_transport.inc b/og_mailinglist_transport.inc
index 2fb21c6..0464681 100644
--- a/og_mailinglist_transport.inc
+++ b/og_mailinglist_transport.inc
@@ -407,7 +407,7 @@ function og_mailinglist_save_comment(&$email, $group_nodes, $node) {
// Log that this comment came by email.
$in_reply_to = isset($email['headers']['in-reply-to']) ? $email['headers']['in-reply-to'] : '';
$references = isset($email['headers']['references']) ? $email['headers']['references'] : '';
- og_mailinglist_log_email_sent('email', $node->nid, $comment->cid, $email['headers']['message-id'], $in_reply_to, $references, $parent_message_id);
+ og_mailinglist_log_email_sent('email', $node->nid, $comment->cid, $parent_message_id, $email['headers']);
// Report activity to watchdog.
$group_list = array();
@@ -473,7 +473,7 @@ function og_mailinglist_save_node(&$email, $group_nodes) {
_og_mailinglist_email_node_email($email, $node, $group_nodes);
// Log that this node came from email.
- og_mailinglist_log_email_sent('email', $node->nid, 0, $email['headers']['message-id'], 0, 0, $email['headers']['message-id']);
+ og_mailinglist_log_email_sent('email', $node->nid, 0, $email['headers']['message-id'], $email['headers']);
$group_list = array();
foreach ($group_nodes as $gid => $group_node) {
@@ -1026,7 +1026,7 @@ function og_mailinglist_parse_nid($email) {
// Check the in-reply-to header.
$parent_message_id = _og_mailinglist_get_thread_parent_messageid($email['headers']);
if (!empty($parent_message_id)) {
- $nid = _og_mailinglist_get_nid_from_parent_messageid($parent_message_id);
+ $nid = _og_mailinglist_get_nid_from_messageid($parent_message_id);
}
if ($nid) {