From b4997bc20cc558352abb5ae3bca803b57abe90ff Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 27 Nov 2007 14:06:44 +0000 Subject: [PATCH] * src/mod_vcard.erl: Ensure mod_vcard to respect FORM_TYPE registry (EJAB-328). * src/mod_vcard_ldap.erl: Likewise. * src/mod_vcard_odbc.erl: Likewise. * doc/guide.tex: Updated documentation. SVN Revision: 990 --- ChangeLog | 5 +++++ doc/guide.tex | 24 ++++++++++++------------ src/mod_vcard.erl | 24 ++++++++++++------------ src/mod_vcard_ldap.erl | 14 +++++++------- src/mod_vcard_odbc.erl | 24 ++++++++++++------------ 5 files changed, 48 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index e763d9b84..b219e3ca6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-11-27 Badlop + * src/mod_vcard.erl: Ensure mod_vcard to respect FORM_TYPE registry (EJAB-328). + * src/mod_vcard_ldap.erl: Likewise. + * src/mod_vcard_odbc.erl: Likewise. + * doc/guide.tex: Updated documentation. + * src/mod_muc/mod_muc_room.erl: Don't show the room name as the room description (EJAB-382). 2007-11-26 Badlop diff --git a/doc/guide.tex b/doc/guide.tex index e828f5a38..f9a7a65b3 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -2998,10 +2998,10 @@ consists of the following \modvcardldap{}-specific options: \term{"\%u"} will be replaced with the user part of a JID, and \term{"\%d"} will be replaced with the domain part of a JID. The default is: \begin{verbatim} - [{"NICKNAME", "%u", []}, + [{"NICK", "%u", []}, {"FN", "%s", ["displayName"]}, - {"FAMILY", "%s", ["sn"]}, - {"GIVEN", "%s", ["givenName"]}, + {"LAST", "%s", ["sn"]}, + {"FIRST", "%s", ["givenName"]}, {"MIDDLE", "%s", ["initials"]}, {"ORGNAME", "%s", ["o"]}, {"ORGUNIT", "%s", ["ou"]}, @@ -3048,10 +3048,10 @@ consists of the following \modvcardldap{}-specific options: is: \begin{verbatim} [{"Full Name", "FN"}, - {"Given Name", "GIVEN"}, + {"Given Name", "FIRST"}, {"Middle Name", "MIDDLE"}, - {"Family Name", "FAMILY"}, - {"Nickname", "NICKNAME"}, + {"Family Name", "LAST"}, + {"Nickname", "NICK"}, {"Birthday", "BDAY"}, {"Country", "CTRY"}, {"City", "LOCALITY"}, @@ -3106,9 +3106,9 @@ Also we want users to search each other. Let's see how we can set it up: {ldap_filter, ""}, %% Now we want to define vCard pattern {ldap_vcard_map, - [{"NICKNAME", "%u", []}, % just use user's part of JID as his nickname - {"GIVEN", "%s", ["givenName"]}, - {"FAMILY", "%s", ["sn"]}, + [{"NICK", "%u", []}, % just use user's part of JID as his nickname + {"FIRST", "%s", ["givenName"]}, + {"LAST", "%s", ["sn"]}, {"FN", "%s, %s", ["sn", "givenName"]}, % example: "Smith, John" {"EMAIL", "%s", ["mail"]}, {"BDAY", "%s", ["birthDay"]}]}, @@ -3123,7 +3123,7 @@ Also we want users to search each other. Let's see how we can set it up: %% Note that JID is always returned with search results {ldap_search_reported, [{"Full Name", "FN"}, - {"Nickname", "NICKNAME"}, + {"Nickname", "NICK"}, {"Birthday", "BDAY"}]} ]} ... @@ -3136,7 +3136,7 @@ searching his info in LDAP. \item \term{ldap\_vcard\_map} example: \begin{verbatim} {ldap_vcard_map, - [{"NICKNAME", "%u", []}, + [{"NICK", "%u", []}, {"FN", "%s", ["displayName"]}, {"CTRY", "Russia", []}, {"EMAIL", "%u@%d", []}, @@ -3157,7 +3157,7 @@ searching his info in LDAP. [{"Full Name", "FN"}, {"Email", "EMAIL"}, {"Birthday", "BDAY"}, - {"Nickname", "NICKNAME"} + {"Nickname", "NICK"} ]}, \end{verbatim} \end{itemize} diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index 768ee954c..0335eac64 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -272,10 +272,10 @@ set_vcard(User, LServer, VCARD) -> "match substring)")}]}, ?TLFIELD("text-single", "User", "user"), ?TLFIELD("text-single", "Full Name", "fn"), - ?TLFIELD("text-single", "Name", "given"), + ?TLFIELD("text-single", "Name", "first"), ?TLFIELD("text-single", "Middle Name", "middle"), - ?TLFIELD("text-single", "Family Name", "family"), - ?TLFIELD("text-single", "Nickname", "nickname"), + ?TLFIELD("text-single", "Family Name", "last"), + ?TLFIELD("text-single", "Nickname", "nick"), ?TLFIELD("text-single", "Birthday", "bday"), ?TLFIELD("text-single", "Country", "ctry"), ?TLFIELD("text-single", "City", "locality"), @@ -442,10 +442,10 @@ search_result(Lang, JID, ServerHost, Data) -> {xmlelement, "reported", [], [?LFIELD("Jabber ID", "jid"), ?LFIELD("Full Name", "fn"), - ?LFIELD("Name", "given"), + ?LFIELD("Name", "first"), ?LFIELD("Middle Name", "middle"), - ?LFIELD("Family Name", "family"), - ?LFIELD("Nickname", "nickname"), + ?LFIELD("Family Name", "last"), + ?LFIELD("Nickname", "nick"), ?LFIELD("Birthday", "bday"), ?LFIELD("Country", "ctry"), ?LFIELD("City", "locality"), @@ -465,10 +465,10 @@ record_to_item(R) -> [ ?FIELD("jid", User ++ "@" ++ Server), ?FIELD("fn", R#vcard_search.fn), - ?FIELD("family", R#vcard_search.family), - ?FIELD("given", R#vcard_search.given), + ?FIELD("last", R#vcard_search.family), + ?FIELD("first", R#vcard_search.given), ?FIELD("middle", R#vcard_search.middle), - ?FIELD("nickname", R#vcard_search.nickname), + ?FIELD("nick", R#vcard_search.nickname), ?FIELD("bday", R#vcard_search.bday), ?FIELD("ctry", R#vcard_search.ctry), ?FIELD("locality", R#vcard_search.locality), @@ -530,10 +530,10 @@ filter_fields([{SVar, [Val]} | Ds], Match, LServer) Match#vcard_search{us = {make_val(LVal), Host}} end; "fn" -> Match#vcard_search{lfn = make_val(LVal)}; - "family" -> Match#vcard_search{lfamily = make_val(LVal)}; - "given" -> Match#vcard_search{lgiven = make_val(LVal)}; + "last" -> Match#vcard_search{lfamily = make_val(LVal)}; + "first" -> Match#vcard_search{lgiven = make_val(LVal)}; "middle" -> Match#vcard_search{lmiddle = make_val(LVal)}; - "nickname" -> Match#vcard_search{lnickname = make_val(LVal)}; + "nick" -> Match#vcard_search{lnickname = make_val(LVal)}; "bday" -> Match#vcard_search{lbday = make_val(LVal)}; "ctry" -> Match#vcard_search{lctry = make_val(LVal)}; "locality" -> Match#vcard_search{llocality = make_val(LVal)}; diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index 1d6041e57..f78d4abd4 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -61,7 +61,7 @@ [{"NICKNAME", "%u", []}, {"FN", "%s", ["displayName"]}, {"FAMILY", "%s", ["sn"]}, - {"GIVEN", "%s", ["givenName"]}, + {"FIRST", "%s", ["givenName"]}, {"MIDDLE", "%s", ["initials"]}, {"ORGNAME", "%s", ["o"]}, {"ORGUNIT", "%s", ["ou"]}, @@ -97,10 +97,10 @@ -define(SEARCH_REPORTED, [{"Full Name", "FN"}, - {"Given Name", "GIVEN"}, + {"Given Name", "FIRST"}, {"Middle Name", "MIDDLE"}, - {"Family Name", "FAMILY"}, - {"Nickname", "NICKNAME"}, + {"Family Name", "LAST"}, + {"Nickname", "NICK"}, {"Birthday", "BDAY"}, {"Country", "CTRY"}, {"City", "LOCALITY"}, @@ -300,7 +300,7 @@ ldap_attribute_to_vcard(vCard, {"fn", Value}) -> {xmlelement,"FN",[],[{xmlcdata,Value}]}; ldap_attribute_to_vcard(vCard, {"nickname", Value}) -> - {xmlelement,"NICKNAME",[],[{xmlcdata,Value}]}; + {xmlelement,"NICK",[],[{xmlcdata,Value}]}; ldap_attribute_to_vcard(vCard, {"title", Value}) -> {xmlelement,"TITLE",[],[{xmlcdata,Value}]}; @@ -332,10 +332,10 @@ ldap_attribute_to_vcard(vCard, {"photo", Value}) -> {xmlelement,"BINVAL",[],[{xmlcdata, jlib:encode_base64(Value)}]}]}; ldap_attribute_to_vcard(vCardN, {"family", Value}) -> - {xmlelement,"FAMILY",[],[{xmlcdata,Value}]}; + {xmlelement,"LAST",[],[{xmlcdata,Value}]}; ldap_attribute_to_vcard(vCardN, {"given", Value}) -> - {xmlelement,"GIVEN",[],[{xmlcdata,Value}]}; + {xmlelement,"FIRST",[],[{xmlcdata,Value}]}; ldap_attribute_to_vcard(vCardN, {"middle", Value}) -> {xmlelement,"MIDDLE",[],[{xmlcdata,Value}]}; diff --git a/src/mod_vcard_odbc.erl b/src/mod_vcard_odbc.erl index 278040ed0..0155e48a0 100644 --- a/src/mod_vcard_odbc.erl +++ b/src/mod_vcard_odbc.erl @@ -272,10 +272,10 @@ set_vcard(User, LServer, VCARD) -> "match substring)")}]}, ?TLFIELD("text-single", "User", "user"), ?TLFIELD("text-single", "Full Name", "fn"), - ?TLFIELD("text-single", "Name", "given"), + ?TLFIELD("text-single", "Name", "first"), ?TLFIELD("text-single", "Middle Name", "middle"), - ?TLFIELD("text-single", "Family Name", "family"), - ?TLFIELD("text-single", "Nickname", "nickname"), + ?TLFIELD("text-single", "Family Name", "last"), + ?TLFIELD("text-single", "Nickname", "nick"), ?TLFIELD("text-single", "Birthday", "bday"), ?TLFIELD("text-single", "Country", "ctry"), ?TLFIELD("text-single", "City", "locality"), @@ -439,10 +439,10 @@ search_result(Lang, JID, ServerHost, Data) -> {xmlelement, "reported", [], [?LFIELD("Jabber ID", "jid"), ?LFIELD("Full Name", "fn"), - ?LFIELD("Name", "given"), + ?LFIELD("Name", "first"), ?LFIELD("Middle Name", "middle"), - ?LFIELD("Family Name", "family"), - ?LFIELD("Nickname", "nickname"), + ?LFIELD("Family Name", "last"), + ?LFIELD("Nickname", "nick"), ?LFIELD("Birthday", "bday"), ?LFIELD("Country", "ctry"), ?LFIELD("City", "locality"), @@ -465,10 +465,10 @@ record_to_item(LServer, {Username, FN, Family, Given, Middle, [ ?FIELD("jid", Username ++ "@" ++ LServer), ?FIELD("fn", FN), - ?FIELD("family", Family), - ?FIELD("given", Given), + ?FIELD("last", Family), + ?FIELD("first", Given), ?FIELD("middle", Middle), - ?FIELD("nickname", Nickname), + ?FIELD("nick", Nickname), ?FIELD("bday", BDay), ?FIELD("ctry", CTRY), ?FIELD("locality", Locality), @@ -533,10 +533,10 @@ filter_fields([{SVar, [Val]} | Ds], Match, LServer) NewMatch = case SVar of "user" -> make_val(Match, "lusername", LVal); "fn" -> make_val(Match, "lfn", LVal); - "family" -> make_val(Match, "lfamily", LVal); - "given" -> make_val(Match, "lgiven", LVal); + "last" -> make_val(Match, "lfamily", LVal); + "first" -> make_val(Match, "lgiven", LVal); "middle" -> make_val(Match, "lmiddle", LVal); - "nickname" -> make_val(Match, "lnickname", LVal); + "nick" -> make_val(Match, "lnickname", LVal); "bday" -> make_val(Match, "lbday", LVal); "ctry" -> make_val(Match, "lctry", LVal); "locality" -> make_val(Match, "llocality", LVal);