![]() |
C-chat
|
API to communicate with user. More...
Go to the source code of this file.
Functions | |
void | ui_init () |
Initialize required resources for UI. | |
void | ui_cleanUp () |
Free allocated resources for UI. | |
void | ui_reset () |
Reset UI state. More... | |
void | ui_getUserInput (const char *prompt, char *buffer, int buffer_size) |
Get the entered message by the user. More... | |
void | ui_messageReceived (const char *sender, const char *message) |
Displays the given message from the given sender to the user. More... | |
void | ui_informationMessage (const char *message) |
Displays an information message to client. More... | |
void | ui_errorMessage (const char *message) |
Displays an error message to the client. More... | |
void | ui_joinMessage (const char *username) |
Displays a join message to the client. More... | |
void | ui_leaveMessage (const char *username) |
Displays a leave message to the client. More... | |
void | ui_welcomeMessage () |
Displays welcome message to the client. | |
void | ui_usernameChanged (const char *oldUsername, const char *newUsername) |
Tells the client an user changed its username. More... | |
void | ui_successMessage (const char *message) |
Displays a success message to the client. More... | |
API to communicate with user.
This adds an abstraction between main program logic and the way messages are displayed to client.
void ui_errorMessage | ( | const char * | message | ) |
Displays an error message to the client.
message | The error message to display to the client |
void ui_getUserInput | ( | const char * | prompt, |
char * | buffer, | ||
int | buffer_size | ||
) |
Get the entered message by the user.
The user input returned in buffer does not contain an ending carriage return.
prompt | Prompt message |
buffer | Contains the entered message |
buffer_size | The size for the given buffer |
void ui_informationMessage | ( | const char * | message | ) |
Displays an information message to client.
message | The information message to display to client |
void ui_joinMessage | ( | const char * | username | ) |
Displays a join message to the client.
username | The username of the client who joined |
void ui_leaveMessage | ( | const char * | username | ) |
Displays a leave message to the client.
username | The username of the client who left |
void ui_messageReceived | ( | const char * | sender, |
const char * | message | ||
) |
Displays the given message from the given sender to the user.
sender | The sender name to display |
message | The message to display to client |
void ui_reset | ( | ) |
Reset UI state.
To be called in case of ui_getUserInput getting interrupted.
void ui_successMessage | ( | const char * | message | ) |
Displays a success message to the client.
message | The message to display |
void ui_usernameChanged | ( | const char * | oldUsername, |
const char * | newUsername | ||
) |
Tells the client an user changed its username.
oldUsername | The old username of the user |
newUsername | The new username of the user |