GithubHelp home page GithubHelp logo

Redesign client command support. about irc HOT 7 CLOSED

aatxe avatar aatxe commented on August 25, 2024
Redesign client command support.

from irc.

Comments (7)

aatxe avatar aatxe commented on August 25, 2024

So, as @retep998 pointed out to me on IRC, there's no way to actually construct such a Command. So, we'll have to look at different design options. This may just involve finding a way to make from_message more maintainable.

from irc.

isomorpheme avatar isomorpheme commented on August 25, 2024

My 2 cents as someone stumbling upon this: shouldn't Command really be a part of Message, instead of Command being a separate type that can be converted into a Message? Something like:

struct Message {
    prefix: Option<String>,
    command: Command
}

enum Command {
    NICK(String),
    QUIT(Option<String>))
    // etc...
}

As far as I've understood from the RFC, every IRC message is a command as well - chatting in a channel is really just privmsg-ing that channel. So from the data point of view, having only a Message type containing Commands makes more sense. From the usability point of view though, being able to just send Commands to a server makes more sense. But for that case, perhaps you could impl Into<Message> for Command in such a way that the command just gets copied to the message struct, and the prefix left blank. Seems much simpler IMO.

from irc.

aatxe avatar aatxe commented on August 25, 2024

The motivation for keeping them separate before was that there are potentially custom or otherwise unknown commands. This is perhaps less of an issue now that we have mostly complete IRCv3 support, but one example would be Twitch chat has a custom command. One way around this would be to add an Unknown command to the enumeration and to just have it default to either a Vec or perhaps a Vec and a String (separating out the suffix).

from irc.

 avatar commented on August 25, 2024

One of the IRCv3-WG's unofficial policies regarding unknown commands is that they should just be passed to the server straight through—most server implementations these days return numerics for unknown commands, so the client is unlikely to be surprised by a lack of response. Additionally, it makes the need for aliases to work with e.g. services more efficiently entirely obsolete (aside from those servers which don't provide their own aliases, but that's comparatively rare).

A generic 'raw' command, through which unknown-to-the-crate commands flow by default, would probably be most appropriate.

from irc.

aatxe avatar aatxe commented on August 25, 2024

I'll try to work on this at some point, but I'd accept any help. I'd like to implement @ijks's proposal with the Raw command as the default as per @Aerdan's suggestion.

from irc.

ketsuban avatar ketsuban commented on August 25, 2024

Looks like that commit didn't actually close this issue. Github's magic is a little too magical at times, it seems.

from irc.

aatxe avatar aatxe commented on August 25, 2024

I believe it's because it's on a separate branch that I haven't merged in yet. I'm waiting a bit to merge because I'm going to do some other major breaking changes, and I don't want to merge it into master until all the changes are ready for release.

from irc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.