Update acquaintances when receiving these notifications from direct4b.com:
notify_add_talkers
notify_delete_talk
notify_delete_talker
Tests without accessing to direct4b.com, for the functions called when receiving the notifications above.
Expose some functions in direct-hs and network-messagepack-rpc for testing.
New way to store acquaintances of Client:
When receiving notify_add_talkers, the client can get only the user IDs of the new talkers: the client can't update acquaintances due to lack of the details (such as screen names) of the new talkers.
In addition, direct4b.com doesn't seem to provide some API to get details of a user by the user ID anyway!
To get correct and up-to-date information of acquaintances, I decided not to update acquaintances immediately after receiving notify_add_talkers: Instead, invalidate the cache of acquaintances when the client should get the details of new talkers after receiving notify_add_talkers.
After invalidating the cache of acquaintances, getAcquaintances and modifyAcquaintances automatically call the MessagePack RPC function get_acquaintances to get correct and up-to-date information of acquaintances again then cache it.
notify_add_talkers
notify_delete_talk
notify_delete_talker
acquaintances
ofClient
:notify_add_talkers
, the client can get only the user IDs of the new talkers: the client can't updateacquaintances
due to lack of the details (such as screen names) of the new talkers.notify_add_talkers
: Instead, invalidate the cache ofacquaintances
when the client should get the details of new talkers after receivingnotify_add_talkers
.acquaintances
,getAcquaintances
andmodifyAcquaintances
automatically call the MessagePack RPC functionget_acquaintances
to get correct and up-to-date information of acquaintances again then cache it.