1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00
psyced/world/net/library/profiles.pl

704 lines
15 KiB
Perl
Raw Normal View History

#!/usr/bin/perl
2009-01-26 20:12:53 +00:00
# $Id: profiles.pl,v 1.56 2008/10/07 12:27:25 lynx Exp $
#
# generator of mappings between several profile file formats -lynX 2005
# part of the psyced project. see documentation for copyrights and licenses.
#
# see below __DATA__ for the actual mapping data
# this is just the perl program to make use of the data
2009-01-26 20:12:53 +00:00
#
# you should not be running this program yourself. it is a tool for the
# developers, only. if you see funny modifications to this file, one of
# your LPC apps is trying to break out of its sandbox by horsing you into
# a trojan here. then of course you will read this message only if you are
# wise enough to compare the file with the original from the distribution. ;)
# but why should you come here to run this, anyway?
while (<main::DATA>) {
next if /^\s*$/;
next if /^#/;
if ( /^PSYC\t(\w+)$/ ) {
$_ = $psyc = $1;
$psyc{$psyc} = 1;
next if /^_INTERNAL/;
s/_(address|contact|voice|scheme|source|flag|person|select)//g;
s/_date/_day/g;
s/_description/_text/g;
s/_favorite/_fave/g;
s/_identification/_ID/g;
s/_uniform/_file/g;
s/_telephone/_phone/g;
$set{$psyc} = lc( join('', reverse split('_', $_)) );
next;
}
if ( /^(\S+)\t(\S+)$/ ) {
${$1}{$psyc} = $2;
next;
}
warn "couldn't parse $_";
}
# generate some documentation for your enjoyment
open O, ">profiles.html" or die $!;
print O <<X;
<style> td { background-color: #ccc } </style>
<title>PROFILING FIELD NAMES COMPARISON CHART</title>
<body bgcolor="#ff9900" text=black link=red vlink=black>
<h1>PROFILING FIELD NAMES COMPARISON CHART</h1>
<table cellspacing=2>
X
2009-01-26 20:12:53 +00:00
print O "<tr align=left><th>PSYC<br>variable</th><th>/set<br>command</th><th>jProf<br>XEP-0154</th><th>vCard<br>RFC 2426</th><th>jCard<br>XEP-0054</th><th>LDAP</th><th>FOAF</th></tr>\n";
foreach $k ( sort keys %psyc ) {
print O "<tr><td>$k</td><td>$set{$k}</td><td>$jProf{$k}</td><td>$vCard{$k}</td><td>$jCard{$k}</td><td>$LDAP{$k}</td><td>$FOAF{$k}</td></tr>\n";
}
print O <<X;
</table>
<h3>This document was generated by <a href="http://www.psyced.org/dist/world/net/library/profiles.pl">profiles.pl</a> of <a href="http://www.psyced.org/">psyced</a>. See <a href="http://about.psyc.eu/Profile">http://about.psyc.eu/Profile</a> for explanations.</h3>
X
close O;
# and now let's get to the real work
open O, ">profiles.i" or die $!;
print O "// profiles.i generated out of profiles.gen. do not edit.\n\n";
print O "volatile mapping psyc2jProf = ([\n";
foreach $k ( sort keys %jProf ) {
printf O " %37s : \"%s\",\n", "\"$k\"", $jProf{$k};
}
print O "]);\n\nvolatile mapping psyc2jCard = ([\n";
foreach $k ( sort keys %jCard ) {
unless ($OjCard{$k}) { $j = $jCard{$k};
$j = $j =~ m#^(\w+)/(\w+)$# ? "<$1><$2>%s</$2></$1>" : "<$j>%s</$j>";
printf O " %25s : \"%s\",\n", "\"$k\"", $j;
}
}
foreach $k ( sort keys %OjCard ) {
printf O " %25s : \"%s\",\n", "\"$k\"", $OjCard{$k};
}
print O "]);\n\nvolatile mapping jCard2psyc = ([\n";
foreach $k ( sort keys %jCard ) {
printf O " %15s : \"%s\",\n", "\"$jCard{$k}\"", $k;
}
print O "]);\n\nvolatile mapping psyc2set = ([\n";
foreach $k ( sort keys %set ) {
printf O " %37s : \"%s\",\n", "\"$k\"", $set{$k};
}
print O "]);\n\nvolatile mapping set2psyc = ([\n";
foreach $k ( sort keys %set ) {
printf O " %20s : \"%s\",\n", "\"$set{$k}\"", $k;
}
print O "]);\n\nvolatile mapping psyc2ldap = ([\n";
foreach $k ( sort keys %LDAP ) {
printf O " %37s : \"%s\",\n", "\"$k\"", $LDAP{$k};
}
print O "]);\n\nvolatile mapping ldap2psyc = ([\n";
foreach $k ( sort keys %LDAP ) {
printf O " %27s : \"%s\",\n", "\"$LDAP{$k}\"", $k;
}
print O "]);\n\nvolatile mapping psyc2vCard = ([\n";
foreach $k ( sort keys %vCard ) {
printf O " %37s : \"%s\",\n", "\"$k\"", $vCard{$k};
}
print O "]);\n\nvolatile mapping vCard2psyc = ([\n";
foreach $k ( sort keys %vCard ) {
printf O " %20s : \"%s\",\n", "\"$vCard{$k}\"", $k;
}
print O "]);\n\n";
close O;
my $skip = <<ENDSKIP;
# let's generate a file that will make PsycZilla overkill .. then again, no
open O, ">profiles.xul" or die $!;
print O <<X if 0;
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<prefwindow id="psycProfile"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
type="profwindow"
title="PSYC profile" onload="prefWinLoad()"
maxwidth='550' windowtype='preferences'>
<groupbox>
X
foreach ( sort keys %psyc ) {
next if /^_INTERNAL/ or /^_degree/;
# http://developer.mozilla.org/en/docs/XUL:textbox
print O <<X;
<hbox><label value='$set{$_}'/><textbox id='$_' preference='profile_$set{$_}'/></hbox>
X
}
print O <<X if 0;
</groupbox>
</prefwindow>
X
close O;
ENDSKIP
# this file was generated from JEP-0154, then edited.. a lot.
#
# apparently psyc is the only format which keeps hierarchy in the variable
# names using families. most newer formats use complex xml paths or even
# unusable xml paths.
#
# there are huge amounts of profile options in here, but please - don't
# confront users with endless questionnaires and don't hand this information
# out to people who make money out of it. the intention behind such elaborate
# profiles is to empower the private trust network of friends to maximize
# their use of psyc however they may seem fit, not 3rd parties or the general
# public. do not fill in fields until they are actually useful for something.
#
#PSYC variable name
#set user-friendly variable name for /set command
#jProf JEP-0154 field var. JEP-0154 is the new profile data representation
# for jabber. it is mostly unused everywhere.
# http://www.jabber.org/jeps/jep-0154.html
#vCard either RFC 2426 or JEP-0054, probably needs to be split into...
#jCard JEP-0054 field names should be tagged jCard rather than vCard.
# JEP-0054 is a not so brilliant adaption of vCard to jabber,
# it is superceded but in use everywhere.
# http://www.jabber.org/jeps/jep-0054.html
#OjCard OUTGOING format strings for jCard
# many cases just cannot be treated the same way as incoming JEP-0054
#LDAP actually useful ISO standard. good to have it here for future use.
#xNAL http://xml.coverpages.org/xnal.html by OASIS. we don't use it.
#FOAF the profiles-without-privacy format. unused, but no need to delete it.
__DATA__
PSYC _name_public
jProf display_name
vCard FN
jCard FN
LDAP displayName
FOAF name
PSYC _name_family
jProf family_name
vCard FAMILY
jCard N/FAMILY
LDAP sn
xNAL LastName
#FOAF family_name
FOAF surname
PSYC _nick_alternate
jProf familiar_name
PSYC _name_given
jProf given_name
vCard GIVEN
jCard N/GIVEN
LDAP givenName
xNAL FirstName
#FOAF first_name
FOAF givenname
PSYC _name_middle
jProf middle_name
vCard MIDDLE
jCard N/MIDDLE
xNAL MiddleName
PSYC _name_prefix
jProf name_prefix
vCard PREFIX
jCard N/PREFIX
xNAL Title
FOAF title
PSYC _name_suffix
jProf name_suffix
vCard SUFFIX
jCard N/SUFFIX
xNAL GeneralSuffix
PSYC _nick_profile
set name
jProf nickname
LDAP nickname
vCard NICKNAME
jCard NICKNAME
xNAL Alias
FOAF nick
PSYC _name_patronymic
jProf patronymic
PSYC _address_country
jProf country
vCard COUNTRY
jCard ADR/CTRY
LDAP c
xNAL CountryName
JEP0112 country
PSYC _address_region
jProf region
vCard REGION
jCard ADR/REGION
LDAP st
xNAL AdministrativeAreaName
JEP0112 region
# optionally postfixed by _home _work etc.
PSYC _address_locality
jProf locality
# optionally supplemented with the "HOME" or "WORK" type
vCard LOCALITY
jCard ADR/LOCALITY
LDAP l
xNAL LocalityName
JEP0112 locality
PSYC _address_area
jProf area
xNAL DependentLocalityName
JEP0112 area
PSYC _address_street
jProf street
vCard STREET
jCard ADR/STREET
LDAP street
xNAL ThoroughfareNumber+ThoroughfareName
JEP0112 street
PSYC _address_building
jProf building
vCard EXTADD
jCard ADR/EXTADD
xNAL BuildingName
JEP0112 building
PSYC _address_floor
jProf floor
xNAL SubPremiseNumber
JEP0112 floor
PSYC _address_room
jProf room
LDAP roomNumber
xNAL SubPremiseNumber
JEP0112 room
PSYC _address_box_postal
jProf postalbox
vCard POBOX
jCard ADR/POBOX
LDAP postOfficeBox
PSYC _address_code_postal
jProf postalcode
vCard PCODE
jCard ADR/PCODE
LDAP postalCode
xNAL PostalCodeNumber
JEP0112 postalcode
PSYC _address_latitude
jProf lat
vCard LAT
jCard GEO/LAT
JEP0080 lat
PSYC _address_longitude
jProf lon
vCard LON
jCard GEO/LON
JEP0080 lon
PSYC _address_zone_time
vCard TZ
jCard TZ
PSYC _contact_telephone
jProf landline
# both vCard and jCard have no hierarchy for telephone number types
# which makes them very cumbersome to use.
# so we just ignore it and merge all phone numbers into one _telephone field.
jCard TEL/NUMBER
OjCard <TEL><NUMBER>%s</NUMBER></TEL>
LDAP telephoneNumber
FOAF phone
PSYC _contact_telephone_voice_home
vCard TEL;VOICE;HOME
OjCard <TEL><VOICE/><HOME/><NUMBER>%s</NUMBER></TEL>
PSYC _contact_telephone_voice_work
vCard TEL;VOICE;WORK
OjCard <TEL><VOICE/><WORK/><NUMBER>%s</NUMBER></TEL>
PSYC _contact_telephone_voice_mobile
jProf mobile
vCard TEL;CELL
OjCard <TEL><VOICE/><CELL/><NUMBER>%s</NUMBER></TEL>
LDAP mobile
FOAF phone
PSYC _contact_telephone_pager
jProf pager
set pager
vCard TEL;PAGER
OjCard <TEL><PAGER/><NUMBER>%s</NUMBER></TEL>
LDAP pager
PSYC _contact_telephone_fax
set fax
jProf fax
vCard TEL;FAX
OjCard <TEL><FAX/><NUMBER>%s</NUMBER></TEL>
LDAP facsimileTelephoneNumber
PSYC _identification_scheme_SIP
jProf sip_address
PSYC _identification_scheme_Skype
jProf skype_address
PSYC _identification_videophone
jProf video_phone
PSYC _identification_scheme_AIM
jProf aim_id
FOAF aimChatID
PSYC _identification_scheme_mailto
set email
jProf email
vCard EMAIL
jCard EMAIL/USERID
LDAP mail
PSYC _identification_scheme_ICQ
jProf icq_id
FOAF icqChatID
PSYC _identification
jProf psyc_id
2009-11-04 16:41:47 +00:00
# I'm afraid adding a PSYCID field will not be well-recepted by some apps
#jCard PSYCID
FOAF psycID
PSYC _identification_other
PSYC _identification_scheme_XMPP
jProf jid
jCard JABBERID
FOAF jabberID
PSYC _identification_scheme_MSN
jProf msn_id
FOAF msnChatID
PSYC _identification_scheme_Yahoo
jProf yahoo_id
FOAF yahooChatID
PSYC _uniform_character
jProf avatar_url
PSYC _page_biography
jProf bio
PSYC _uniform_FOAF_public
jProf foaf_url
# why i define this? because with profiles.gen we could easily
# generate a _real_ foaf file, and with psycish friendsnetting
# or at least psyc auth we can make it useful to those we want
# to have it. but probably whatever foaf software exists, it is
# probably web-based and doesn't have the faintest clue about
# privacy.. so better do this all in psyc anyway.
PSYC _uniform_FOAF_private
PSYC _uniform_photo_small
set miniphotofile
FOAF thumbnail
PSYC _uniform_photo
jProf photo_url
vCard PHOTO
FOAF depiction
PSYC _page_photo
FOAF img
# _page_public is a substring of _page_publications
# could become a problem for simple inheritance detection
PSYC _page_public
vCard URL
jCard URL
jProf homepage
LDAP labelledURI
FOAF homepage
PSYC _page_publications
jProf publications
FOAF publications
PSYC _page_resume
jProf resume
PSYC _page_status
jProf status_url
PSYC _page_work
jProf org_url
FOAF workplaceHomepage
PSYC _page_diary
jProf weblog
FOAF weblog
# bookmarks, favorites, del.icio.us stuff or just your friends homepages
PSYC _page_links
PSYC _person_assistant_work
jProf assistant
LDAP secretary
PSYC _title_work
jProf job_title
vCard TITLE
jCard TITLE
LDAP title
FOAF title
PSYC _person_manager_work
jProf manager
LDAP manager
# was: _organisation_work. _affiliation is more generic but since the
# other profile things only have the stricter field, we merge them here
PSYC _affiliation
jProf org_name
vCard ORGNAME
jCard ORG/ORGNAME
LDAP o
PSYC _role_work
jProf org_role
vCard ROLE
jCard ROLE
PSYC _unit_work
jProf org_unit
vCard ORGUNIT
jCard ORG/ORGUNIT
LDAP ou
PSYC _login_work
jProf system_username
LDAP uid
LDAP userid
PSYC _location_work
jProf workstation
PSYC _date_birth
jProf birth
vCard BDAY
jCard BDAY
## "onomastico" - catholics like to party on the saint's day by the same name
## maybe something similar exists in other cultures too?
PSYC _date_name
## hahahaha
PSYC _date_wedding
## only we have a distinction of public and private text.. sigh
## not talking of mottos and slogans ;)
PSYC _description_public
jProf description
jCard DESC
LDAP description
#jProf eye_color
PSYC _gender
set sex
jProf gender
FOAF gender
#jProf hair_color
#jProf height
#jProf weight
PSYC _description_expertise
jProf expertise
PSYC _image_character
jProf avatar_data
#jProf dietary_preferences
PSYC _description_hobby
jProf hobby
#jProf interest
# the current language setting - needs to be iso-conformant etc.
PSYC _language
set language
PSYC _language_optional
jProf languages_lesswell
PSYC _language_alternate
jProf languages_well
LDAP preferredLanguage
#jProf marital_status
#jProf mbti
#FOAF myersBriggs
# we don't want to send base64 encoded photos in psyc
# but we can handle them internally
PSYC _INTERNAL_image_photo
jProf photo_data
vCard PHOTO
jCard PHOTO/BINVAL
LDAP jpegPhoto
PSYC _INTERNAL_type_image_photo
jCard PHOTO/TYPE
PSYC _profession
jProf profession
#jProf religion
#jProf sexual_orientation
#jProf smoker
#jProf wishlist
#jProf zodiac_chinese
#jProf zodiac_western
# for children
PSYC _favorite_animal
PSYC _favorite_literature
jProf fav_authors
PSYC _favorite_athletes
jProf fav_athletes
#jProf fav_charities
PSYC _favorite_drinks
jProf fav_drinks
PSYC _favorite_foods
jProf fav_foods
PSYC _favorite_games
jProf fav_games
PSYC _favorite_movies
jProf fav_movies
PSYC _favorite_music
jProf fav_music
# for teenagers
PSYC _favorite_popstar
jProf fav_stars
PSYC _description_quotes
jProf fav_quotes
PSYC _favorite_teams
jProf fav_teams
PSYC _favorite_television
jProf fav_tv
PSYC _address_past
jProf places_lived
#jProf schools
# PSYC things that other formats do not propose
# listed here to get the set2psyc and psyc2set mappings of it
PSYC _place_home
set home
PSYC _flag_filter_strangers
set filter
PSYC _uniform_key_public
set keyfile
# stylesheet for showing psyc profile
PSYC _uniform_style
set stylefile
# superceded, but we keep it for those who want to use the code by psyced tuning
PSYC _flag_uniform_verbatim
set verbatimuniform
PSYC _description_preferences
set likestext
PSYC _description_preferences_not
set dislikestext
# this one typically requires special care, here it is anyhow..
PSYC _password
# just a version of _nick where spaces are allowed
PSYC _nick_spaced
set longname
PSYC _encoding_characters
set charset
PSYC _action_ask
PSYC _action_speak
# nice alternative name for motto: slogan
PSYC _action_motto
# hmm.. looks like jProf has no place for slogans and mottos
# not even if we introduce a motto variant which is not /me-like.
PSYC _description_motto
# this one gets used by the so-called IRCNAME since hardly anyone
# really puts his real name in there.
PSYC _character_action
PSYC _character_command
PSYC _color
# these aren't /set'tings as of now - too volatile
#PSYC _degree_availability
#PSYC _degree_mood
PSYC _description_private
PSYC _description_presence
2010-05-17 20:16:14 +00:00
# erm.. _flag here?
PSYC _select_filter_presence
PSYC _flag_action_speak_visible
PSYC _flag_colors_ignore
# does this strictly qualify as a flag, if it has three values, not two?
PSYC _flag_echo
PSYC _flag_expose_friends
PSYC _flag_expose_groups
PSYC _flag_greeting
PSYC _flag_places_multiple
PSYC _flag_presence_ctcp
PSYC _flag_screen_clear
# does this strictly qualify as a flag, if it has three values, not two?
PSYC _flag_stamp_time
PSYC _flag_visibility
PSYC _page_private
PSYC _page_start