Duplicate posts, using maillist.php [message #41056] |
Wed, 14 May 2008 00:00 |
srchild
Messages: 88 Registered: December 2003 Location: UK
Karma: 1
|
Member |
|
|
I've noticed that a few messages on my forums are appearing twice.
I use maillist.php for mailing list integration, and investigating shows that those duplicated are messages posted on the forum itself (most of my messages are posted via mailing lists).
Thinking it through, it is hard to see why messages would not always be duplicated:
- The forum sends messages out to the mailing list
- the mailing list sends messages to its members, one of which is an address which pipes to maillist.php
- the forum displays messages received via maillist.php
This mechanism seems bound to lead to duplicates, so I guess there must be some duplicate checking in there somewhere? But it seems to have failed since I upgraded to 2.7.7. Any suggestions where I should be looking to track this down?
Simon Child
|
|
|
|
|
Re: Duplicate posts, using maillist.php [message #41095 is a reply to message #41092] |
Mon, 19 May 2008 15:22 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The: X-FUDforum: 6092915ac21e63638178e48fa6d9dcda <53757> header is the one that is supposed to prevent duplicates.
Does the 6092915ac21e63638178e48fa6d9dcda string match the md5 of your WWW_ROOT value?
FUDforum Core Developer
|
|
|
Re: Duplicate posts, using maillist.php [message #41524 is a reply to message #41095] |
Thu, 12 June 2008 13:09 |
srchild
Messages: 88 Registered: December 2003 Location: UK
Karma: 1
|
Member |
|
|
Ilia wrote on Mon, 19 May 2008 16:22 | The: X-FUDforum: 6092915ac21e63638178e48fa6d9dcda <53757> header is the one that is supposed to prevent duplicates.
Does the 6092915ac21e63638178e48fa6d9dcda string match the md5 of your WWW_ROOT value?
|
Yes it does. If I do this:
echo md5($WWW_ROOT);
then I get exactly 6092915ac21e63638178e48fa6d9dcda
Any thoughts how to proceed?
Thanks
Simon Child
|
|
|
Re: Duplicate posts, using maillist.php [message #157808 is a reply to message #41524] |
Sun, 10 August 2008 20:11 |
srchild
Messages: 88 Registered: December 2003 Location: UK
Karma: 1
|
Member |
|
|
I see that mlist_post.inc writes that header, and indeed the header is there in outgoing messages.
But I don't see where that header is checked for in incoming mailing list messages? Specifically, grepping the string 'X-FUDforum' shows that it appears nowhere in the scripts or include directories (except the one instance in mlist_post.inc).
Where are incoming messages to maillist.php supposed to be tested to see if they have this header?
Thanks
Simon Child
|
|
|
Re: Duplicate posts, using maillist.php [message #157825 is a reply to message #157808] |
Tue, 19 August 2008 18:23 |
srchild
Messages: 88 Registered: December 2003 Location: UK
Karma: 1
|
Member |
|
|
srchild wrote on Sun, 10 August 2008 21:11 | I see that mlist_post.inc writes that header, and indeed the header is there in outgoing messages.
But I don't see where that header is checked for in incoming mailing list messages? Specifically, grepping the string 'X-FUDforum'...
|
Ah found it, you lower-cased it.
Fixed the bug, or at least got a workaround:
In maillist.php you have this code:
// Handler for our own messages, which do not need to be imported.
if (isset($emsg->headers['x-fudforum']) && preg_match('!([A-Za-z0-9]{32}) <([0-9]+)>!', $emsg->headers['x-fudforum'], $m)) {
if ($m[1] == md5($GLOBALS['WWW_ROOT'])) {
q("UPDATE ".sql_p."msg SET mlist_msg_id='".addslashes($emsg->msg_id)."' WHERE id=".intval($m[2])." AND mlist_msg_id IS NULL");
if (db_affected()) {
exit;
}
}
}
But since v 1.14 2005/09/08 mlist_post.inc has set mlist_msg_id when sending the message out, so the UPDATE above always affects zero rows and hence
if (db_affected()) {
exit;
}
does not exit and the message is filed as a duplicate in the forum.
Fix/workaround is to do this:
// if (db_affected()) {
exit;
// }
Any reason not to do that?
Simon Child
|
|
|
|
|