Properly unfold message-id header value

* elmo-util.el (elmo-msgdb-get-message-id-from-buffer): Properly
unfold message-id header value.

Problem reported and patch suggested by Donal Bashford in
<mid:rfwmx62teq6.wl%Don.Bashford@stjude.org>.
Get unfolded message-id header field value.

* wl-draft.el (wl-draft-forward, wl-draft-reply)
(wl-draft-add-in-reply-to, wl-draft-send-mail-with-qmail)
(wl-draft-send-mail-with-smtp, wl-draft-send-mail-with-sendmail)
(wl-draft-dispatch-message, wl-draft-do-fcc)
(wl-draft-elmo-nntp-send, wl-draft-queue-append): Use
`elmo-msgdb-get-message-id-from-buffer' to get unfolded message-id
header field value.

Problem reported by Donald Bashford in
<mid:rfwhatmhqxt.wl%Don.Bashford@stjude.org>>, based on patch
suggested by Kazuhiro Ito in
<mid:20120706133200.058FC2C803A@msa105.auone-net.jp>.
Revert "Get unfolded message-id header field value."

This reverts commit 385013398b2a0713dc66e38ae43814cd16c15f9b.
Revert "Properly unfold message-id header value"

This reverts commit 0393a81b5b984687a16697c7da540c3024992e11.
Ensure buffer narrowed to header and rename functions accordingly

* elmo-util.el (elmo-msgdb-get-message-id-from-header): New function.
(elmo-msgdb-get-message-id-from-buffer): Use it.
* modb-entity.el (elmo-msgdb-create-message-entity-from-header):
Likewise.
* elmo-util.el (elmo-msgdb-get-references-from-header): Renamed from
elmo-msgdb-get-references-from-buffer.
* elmo-shimbun.el (elmo-shimbun-update-overview): Likewise.
* modb-entity.el (elmo-msgdb-create-message-entity-from-header):
Likewise.
* modb-entity.el (elmo-msgdb-create-message-entity-from-header):
Rnamed from elmo-msgdb-create-message-entity-from-buffer.
(elmo-msgdb-create-message-entity-from-file): Likewise.
* elmo-archive.el (elmo-archive-msgdb-create-entity-subr): Likewise.
* elmo-imap4.el (elmo-imap4-fetch-callback-1): Likewise.
* elmo-nntp.el (elmo-nntp-msgdb-create-message): Likewise.
* elmo-pop3.el (elmo-pop3-msgdb-create-message): Likewise.
* elmo-shimbun.el (elmo-shimbun-msgdb-create-entity): Likewise.
* elmo-util.el (elmo-msgdb-get-message-id-from-buffer): Do not assume
buffer is narrowed to header.
* elmo-util.el (elmo-decoded-fetch-field): Renamed from
elmo-decoded-field-body.  elmo-decoded-fetch-field is obsolete.
* elmo-spam.el (elmo-spam-buffer-spam-p)
(elmo-spam-message-spam-p): Likewise.
* modb-entity.el (elmo-msgdb-create-message-entity-from-buffer):
Likewise.
* elmo-util.el (elmo-unfold-fetch-field): Renamed from
elmo-unfold-field-body.  elmo-unfold-field-body is obsolete.
(elmo-msgdb-get-message-id-from-buffer): Likewise.
* elmo-util.el (elmo-field-body): Obsolete.  Remove eval-and-compile.
Do not care of std11-fetch-field's availability.
(elmo-unfold-field-body, elmo-decoded-field-body)
(elmo-msgdb-get-message-id-from-buffer)
(elmo-msgdb-get-references-from-buffer): Call std11-fetch-field
directly.
* modb-entity.el (elmo-msgdb-create-message-entity-from-buffer):
Likewise.
* wl-draft.el (wl-draft-self-reply-p): Do not assume buffer is
narrowed to header.
* wl-draft.el (wl-draft-self-reply-p): Call std11-fetch-field
directly.
Declare unfold-field-body and decoded-field-body obsolete.

* elmo-util.el (elmo-unfold-field-body, elmo-decoded-field-body):
Declare obsolete.
Declare edebug spec to aid macro debugging

* wl-draft.el (wl-smtp-extension-bind): Declare edebug spec to aid
macro debugging.
Fix wl/ChangeLog

Contained two entries from a development branch.
Merge remote branch 'dmj/t/elmo-get-message-id' into t/pull-elmo-get-message-id

Conflicts:
	wl/ChangeLog
Properly get unfolded message-id header field for draft, fwd, reply

* wl-draft.el (wl-draft-forward, wl-draft-reply,
  wl-draft-add-in-reply-to, wl-draft-send-mail-with-qmail,
  wl-draft-send-mail-with-smtp, wl-draft-send-mail-with-sendmail): Use
  elmo-get-message-id-from-header or elmo-get-message-id-from-buffer.
* wl-summary.el (wl-summary-cancel-message,
  wl-summary-supersedes-message): Likewise.
* elmo-nntp.el (elmo-nntp-post): Remove the invalid Message-ID header
  when the recommended ID is provided.
* elmo-util.el (elmo-get-message-id-from-header,
  elmo-get-message-id-from-buffer): New
  functions.  (elmo-msgdb-get-message-id-from-header): Use them.
* elmo-nntp.el (elmo-nntp-post):
  Likewise. (elmo-nntp-setup-crosspost-buffer): Likewise.
* elmo-cache.el (elmo-folder-append-buffer): Use
  elmo-msgdb-get-message-id-from-buffer.
Refactored `elmo-get-message-id-from-header'

