-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: develop
Are you sure you want to change the base?
Conversation
Changed IRCMessageParser to look for message metadata
There was a problem hiding this 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) |
There was a problem hiding this comment.
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?, |
There was a problem hiding this comment.
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>? |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
Added optional metadata string to IRCMessage
Changed IRCMessageParser to look for message metadata