User objects will be allocated once they send a message that needs to be displayed, until then the users will just not show up in the user list of the chat.
Adium does not use <img> tags for outgoing inline pictures in messages,
but initalizes a file transfer on its own. Additionally, they also don't
escape outgoing user-entered HTML, which means we must not search for outgoing HTML
<img> tags when using Adium, otherwise we would skip actual message
content.
Do not depend on buddy list entries when looking up the ID from the user name, by maintaining a bi-directional mapping ID <-> username. Rename functions to make them more evident as something that operatos on the lookup. Cleanup blist functions by implementating generic iterator function over account buddies.
If an image is not found its filename will be NULL, which will cause build_filename to just return path of the tmp dir. When passing a directory to set_file_contents, it will attempt to unlink it (as the file already exists), but fail doing do, since unlink doesn't work on directories. This will still cause a scary warning message about "not being able to delete the tmp directory", which is now no longer printed.
Do not assume that a name for each ID can only be set once anymore.
Remove assertion that names always exist, return 0 instead and propagate
error handling to the calling function.
Use print names instead of ids as usernames, to fix problems with "useless" user ids showing up for unknown users and in group chats. Remove workarounds like "Telegram Foreign" needed to temporarily store user names for alias resolution.
Load full chat info lazily, prevents useless network request and should fix issues with delays through flood errors when handling big amounts of user chats. Handle chat participant deletions and additions correctly and only touch the user list when it is actually updated, this should fix some issues with printing annoying messages in Finch and users not showing up in the buddy list in certain situations. Only add chats to buddy list that are actively joined or receive incoming message, which should help keeping the buddy list more tidy when using much chats.