On Thu, Sep 07, 2017 at 10:21:52PM +0200, Jan Klemkow wrote: > Hi, > > this path applies action command support to ii. It was developed at the > slcon4, but I was to lazy. So, I sent it now. > > Any comments or questions? > > Bye, > Jan > > From 1ddd9265ff3601cc07181d3fc79d33296c77adaf Mon Sep 17 00:00:00 2001 > From: Jan Klemkow <j.klem...@wemelug.de> > Date: Thu, 7 Sep 2017 22:00:29 +0200 > Subject: [PATCH] add support for irc action command > > --- > ii.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/ii.c b/ii.c > index 6583792..e2db622 100644 > --- a/ii.c > +++ b/ii.c > @@ -505,6 +505,17 @@ proc_channels_input(int ircfd, Channel *c, char *buf) > snprintf(msg, sizeof(msg), "NICK %s\r\n", > &buf[3]); > } > break; > + case 'm': /* action */ > + if (buflen >= 3) { > + snprintf(msg, sizeof(msg), "*%s %s", nick, > &buf[3]);
Minor nitpick, I'd prefer a space after the wildcard: > + snprintf(msg, sizeof(msg), "* %s %s", nick, > &buf[3]); > + channel_print(c, msg); > + snprintf(msg, sizeof(msg), > + "PRIVMSG %s :\01ACTION %s\01\r\n", > + c->name, &buf[3]); > + ewritestr(ircfd, msg); > + return; > + } > + break; > case 'l': /* leave */ > if (c == channelmaster) > return; > @@ -545,6 +556,7 @@ proc_server_cmd(int fd, char *buf) > Channel *c; > const char *channel; > char *argv[TOK_LAST], *cmd = NULL, *p = NULL; > + char text[IRC_MSG_MAX] = { '\0', '\0' }; > unsigned int i; > > if (!buf || buf[0] == '\0') > @@ -641,8 +653,12 @@ proc_server_cmd(int fd, char *buf) > snprintf(msg, sizeof(msg), "-!- \"%s\")", > argv[TOK_TEXT] ? argv[TOK_TEXT] : ""); > } else if (!strcmp("PRIVMSG", argv[TOK_CMD])) { > - snprintf(msg, sizeof(msg), "<%s> %s", argv[TOK_NICKSRV], > - argv[TOK_TEXT] ? argv[TOK_TEXT] : ""); > + if (sscanf(argv[TOK_TEXT], "\01ACTION%[^\01]\01", text) == 1) > + snprintf(msg, sizeof(msg), "*%s %s", argv[TOK_NICKSRV], > + *text ? &text[1] : ""); You should use a regular check here (strncmp?) without the extra text buffer. > + else > + snprintf(msg, sizeof(msg), "<%s> %s", argv[TOK_NICKSRV], > + argv[TOK_TEXT] ? argv[TOK_TEXT] : ""); > } else { > return; /* can't read this message */ > } Is this meant for upstream ii? With the changes I think its reasonable to include this in the upstream version. Any thoughts or is it bloat? -- Kind regards, Hiltjo