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 for CTCP commands #80

Closed
kdkasad opened this issue Oct 24, 2020 · 9 comments · Fixed by #79
Closed

Support for CTCP commands #80

kdkasad opened this issue Oct 24, 2020 · 9 comments · Fixed by #79
Assignees
Labels
enhancement New feature or request

Comments

@kdkasad
Copy link
Contributor

kdkasad commented Oct 24, 2020

There are a few CTCP (client-to-client protocol) commands that are used frequently in IRC. The most useful/common are:

  • VERSION
  • PING
  • ACTION
  • CLIENTINFO

It would be great if kirc supported these.

I've added support for them in my fork, but since I'm nowhere near as good at C programming as @mcpcpc, I expect there's a much more elegant solution:
https://git.kasad.com/kirc/log/?h=devel

@mcpcpc mcpcpc added the enhancement New feature or request label Oct 24, 2020
@mcpcpc mcpcpc self-assigned this Oct 24, 2020
@mcpcpc mcpcpc linked a pull request Oct 24, 2020 that will close this issue
@mcpcpc
Copy link
Owner

mcpcpc commented Oct 25, 2020

@kdkasad #79 is ready to be merged with the CTCP commands. It’s mostly based on your implementation, although I have not tested it yet (need to do some more reading on CTCP first).

@kdkasad
Copy link
Contributor Author

kdkasad commented Oct 25, 2020

I can do some testing. I looked through the code and it seems like it should be fine. I didn't implement the TIME command, which according to the spec should be implemented.

@mcpcpc
Copy link
Owner

mcpcpc commented Oct 26, 2020

I can do some testing. I looked through the code and it seems like it should be fine. I didn't implement the TIME command, which according to [the spec].

I would appreciate the testing. Also, added the CTCP TIME command.

@kdkasad
Copy link
Contributor Author

kdkasad commented Oct 27, 2020

ACTION, VERSION, CLIENTINFO, and PING work. TIME does not.

I think the problem is that the raw response command should be:

NOTICE <source nick> :\001TIME <current time>\001\r\n

Currently it is:

NOTICE <source nick> :\001<current time>\001\r\n

I also added support for sending the ACTION CTCP command using the /me command, as is standard in most clients:
https://git.kasad.com/kirc/commit/?id=16b98708eace1ce3c6f931199687940d3cbb1bfd
Although I wonder if it would be better to handle that differently so it works when using the @<#channel|nick> command, not just the default channel.

@mcpcpc
Copy link
Owner

mcpcpc commented Oct 27, 2020

Fixed the syntax for the TIME command (fc24702).

Although I wonder if it would be better to handle that differently so it works when using the @<#channel|nick> command, not just the default channel.

Added the equivalent /me command alias as @@ (223d2e5). Let me know your thoughts. Not sure if i am the biggest fan, but it works.

@kdkasad
Copy link
Contributor Author

kdkasad commented Oct 27, 2020

Looks good. It might be nice to make that work for private messages, too, but I think that would require duplicating code or creating another function. I'll see if I can find a nice way to do it.

@kdkasad
Copy link
Contributor Author

kdkasad commented Oct 27, 2020

After using it for a bit, I think it would be good to change the color of the nick which sends an ACTION command. It's impossible to tell the difference between a normal message and an ACTION, especially when the message is sent to the non-default channel.

I think that would be a lot easier than changing the message text to include the nick, which would require allocating a new string.

Here's my implementation of that:
https://git.kasad.com/kirc/commit/?h=nick-highlight&id=44906148ce66b86ef68ae45f525d2299e727f287

@mcpcpc
Copy link
Owner

mcpcpc commented Oct 28, 2020

looking a little bit more at CTCP, i think just implementing the /me equivalent command alias might be too limiting. Instead, a generic ACTION privmsg should be preferred (i.e. @@mcpcpc waves fist! or @@#archlinux waves fist. Ultimately, more characters to type, but helps keep the custom command aliases down. Open to a counter argument though.

Also, regarding color coding the nick to help identify ACTION messages received might not be the best idea. For a new users, this might be confusing since there is no explanation to what specific colors mean. As kirc should be intuitive as possible, it might make more sense to prefix each message with the protocol type.

Will play around with it a bit. still trying to figure out which looks the cleanest and most intuitive.

@mcpcpc
Copy link
Owner

mcpcpc commented Oct 28, 2020

Pushed 9525bb8 for now. Command structure is as previously described and all ACTION messages now are prefixed in the message. Still not 100% pleased with it, but i think it’s a good start.

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 a pull request may close this issue.

2 participants