* elmo-util.el (elmo-extract-std11-msgid-tokens): New
function. Extract msg-id tokens from std11-parsed field.
(elmo-normalize-msgid-field): New function. Return list of message-id
field values in field.
(elmo-get-message-id-from-field): New function. Return message-id
field value.
(elmo-get-message-id-from-header): Refactored. Use new functions.
New customizable: Prefer std11 parser over regexp

* elmo-vars.el (elmo-prefer-std11-parser): New customizable. Prefer
std11 parser over regexp.
* elmo-util.el (elmo-get-message-id-from-field): Use customizable.
Retain order of message-id values

* elmo-util.el (elmo-extract-std11-msgid-tokens): Retain order of
message-id values.
Rename `elmo-normalize-msgid-field'

* elmo-util.el (elmo-parse-msgid-field): Renamed from
`elmo-normalize-msgid-field'.
(elmo-get-message-id-from-field): Dto.
Handle case of missing message-id field

* elmo-util.el (elmo-get-message-id-from-header): Handle case of
missing message-id field.
Reverting "Handle case of missing message-id field"
Revert "Handle case of missing message-id field"

This reverts commit 814d9cb574cf9d1bf156406fc8d737b933b79c78.

Sorry, it's early in the morning here.
Remove `strict' parameter, dynamically bind `elmo-prefer-std11-parser'

* elmo-nntp.el (elmo-nntp-post): Dynamically bind
`elmo-prefer-std11-parser'.
* elmo-util.el (elmo-get-message-id-from-field)
(elmo-get-message-id-from-header)
(elmo-get-message-id-from-buffer): Remove `strict' parameter,
dynamically bind `elmo-prefer-std11-parser' instead.
Dynamically bind `elmo-prefer-std11-parser', crosspost setup

* elmo-nntp.el (elmo-nntp-setup-crosspost-buffer): Dto.
Fallback to std11 parser if regexp doesn't match

* elmo-util.el (elmo-get-message-id-from-field): Fallback to std11
parser if regexp didn't match.
* elmo-vars.el (elmo-always-prefer-std11-parser): Renamed from
`elmo-prefer-std11-parser', default to nil.
Add support for Emacs24 built-in GnuTLS

* wl-draft.el: Do not define autoload for `open-ssl-stream'.
(wl-template): Require elmo-net.el.
(wl-smtp-extension-bind): Respect `elmo-network-stream-type-alist' for
over SSL/TLS connection.
* elmo-net.el (elmo-open-network-stream): Raise error when open
connection function failed.
* elmo-nntp.el (elmo-folder-initialize): Do not modify
elmo-network-stream-type-alist.
* elmo-vars.el (elmo-network-stream-type-alist): Check whether
gnutls.el or tls.el is available.