Comments (7)
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.
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 Command
s makes more sense. From the usability point of view though, being able to just send Command
s 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.
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.
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.
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.
Looks like that commit didn't actually close this issue. Github's magic is a little too magical at times, it seems.
from irc.
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)
- Command enum missing in docs HOT 1
- Your front-page example HOT 9
- irc::proto: errors on `MODE #chan` client query HOT 2
- SASL and PING timeouts HOT 3
- when running I get error HOT 1
- tokio 0.3 / tokio-codec 0.5 HOT 2
- Links to IRCv3.1 and IRCv3.2 are no longer available, IRCv3 WG no longer issues point releases HOT 1
- Allow invalid certificates HOT 6
- How do I produce meaningful error messages? HOT 1
- Bot is joining channels before identifying
- send_mode(target, modes) only sends first mode when more then one mode is specified.
- Broken pipe while attempting to get stream's next message. HOT 1
- tls-rust HOT 1
- run examples code in my lib error HOT 5
- Sends seem to be buffered HOT 3
- Sending tags with messages HOT 4
- Release 0.15.1 HOT 6
- Config::load docs are wrong
- nochanlists feature is not additive
- dangerously_accept_invalid_certs option for irc servers with self-signed certs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irc.