*) adding RSS feed for peer messages

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3448 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 18 years ago
parent 23338d2070
commit 0d178d00a5

@ -2,6 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YaCy '#[clientname]#': Messages</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="Messages_p.rss" />
#%env/templates/metas.template%#
</head>
<body id="Messages">

@ -75,6 +75,11 @@ public class Messages_p {
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
// set peer address / name
final String peerAddress = yacyCore.seedDB.mySeed.getAddress();
final String peerName = yacyCore.seedDB.mySeed.getName();
prop.put("peerAddress", peerAddress);
prop.put("peerName", peerName);
// List known hosts for message sending (from Blacklist_p.java)
if (yacyCore.seedDB != null && yacyCore.seedDB.sizeConnected() > 0) {
@ -143,6 +148,17 @@ public class Messages_p {
prop.put("mode_messages_"+count+"_subject", wikiCode.replaceHTML(message.subject()));
prop.put("mode_messages_"+count+"_key", key);
prop.put("mode_messages_"+count+"_hash", message.authorHash());
// also write out the message body (needed for the RSS feed)
if (((String)header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".rss")) {
prop.put("mode_messages_"+count+"_peerAddress", peerAddress);
try {
prop.put("mode_messages_"+count+"_body",new String(message.message(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
// can not happen, because UTF-8 must be supported by every JVM
}
}
dark = !dark;
count++;
}

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title><![CDATA[YaCy '#[peerName]#': Messages]]></title>
<link>http://#[peerAddress]#/Messages_p.html</link>
<image>
<url>http://#[peerAddress]#/env/grafics/yacy.png</url>
<title>YaCy</title>
<link>http://#[peerAddress]#/</link>
</image>
#(mode)#
#{messages}#
<item>
<author><![CDATA[#[from]#]]></author>
<title><![CDATA[#[subject]#]]></title>
<link>http://#[peerAddress]#/Messages_p.html?action=view&amp;object=#[key]#</link>
<pubDate>#[date]#</pubDate>
<guid>#[key]#</guid>
<description><![CDATA[#[body]#]]></description>
</item>
#{/messages}#
::#(/mode)#
</channel>
</rss>
Loading…
Cancel
Save