[Pkg-privacy-commits] [irssi-plugin-otr] 108/267: Add every possible msg event to the callback

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:23 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 4cb9fcec0c00503f83bc899cb850bc3ffcc34d86
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Tue Nov 6 00:24:52 2012 -0500

    Add every possible msg event to the callback
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/irssi_otr.h |  3 +++
 src/module.c    |  2 +-
 src/otr-ops.c   | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/src/irssi_otr.h b/src/irssi_otr.h
index a2e50ff..8393d34 100644
--- a/src/irssi_otr.h
+++ b/src/irssi_otr.h
@@ -80,3 +80,6 @@ void otr_query_create(IRC_CTX *ircctx, const char *nick);
 	if (debug) { \
 		otr_query_create(ircctx,nick); \
 		printformat(ircctx,nick,MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__); } }
+
+#define IRSSI_WARN(irssi_ctx, username, fmt, ...) \
+	printtext(irssi_ctx, username, MSGLEVEL_HILIGHT, fmt, ## __VA_ARGS__);
diff --git a/src/module.c b/src/module.c
index 57077b6..25a2e3b 100644
--- a/src/module.c
+++ b/src/module.c
@@ -49,7 +49,7 @@ static void sig_server_sendmsg(SERVER_REC *server, const char *target,
 		const char *msg, void *target_type_p)
 {
 	int ret;
-	char *otrmsg;
+	char *otrmsg = NULL;
 
 	if (GPOINTER_TO_INT(target_type_p) != SEND_TARGET_NICK) {
 		goto end;
diff --git a/src/otr-ops.c b/src/otr-ops.c
index 0cbec11..2235d9f 100644
--- a/src/otr-ops.c
+++ b/src/otr-ops.c
@@ -284,6 +284,44 @@ static void ops_handle_msg_event(void *opdata, OtrlMessageEvent msg_event,
 	IRC_CTX *server = opdata;
 	char *username = context->username;
 
+	switch (msg_event) {
+	case OTRL_MSGEVENT_NONE:
+		break;
+	case OTRL_MSGEVENT_ENCRYPTION_REQUIRED:
+		IRSSI_WARN(server, username, "Encryption is required");
+		break;
+	case OTRL_MSGEVENT_ENCRYPTION_ERROR:
+		break;
+	case OTRL_MSGEVENT_CONNECTION_ENDED:
+		break;
+	case OTRL_MSGEVENT_SETUP_ERROR:
+		break;
+	case OTRL_MSGEVENT_MSG_REFLECTED:
+		break;
+	case OTRL_MSGEVENT_MSG_RESENT:
+		break;
+	case OTRL_MSGEVENT_RCVDMSG_NOT_IN_PRIVATE:
+		break;
+	case OTRL_MSGEVENT_RCVDMSG_UNREADABLE:
+		break;
+	case OTRL_MSGEVENT_RCVDMSG_MALFORMED:
+		break;
+	case OTRL_MSGEVENT_LOG_HEARTBEAT_RCVD:
+		break;
+	case OTRL_MSGEVENT_LOG_HEARTBEAT_SENT:
+		break;
+	case OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR:
+		break;
+	case OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED:
+		IRSSI_WARN(server, username,
+				"Following message was NOT encrypted: [%s]", message);
+		break;
+	case OTRL_MSGEVENT_RCVDMSG_UNRECOGNIZED:
+		break;
+	case OTRL_MSGEVENT_RCVDMSG_FOR_OTHER_INSTANCE:
+		break;
+	}
+
 	otr_debug(server, username, TXT_OPS_HANDLE_MSG,
 			otr_msg_event_txt[msg_event], message);
 }

-- 
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