Search for Users - Adding Contacts: Nickname Issues

It’s elgwhoppo again, posting up with another slightly different Display Name issue than posted before.

When searching for users through person search, all information is found and properly laid out in the search window. However, when we right click and add that contact from the search window, the JID is placed in the username field instead of the username, thus incorrectly propogating the nickname.

10 bucks to the guy who knows where/how to change this setting. Not literally, but if you think points are worth dollars then yes.

Thanks in advance.


This is a spark bug. It does not pull that info from the Openfire server but enters it based on the JID. You can delete that info and tab out of the field to force and LDAP lookup or use shared groups to avoid this all together.

What Todd said… this is exactly what we have to do. It works but it’s irritating…

It was stated in this thread that this is Spark bug, but searching the open bugs does not turn up any issues that match this one. In case a developer happens to read this and would like to open a bug that would nice.

The issue is that in UserSearchResults.java the event handler for the data column is not reading from the correct column name:

Action addContactAction = new AbstractAction() {

public void actionPerformed(ActionEvent e) {

RosterDialog dialog = new RosterDialog();

String jid = (String)resultsTable.getValueAt(row, 0);

TableColumn column = null;

try {

column = resultsTable.getColumn(“Username”);

}

catch (Exception ex) {

try {

column = resultsTable.getColumn(“nick”);

Line 135. The issue is that the column name must have changed at some point and is now called “Name” instead of “nick”. The changes I made to fix this issue:

Action addContactAction = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
RosterDialog dialog = new RosterDialog();
String jid = (String)resultsTable.getValueAt(row, 0);
String nickName;
TableColumn nickNameColumn = null;

try
{
 nickNameColumn = resultsTable.getColumn("Name");

 int col = nickNameColumn.getModelIndex();
                nickName = (String)resultsTable.getValueAt(row, col);
                if (!ModelUtil.hasLength(nickName))
 {
                    nickName = StringUtils.parseName(jid);
                }
                dialog.setDefaultNickname(nickName);
            }
            catch (Exception ex) {}

dialog.setDefaultJID(jid);
dialog.showRosterDialog();
}
};

Enjoy.

Todd (not the same Todd that posted earlier).