203
203
for name in ['In-Reply-To', 'References']:
204
if parsed_message.has_key(name):
204
if name in parsed_message:
205
205
return parsed_message.get(name).split()
302
302
raise InvalidEmailMessage('Msg %s size %d exceeds limit %d' % (
303
303
rfc822msgid, len(email_message), MAX_EMAIL_SIZE))
305
# Handle duplicate Message-Id
306
# XXX kiko 2005-08-03: shouldn't we be using DuplicateMessageId here?
308
existing_msgs = self.get(rfc822msgid=rfc822msgid)
312
# we are now allowing multiple msgs in the db with the same
313
# rfc822 msg-id to allow for variations in headers and,
314
# potentially, content. so we scan through the results to try
315
# and find one that matches,
316
for existing in existing_msgs:
317
existing_raw = existing.raw.read()
318
if email_message == existing_raw:
320
# ok, this is an interesting situation. we have a new
321
# message with the same rfc822 msg-id as an existing message
322
# in the database, but the message headers and/or content
323
# are different. For the moment, we have chosen to allow
324
# this, but in future we may want to flag it in some way
326
305
# Stuff a copy of the raw email into the Librarian, if it isn't
327
306
# already in there.
328
file_alias_set = getUtility(ILibraryFileAliasSet) # Reused later
307
file_alias_set = getUtility(ILibraryFileAliasSet) # Reused later
329
308
if filealias is None:
330
309
# We generate a filename to avoid people guessing the URL.
331
310
# We don't want URLs to private bug messages to be guessable