Hi folks,
I’m elbow deep in the openfire source right now, trying to figure out the best way to put more than one ldap attribute in the username field.
Specifically we want the username to be ({phone number}) when it shows up in pidgin (or w/e client you use).
Has anyone had any luck with this? How did you approach it. (Let me say that we don’t really want to manually enter a new field in LDAP for every employee, or manually enter anything. Our solution needs to use the fields already in LDAP and automatically smush them together.)
My current approach is to subclass LDAPManager and override retrieveList() to intercept the names as they are being pulled from LDAP.
//HACK!!!!!!!!!!!!
// Get the next result.
SearchResult next = (SearchResult)answer.next();
String result = (String)(next).getAttributes().get(attribute).get() + " (" + (String)(next).getAttributes().get("phone number").get() + ")";
// Remove suffixToTrim if set
if (suffixToTrim != null && suffixToTrim.length() > 0 && result.endsWith(suffixToTrim)) {
result = result.substring(0,result.length()-suffixToTrim.length());
}
Is there a smarter approach to this that anyone more familiiar with the source can point me towards?
Thanks,
Tim Maxwell
Optaros, Inc.