src/org/sonews/storage/DrupalArticle.java
author František Kučera <franta-hg@frantovo.cz>
Mon, 17 Oct 2011 21:06:24 +0200
changeset 92 a865136070a0
parent 72 aae4b4688700
child 104 b4c8a2760d6f
permissions -rw-r--r--
Drupal: text/plain – h2 bude podtřžené = místo # + podpora značky cite.
franta-hg@72
     1
/*
franta-hg@72
     2
 *   SONEWS News Server
franta-hg@72
     3
 *   see AUTHORS for the list of contributors
franta-hg@72
     4
 *
franta-hg@72
     5
 *   This program is free software: you can redistribute it and/or modify
franta-hg@72
     6
 *   it under the terms of the GNU General Public License as published by
franta-hg@72
     7
 *   the Free Software Foundation, either version 3 of the License, or
franta-hg@72
     8
 *   (at your option) any later version.
franta-hg@72
     9
 *
franta-hg@72
    10
 *   This program is distributed in the hope that it will be useful,
franta-hg@72
    11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@72
    12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
franta-hg@72
    13
 *   GNU General Public License for more details.
franta-hg@72
    14
 *
franta-hg@72
    15
 *   You should have received a copy of the GNU General Public License
franta-hg@72
    16
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
franta-hg@72
    17
 */
franta-hg@72
    18
package org.sonews.storage;
franta-hg@72
    19
franta-hg@72
    20
import java.io.IOException;
franta-hg@72
    21
import java.util.Enumeration;
franta-hg@72
    22
import javax.mail.Header;
franta-hg@72
    23
import javax.mail.MessagingException;
franta-hg@72
    24
import javax.mail.internet.InternetHeaders;
franta-hg@72
    25
franta-hg@72
    26
/**
franta-hg@72
    27
 *
franta-hg@72
    28
 * @author František Kučera (frantovo.cz)
franta-hg@72
    29
 */
franta-hg@72
    30
public class DrupalArticle extends Article {
franta-hg@72
    31
franta-hg@72
    32
	public DrupalArticle(DrupalMessage msg) throws MessagingException, IOException {
franta-hg@72
    33
		headers = new InternetHeaders();
franta-hg@72
    34
franta-hg@72
    35
		/** In order to have all headers (like MIME type) */
franta-hg@72
    36
		msg.saveChanges();
franta-hg@72
    37
franta-hg@72
    38
		for (Enumeration e = msg.getAllHeaders(); e.hasMoreElements();) {
franta-hg@72
    39
			final Header header = (Header) e.nextElement();
franta-hg@72
    40
			this.headers.addHeader(header.getName(), header.getValue());
franta-hg@72
    41
		}
franta-hg@72
    42
franta-hg@72
    43
		setBody(msg.getBody());
franta-hg@72
    44
		validateHeaders();
franta-hg@72
    45
	}
franta-hg@72
    46
}