Commit edf738fa authored by Ian Goldberg's avatar Ian Goldberg

Trigger a context dump when a special debug string is typed

parent 6dd1ba4a
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment