iiegor / xat-server

A Node.js private server of xat.com
6 stars 2 forks source link

Common user method to build user information packet #27

Open iiegor opened 8 years ago

iiegor commented 8 years ago

This issue arises from the need to create a common method due to the amount (increasing) of duplicated user messages sent from different server classes and all of them hardcoded (this causes issues like missing packet attributes.. etc). See chat.coffee for example.

To solve this I propose to create a common method in user.coffee called for example buildUser() or something similar. This method will return a modificable packet built with the server builder so we can append later other information if needed. If the requested user is not online then we will need to create some condition to request that data from database.