Skip to content

Feat/refactor#2

Draft
Portevent wants to merge 11 commits intodevfrom
feat/refactor
Draft

Feat/refactor#2
Portevent wants to merge 11 commits intodevfrom
feat/refactor

Conversation

@Portevent
Copy link
Member

@Portevent Portevent commented Mar 16, 2024

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
Copy link
Member

@aaryswastaken aaryswastaken left a comment

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

self.packetGenerator = PacketGenerator(self)

# Start the server
self.server = Server(FakeConnection(), self)
Copy link
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
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
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
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...)

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