Skip to content

Feat/refactor - #2

Draft
Portevent wants to merge 11 commits into
devfrom
feat/refactor
Draft

Portevent wants to merge 11 commits into
devfrom
feat/refactor

Conversation

@Portevent

@Portevent Portevent commented Mar 16, 2024

Copy link
Copy Markdown
Member

Refactor yet incomplet.
TODOs :

  • Add new function to send message / close room / etc...
  • Implement remaining Packet recipient
  • Rework some imports that need to be properly done (some were poorly written to avoid ciruclar import reference)
  • DONE Improve display to scroll up when messages reach end of display
  • DONE Some Packet are written in some weird place (i.e. the connection packets are created by the Server and not directly the client). It may be more suitable to change that so all packet are made in the same class

@Portevent Portevent added the enhancement New feature or request label Mar 16, 2024
@Portevent
Portevent requested a review from aaryswastaken March 18, 2024 12:14

@aaryswastaken aaryswastaken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add headers to your files and update the issue with the room id

Comment thread client/simple_client/identity_manager.py
Comment thread client/simple_client/simple_client.py
Comment thread client/simple_client/simple_client.py Outdated
self.packetGenerator = PacketGenerator(self)

# Start the server
self.server = Server(FakeConnection(), self)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FakeConnection() should be optional and specifiable in the constructor

self.display.display_error(f"Unexpected error while reading {bytes_to_str(pck)} : {type(e)} {e}")

def interpret(self, packet: Packet):
match packet.code:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt even knew matches exists

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will read packet handling later

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Python took its time to implement switchs but in the end it made them better than other languages (match can use regex, unpack value from matched value etc...)

Comment thread client/simple_client/simple_client.py
Comment thread client/simple_client/simple_client.py Outdated
Comment thread client/simple_client/simple_client_connection_state.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants