[Pkg-privacy-commits] [irssi-plugin-otr] 132/267: Allow empty secret and add coloring

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:25 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 cdb2099c7bc5aae2de38fa1fc2d0dc7f145b07e3
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Wed Nov 14 15:58:21 2012 -0500

    Allow empty secret and add coloring
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/otr-ops.c |  2 +-
 src/otr.c     | 24 ++++++++++++++----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/otr-ops.c b/src/otr-ops.c
index c733047..3454ea7 100644
--- a/src/otr-ops.c
+++ b/src/otr-ops.c
@@ -347,7 +347,7 @@ static void ops_smp_event(void *opdata, OtrlSMPEvent smp_event,
 		otr_status_change(irssi, from, OTR_STATUS_SMP_FINALIZE);
 		break;
 	case OTRL_SMPEVENT_SUCCESS:
-		IRSSI_NOTICE(irssi, from, "%GAuthentication successful%n");
+		IRSSI_NOTICE(irssi, from, "%gAuthentication successful.%n");
 		otr_status_change(irssi, from, OTR_STATUS_SMP_SUCCESS);
 		break;
 	case OTRL_SMPEVENT_ABORT:
diff --git a/src/otr.c b/src/otr.c
index 58ce603..f04426b 100644
--- a/src/otr.c
+++ b/src/otr.c
@@ -124,7 +124,7 @@ static void add_peer_context_cb(void *data, ConnContext *context)
 	context->app_data = opc;
 	context->app_data_free = destroy_peer_context_cb;
 
-	IRSSI_MSG("Peer context created for %s", context->username);
+	IRSSI_DEBUG("Peer context created for %s", context->username);
 }
 
 /*
@@ -441,9 +441,9 @@ void otr_auth_abort(SERVER_REC *irssi, const char *nick)
 	otr_status_change(irssi, nick, OTR_STATUS_SMP_ABORT);
 
 	if (ctx->smstate->nextExpected != OTRL_SMP_EXPECT1) {
-		IRSSI_NOTICE(irssi, nick, "Ongoing authentication aborted");
+		IRSSI_NOTICE(irssi, nick, "%rOngoing authentication aborted%n");
 	} else {
-		IRSSI_NOTICE(irssi, nick, "Authentication aborted");
+		IRSSI_NOTICE(irssi, nick, "%rAuthentication aborted%n");
 	}
 
 end:
@@ -457,12 +457,12 @@ void otr_auth(SERVER_REC *irssi, const char *nick, const char *question,
 		const char *secret)
 {
 	int ret;
+	size_t secret_len = 0;
 	ConnContext *ctx;
 	struct otr_peer_context *opc;
 
 	assert(irssi);
 	assert(nick);
-	assert(secret);
 
 	ctx = otr_find_context(irssi, nick, 0);
 	if (!ctx) {
@@ -495,23 +495,27 @@ void otr_auth(SERVER_REC *irssi, const char *nick, const char *question,
 		}
 	}
 
+	/* Libotr allows empty secret. */
+	if (secret) {
+		secret_len = strlen(secret);
+	}
+
 	if (opc->ask_secret) {
 		otrl_message_respond_smp(user_state_global->otr_state, &otr_ops,
-				irssi, ctx, (unsigned char *) secret, strlen(secret));
+				irssi, ctx, (unsigned char *) secret, secret_len);
 		otr_status_change(irssi, nick, OTR_STATUS_SMP_RESPONDED);
-		IRSSI_NOTICE(irssi, nick, "Responding to authentication...");
+		IRSSI_NOTICE(irssi, nick, "%yResponding to authentication...%n");
 	} else {
 		if (question) {
 			otrl_message_initiate_smp_q(user_state_global->otr_state,
 				&otr_ops, irssi, ctx, question, (unsigned char *) secret,
-				strlen(secret));
+				secret_len);
 		} else {
 			otrl_message_initiate_smp(user_state_global->otr_state,
-				&otr_ops, irssi, ctx, (unsigned char *) secret,
-				strlen(secret));
+				&otr_ops, irssi, ctx, (unsigned char *) secret, secret_len);
 		}
 		otr_status_change(irssi, nick, OTR_STATUS_SMP_STARTED);
-		IRSSI_NOTICE(irssi, nick, "Initiated authentication...");
+		IRSSI_NOTICE(irssi, nick, "%yInitiated authentication...%n");
 	}
 
 	opc->ask_secret = 0;

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