-
Notifications
You must be signed in to change notification settings - Fork 0
User Control
Suroor Hussain edited this page Jan 1, 2016
·
4 revisions
The user control layer contains the implementation for all the actions that is done by a user. To do this, a 'User' class is provided. The user data is stored as a file named after the user's username. an extension is omitted because we are storing the user data as a dictionary.
user_data = { 'username':username of the user, 'password':the user's password, 'registered_channels':The channels previously added by the user, 'credentials':{'Facebook':{'access_token':accesstoken}, 'Twitter':{'consumer_key':consumerkey,....},'Mail':{...}} }
A function add_user() is also provided.
Creating an object of the user class opens the user's file and extracts the user data from it. The user class has thew following methods:
- my_channels(): returns the list of channels added by the user - registered_channels
- add_channel(channel_name): adds the 'channel_name' channel to users registerd_channels
- remove_channel(channel_name): removes 'channel_name' channel from registered_channels
- send(message, selected_channels): Posts 'message' to the channels specified in 'selected_channels'
- save_user_data(): Writes the user data to file and closes it.
Adds a user file to the system.