[Pkg-privacy-commits] [irssi-plugin-otr] 194/267: Fix: handle IRC /me marker on msg receive

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.

commit b95b0077d8357d5586d67507c2c17b3006ee9ac7
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Wed Mar 20 23:18:15 2013 -0400

    Fix: handle IRC /me marker on msg receive
    
    Reported-by: Micah Anderson <micah at riseup.net>
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/module.c | 17 ++++++++++++++---
 src/otr.h    |  4 ++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/module.c b/src/module.c
index 06c8b46..46eae8f 100644
--- a/src/module.c
+++ b/src/module.c
@@ -108,8 +108,19 @@ void sig_message_private(SERVER_REC *server, const char *msg,
 		/* This message was not OTR */
 		signal_continue(4, server, msg, nick, address);
 	} else {
-		/* OTR received message */
-		signal_continue(4, server, new_msg, nick, address);
+		/*
+		 * Check for /me IRC marker and if so, handle it so the user does not
+		 * receive a message beginning with /me but rather let irssi handle it
+		 * as a IRC action.
+		 */
+		if (!strncmp(new_msg, OTR_IRC_MARKER_ME, OTR_IRC_MARKER_ME_LEN)) {
+			signal_stop();
+			signal_emit("message irc action", 5, server,
+					new_msg + OTR_IRC_MARKER_ME_LEN, nick, address, nick);
+		} else {
+			/* OTR received message */
+			signal_continue(4, server, new_msg, nick, address);
+		}
 	}
 
 end:
@@ -157,7 +168,7 @@ static void cmd_me(const char *data, IRC_SERVER_REC *server,
 
 	target = window_item_get_target(item);
 
-	ret = asprintf(&msg, "/me %s", data);
+	ret = asprintf(&msg, OTR_IRC_MARKER_ME "%s", data);
 	if (ret < 0) {
 		goto end;
 	}
diff --git a/src/otr.h b/src/otr.h
index 69952c3..828c541 100644
--- a/src/otr.h
+++ b/src/otr.h
@@ -54,6 +54,10 @@
 #define OTR_MSG_BEGIN_TAG             "?OTR:"
 #define OTR_MSG_END_TAG               '.'
 
+/* IRC /me command marker and len. */
+#define OTR_IRC_MARKER_ME             "/me "
+#define OTR_IRC_MARKER_ME_LEN         sizeof(OTR_IRC_MARKER_ME) - 1
+
 /*
  * Memory allocation zeroed. Really useful!
  */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git



More information about the Pkg-privacy-commits mailing list