Support more flexible displayname_preferences
I would like to show both the username and full name of Telegram users in the display names of their puppets, like username (First Last). But instead of adding this as another option to the possible values to displayname_preferences, what about the following:
-
Make the elements of
displayname_preferencesformat strings. So the format I'd like to implement will be{username} ({first_name} {last_name}). -
If any of the variables referenced in the format string does not exist, the next one is tried. For example, suppose that the list of
displayname_preferencesis:- {username} ({first_name} {last_name}) - {username} ({first_name}) - {username}If the user has a username, first name and last_name; the first one is chosen. If they don't have a last name, the first one is skipped and the second one is chosen. If they have neither first name nor last name, the last one is chosen.
This is similar to how the preferences are used now, just a bit more sophisticated.
-
The current supported values are translated internally to format strings, when matched exactly; for example,
usernametranslates to{username}, butusername: {username}is not translated.
If this is a good idea, I can try to implement this.
It seems to be good idea, I'd like to have both - usernames and full names in puppet name