- Diagnostics
- Logging
- Instrumentation
- Schedulers
- Concurrency
- UI-thread
- Connectivity
- Service status (connected or disconnected)
- Presented status (available, away, busy, etc.)
- User preferences
- User dialogs and input prompts
- User emulator (robot)
- In-proc service
- Start the GUI in the following state:
- Server URL field, user name field and Connect button are enabled.
- The user name from their last session is displayed by default in the user name field.
- Chat GUI elements are disabled (including the message list and the Send button).
- Load the user's preferences.
- If the last user name was saved, pre-populate the user name textbox.
- If the last service URL was saved, pre-populate the service URL textbox.
- If enabled, verify that the user's configured sound is available and it can be played.
- If it cannot, display a warning to the user.
- The user can set their "user name" before connecting.
- The user must enter a service URL and click a Connect button.
- When the Connect button is pressed, and the user name is valid, and the service URL is a valid URI:
- Disable the Connect button.
- Display a waiting animation and a Cancel button.
- Try connecting to the specified URL.
- If the connection cannot be established, or if the service URL is invalid:
- Display any network, service or URL-validation errors.
- Focus the service URL and select it.
- Enable the Connect button. (goto #2)
- If the Cancel button is pressed:
- Cancel the connection attempt that is in-progress (best effort).
- If the cancellation is unsuccessful:
- Try disconnecting from the specified URL.
- If the program fails to disconnect gracefully, then log any errors and continue.
- Try disconnecting from the specified URL.
- Enable the Connect button. (goto #2)
- If the service requires authentication:
- Prompt the user to enter a password.
- If the server rejects the password:
- Enable the Connect button. (goto #2)
- If the server rejects the password:
- Prompt the user to enter a password.
- Otherwise, change the Connect button into a Disconnect button and enable it.
- Enable the chat GUI so that messages may be sent and received.
- Save the user name and service URL in the user's preferences.
- When the Disconnect button is pressed:
- Disable it.
- Try disconnecting from the specified URL.
- If the program fails to disconnect gracefully, then log any errors and continue.
- Change the Disconnect button into a Connect button and enable it. (goto #2)
- Disable the chat GUI to prevent messages from being sent or received.
- When the Connect button is pressed, and the user name is valid, and the service URL is a valid URI:
- When a message is received:
- If the user's status is not "offline" and the message matches the user's current filter criteria (if any):
- Append the message to the message list.
- Include the date and/or time based on the user's current preferences.
- Render the message in the font, size and color received with the message. If none received, use defaults.
- If the option to play a sound is enabled, and the chat window is not currently in focus:
- Play the user's configured sound.
- Append the message to the message list.
- If the user's status is not "offline" and the message matches the user's current filter criteria (if any):
- When the 'Enter' key is pressed or the 'Send' button is clicked:
- If the message is not entirely whitespace:
- Send the message to the server.
- Include the current font, size and color with the message. Omit them if they are currently the defaults.
- Send the message to the server.
- If the message is not entirely whitespace:
- Load the server settings.
- If any white-listed IP addresses are specified, verify they are valid URIs.
- If any IP is invalid, stop the service with an unhandled exception.
- Listen for client connections.
- When a client connection is received:
- If the client's IP address is not in the white-list:
- Terminate the connection immediately, without any response. (end)
- If authentication is enabled:
- Send a password request message to the client.
- If sending fails, then terminate the connection immediately. (end)
- await a password response message.
- If the password does not match or a password is not received within 2 minutes:
- Terminate the connection immediately, without any response. (end)
- Send a password request message to the client.
- Otherwise, add the client to the subscription list.
- Multicast a message: "User NAME has entered the chat.".
- Listen for messages.
- If the client's IP address is not in the white-list:
- When a client disconnects or is later determined to be in a disconnected state:
- Remove the client from the subscription list.
- When a message is received:
- Send the message to each client in the subscription list, including the original sender.
- If sending fails, then terminate the connection immediately. (end)
- Send the message to each client in the subscription list, including the original sender.