Removing tags as they point to invalid changesets after history refactoring.
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package org.sonews.feed;
21 import java.io.IOException;
22 import java.util.concurrent.ConcurrentLinkedQueue;
23 import org.sonews.storage.Article;
24 import org.sonews.storage.Headers;
25 import org.sonews.util.Log;
26 import org.sonews.util.io.ArticleWriter;
29 * Pushes new articles to remote newsservers. This feeder sleeps until a new
30 * message is posted to the sonews instance.
31 * @author Christian Lins
34 class PushFeeder extends AbstractFeeder
37 private ConcurrentLinkedQueue<Article> articleQueue =
38 new ConcurrentLinkedQueue<Article>();
52 Article article = this.articleQueue.poll();
53 String[] groups = article.getHeader(Headers.NEWSGROUPS)[0].split(",");
54 Log.msg("PushFeed: " + article.getMessageID(), true);
55 for(Subscription sub : this.subscriptions)
58 if(article.getHeader(Headers.PATH)[0].contains(sub.getHost()))
60 Log.msg(article.getMessageID() + " skipped for host "
61 + sub.getHost(), true);
67 for(String group : groups)
69 if(sub.getGroup().equals(group))
71 // Delete headers that may cause problems
72 article.removeHeader(Headers.NNTP_POSTING_DATE);
73 article.removeHeader(Headers.NNTP_POSTING_HOST);
74 article.removeHeader(Headers.X_COMPLAINTS_TO);
75 article.removeHeader(Headers.X_TRACE);
76 article.removeHeader(Headers.XREF);
78 // POST the message to remote server
79 ArticleWriter awriter = new ArticleWriter(sub.getHost(), sub.getPort());
80 awriter.writeArticle(article);
91 catch(InterruptedException ex)
93 Log.msg("PushFeeder interrupted: " + ex, true);
98 public void queueForPush(Article article)
100 this.articleQueue.add(article);