Skip to content
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

Support optional message metadata tagged with @ (non-RFC) #7

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

hermiteer
Copy link

Added optional metadata string to IRCMessage
Changed IRCMessageParser to look for message metadata

Changed IRCMessageParser to look for message metadata
@hermiteer hermiteer marked this pull request as draft June 21, 2024 21:34
Copy link
Member

@helje5 helje5 left a comment

Choose a reason for hiding this comment

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

Thanks! Left some notes.

if cursor[cursor.startIndex] == cColon {
// let spaceIdx = cursor.firstIndex(of: cSpace)
Copy link
Member

Choose a reason for hiding this comment

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

I think we should probably remove such comments? :-)

@@ -64,7 +64,8 @@ public protocol IRCDispatcher {
message : String) throws
func doMessage (sender : IRCUserID?,
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to keep the old API as well for backwards compat, i.e. the one taking no metadata. The default implementation of the one w/ metadata could call into the older method (vs raising notImplemented).

@@ -135,13 +136,37 @@ public struct IRCMessageParser {
return String(data: Data(slice), encoding: .utf8) // Sigh, the pain.
}

/* parse metadata */

let metadataSource : Swift.Slice<UnsafeRawBufferPointer>?
Copy link
Member

Choose a reason for hiding this comment

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

Consistent indent w/ the rest would be nice :-) (I don't personally care too much about indentation styles, but they should be consistent within a project, which is 2-space right now in NIOIRC)


if cursor[cursor.startIndex] == cAt {
let startIndex = cursor.startIndex.advanced(by: 1)
let spaceIdx = line.firstIndex(of: cSpace)
Copy link
Member

Choose a reason for hiding this comment

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

Is it safe to assume that the metadata itself doesn't contain spaces? Is there some escaping maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants