[Pkg-privacy-commits] [libotr] 103/225: Trigger a context dump when a special debug string is typed

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:45:05 UTC 2015


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

infinity0 pushed a commit to branch master
in repository libotr.

commit edf738fa18e2c3afea7213a474b109b7a53a52b4
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date:   Fri Aug 24 14:41:08 2012 -0400

    Trigger a context dump when a special debug string is typed
---
 src/message.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/message.c b/src/message.c
index fda4ea8..4cdc7c6 100644
--- a/src/message.c
+++ b/src/message.c
@@ -35,6 +35,16 @@
 #include "sm.h"
 #include "instag.h"
 
+#if OTRL_DEBUGGING
+#include <stdio.h>
+
+/* If OTRL_DEBUGGING is on, and the user types this string, the current
+ * context and its siblings will be dumped to stderr. */
+#define OTRL_DEBUGGING_DEBUGSTR "?OTR!"
+
+void otrl_context_siblings_dump(FILE *f, const ConnContext *context);
+#endif
+
 /* The API version */
 extern unsigned int otrl_api_version;
 
@@ -240,6 +250,20 @@ gcry_error_t otrl_message_sending(OtrlUserState us,
 	goto fragment;
     }
 
+#if OTRL_DEBUGGING
+    /* If the user typed the magic debug string, dump this context and
+     * its siblings. */
+    if (strstr(original_msg, OTRL_DEBUGGING_DEBUGSTR)) {
+	otrl_context_siblings_dump(stderr, context);
+
+	*messagep = strdup("");
+	if (!(*messagep)) {
+	    err = gcry_error(GPG_ERR_ENOMEM);
+	    goto fragment;
+	}
+    }
+#endif
+
     /* If this is an OTR Query message, don't encrypt it. */
     if (otrl_proto_message_type(original_msg) == OTRL_MSGTYPE_QUERY) {
 	/* Replace the "?OTR?" with a custom message */

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



More information about the Pkg-privacy-commits mailing list