*) peer profile can now be displayed as vcard

e.g. http://localhost:8080/ViewProfile.vcf?hash=localhash

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3504 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 18 years ago
parent 70bd67e73e
commit 81b4598487

@ -2,6 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YaCy '#[clientname]#': Remote Peer Profile</title>
<link rel="alternate" type="text/x-vcard" title="vCard" href="ViewProfile.vcf?hash=#[hash]#" />
#%env/templates/metas.template%#
</head>
<body id="ViewProfile">

@ -57,6 +57,7 @@ import java.util.Properties;
import de.anomic.data.wikiCode;
import de.anomic.http.httpHeader;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -83,6 +84,7 @@ public class ViewProfile {
prop.put("success","0");
return prop;
}
prop.put("hash",hash);
// get the profile
HashMap profile = null;
@ -101,6 +103,7 @@ public class ViewProfile {
prop.put("success", "3"); // everything ok
prop.put("localremotepeer", 0);
prop.put("success_peername", yacyCore.seedDB.mySeed.getName());
prop.put("success_peerhash", yacyCore.seedDB.mySeed.hash);
} else {
// read the profile from remote peer
yacySeed seed = yacyCore.seedDB.getConnected(hash);
@ -125,6 +128,7 @@ public class ViewProfile {
prop.put("success", "3"); // everything ok
}
prop.put("success_peername", seed.getName());
prop.put("success_peerhash", seed.hash);
}
prop.put("localremotepeer", 1);
}
@ -146,7 +150,7 @@ public class ViewProfile {
knownKeys.add("yahoo");
knownKeys.add("msn");
knownKeys.add("skype");
knownKeys.add("comment");
knownKeys.add("comment");
//empty values
Iterator it = knownKeys.iterator();
@ -174,6 +178,7 @@ public class ViewProfile {
"success_" + key + "_value",
wikiTransformer.transform(((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n"))
);
prop.putASIS("success_" + key + "_b64value",kelondroBase64Order.standardCoder.encodeString((String) entry.getValue()));
}else{
prop.put("success_" + key + "_value", value); //put replaces HTML Chars by entities.
}

@ -0,0 +1,15 @@
#(success)#::::::BEGIN:vcard
VERSION:3.0
CATEGORIES:YACY PEER
UID:#[peerhash]#
FN: #(name)#::#[value]##(/name)#
NICKNAME: #(nickname)#::#[value]# #(/nickname)#
URL: #(homepage)#::#[value]# #(/homepage)#
EMAIL: #(email)#::#[value]# #(/email)#
NOTE;CHARSET=UTF-8;ENCODING=BASE64: #(comment)#::#[b64value]# #(/comment)#
X-ICQ: #(icq)#::#[value]# #(/icq)#
X-JABBER: #(jabber)#::#[value]# #(/jabber)#
X-YAHOO: #(yahoo)#::#[value]# #(/yahoo)#
X-MSN: #(msn)#::#[value]# #(/msn)#
#{other}#X-#[key]#:#[value]##{/other}#
END:vcard#(/success)#

@ -592,6 +592,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
path.endsWith("csv") ||
path.endsWith("pac") ||
path.endsWith("src") ||
path.endsWith("vcf") ||
path.endsWith("/") ||
path.equals("/robots.txt")) {

Loading…
Cancel
Save