Open saschalalala opened 9 years ago
Sounds like a useful feature!
This seems like something that should be implemented in the UI layer rather than the library.
The key for a user should be the user ID. Currently this would be difficult to configure because the UI doesn't expose the IDs anywhere, but in the future we could just make the entire thing configurable within the UI anyways.
So you mean, parsing the nickname file in main.py and set the name properly? For me, it seems like there are many ways to achieve this. The most elegant way in my opinion at the moment would be to call a function user.get_display_name() that would return the nick_name if it exists and the first_name otherwise. So all calls to user.first_name would be replaced by user.get_display_name.
Extending the User
class would be easy, but I think these client-side nicknames belong in the UI code rather than the library. I'd suggest adding a get_user_name
function to in hangups/ui/utils.py
and have the rest of the UI code call that instead of User.first_name
.
At the moment, you can only see the first names of users in group chats which can be confusing when there are a lot of users with the same name. At the moment, I hard coded some nicknames into user.py, but of course, this is not very convenient. I am planning to write a patch that reads a json file in your home which contains user customizable nicknames in the form
{ "Real Name": "Nickname", "Real Name2": "Nickname2" }
which can be read by hangups and set as user.first_name (so that there is nothing to change in the rest of the code) or as user.nickname (that would need a few changes in the code). Would you implement something like this and if yes, which way would you prefer?