Adds support for writing CTCP ACTIONs with the use of '/m some action'.
This can be done simply by writing '^AACTION some action^A',
but this patch is for people who are too lazy to do that.

Based on patch from Evan Gates (emg) [email protected]
---
 ii.1 |  3 +++
 ii.c | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/ii.1 b/ii.1
index 8e06af7..11cb540 100644
--- a/ii.1
+++ b/ii.1
@@ -81,6 +81,9 @@ quit ii
 .TP
 .BI /t " topic"
 set the topic of a channel
+.TP
+.BI /m " action"
+send action as a CTCP ACTION (think /me)
 .SH RAW COMMANDS
 .LP
 Everything which is not a command will be posted into the channel or to the 
server.
diff --git a/ii.c b/ii.c
index 55d5f52..4ae9d9f 100644
--- a/ii.c
+++ b/ii.c
@@ -459,6 +459,7 @@ proc_channels_input(int ircfd, Channel *c, char *buf)
 {
        char *p = NULL;
        size_t buflen;
+       char tmp[IRC_MSG_MAX-2];
 
        if (buf[0] == '\0')
                return;
@@ -534,6 +535,15 @@ proc_channels_input(int ircfd, Channel *c, char *buf)
                        isrunning = 0;
                        return;
                        break;
+               case 'm':
+                       if (buflen >= 3) {
+                               snprintf(tmp, sizeof(tmp), "\01ACTION %s\01", 
&buf[3]);
+                       } else {
+                               snprintf(tmp, sizeof(tmp), "\01ACTION\01");
+                       }
+                       proc_channels_privmsg(ircfd, c, tmp);
+                       return;
+                       break;
                default: /* raw IRC command */
                        snprintf(msg, sizeof(msg), "%s\r\n", &buf[1]);
                        break;
-- 
2.11.0


Reply via email to