Default to Name or Nickname on subscription request dialog

Description

When subscription request pops up in Spark when someone wants to add you to their roster, Spark shows their username and then prepopulates the Nickname field with their username as well. Nickname field can be edited before approving the request and adding this user to your contacts, but sometimes username can be undistinguishable (especially in closed environment, when username can be just numbers or some other code). So it could be useful for Spark to try to pull user's Name or Nickname first and only then fallback to username (or nothing actually, leaving it up to a user to name his new contact).

Environment

None

Attachments

1

Activity

Show:

wroot December 18, 2016 at 11:32 AM

I'm starting to think maybe that's not possible to fetch user's nickname when he is not in your roster yet. SparkManager.UserManager()getUserNicknameFromJID(jid) can't do that and still pulls the username.

wroot November 27, 2016 at 11:43 AM

The code is in https://github.com/igniterealtime/Spark/blob/master/src/java/org/jivesoftware/spark/ui/SubscriptionDialog.java at 197 line

Currently it assigns field Nickname with a value of a jid stripped of its second part (username). I think it should be possible to load a vCard of that user and pull his name or nickname and do try-catch here in order: name, nickname, username.

Details

Priority

Assignee

Reporter

Affects versions

Components

Created November 27, 2016 at 10:37 AM
Updated March 15, 2019 at 8:58 AM