-
Notifications
You must be signed in to change notification settings - Fork 0
Implement IRC-style channels #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
google-labs-jules
wants to merge
7
commits into
main
Choose a base branch
from
feature/irc-channels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit updates the command descriptions in the `/help` output to be more descriptive and user-friendly. The new descriptions provide clearer explanations of what each command does. The formatting has also been improved for better readability.
This commit fixes a race condition on the server that occurred when multiple clients interacted with shared data structures (clients, usernames, channels) concurrently. A `threading.Lock` has been introduced to protect all access to these shared resources. The server logic, including user registration, command handling, message broadcasting, and client disconnection, has been refactored to use this lock. Key changes: - Introduced a global lock in `server.py`. - Wrapped all modifications and reads of shared data in `with lock:` blocks. - Refactored the `broadcast` function to iterate over a copy of the socket list to avoid holding the lock during network I/O. - Made the username checking process in `handle_client` thread-safe.
This commit fixes a deadlock on the server that was introduced in the previous thread-safety fix. The deadlock occurred because different parts of the server code were trying to acquire the same non-reentrant lock that they already held. The fix replaces `threading.Lock` with `threading.RLock` (a re-entrant lock), which is designed to be acquired multiple times by the same thread without deadlocking. This resolves the freezing issue you reported and restores normal application functionality.
This commit fixes a bug where the chat display would not scroll when the content exceeded the viewport height. The root cause was the use of a `Static` widget for the chat display, which is not designed for scrollable content. This has been replaced with a `Log` widget from the `textual` library, which is the correct component for this purpose. The client-side message handling logic has been refactored to write messages directly to the `Log` widget, which handles automatic scrolling and provides a much more efficient and clean implementation.
This commit fixes a `TypeError` that occurred because `Log` widgets were being used for content that was not a simple line-based log. The `channel_display` and `users_display` widgets have been reverted to `Static` widgets, as they are used to display blocks of text that are updated periodically. The `chat_display` remains a `Log` widget to correctly handle the scrolling stream of chat messages. The `update_displays` method has also been corrected to use the `.update()` method for the `Static` widgets, which is the correct way to replace their content. This resolves the `TypeError` and restores client functionality.
This commit addresses two issues: 1. A `TypeError` caused by passing a `rich.text.Text` object to the `Log.write()` method, which expected a string. 2. A chat scrolling problem where the chat window would not scroll to new messages. The `chat_display` widget has been reverted to a `Static` widget, which correctly handles `Text` objects, fixing the `TypeError`. The original, more robust logic of using a `chat_log` list to manage messages has been restored. Auto-scrolling has been implemented by calling `self.chat_display.scroll_end()` after each content update, ensuring the chat view always shows the latest message. This resolves the initial scrolling complaint.
This commit fixes a persistent chat scrolling issue where the chat window would not automatically scroll to the latest message. The problem was caused by a race condition: the scroll command was being executed immediately after the content update, but before the `textual` engine had re-rendered the widget and recalculated its scroll dimensions. The fix is to defer the scroll command using `self.call_later()`. This schedules the scroll operation to run on the next UI update cycle, ensuring that the widget's content has been updated and the correct scroll dimensions are available. This resolves the timing issue and ensures reliable auto-scrolling.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
None yet
0 participants
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This feature adds IRC-style channels to the chat application, allowing users to create, join, and leave different chat rooms.