From 76e2f624b3adee07d6ea970961411d8a7c734745 Mon Sep 17 00:00:00 2001 From: Sven Moritz Hallberg Date: Sun, 19 Sep 2010 19:29:10 +0200 Subject: handle SMP1Q packets (smp init with question) --- otr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/otr.c b/otr.c index ad59d5b0..7d64ec35 100644 --- a/otr.c +++ b/otr.c @@ -1098,6 +1098,22 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs) } nextMsg = context->smstate->nextExpected; + tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q); + if (tlv) { + if (nextMsg != OTRL_SMP_EXPECT1) { + irc_usermsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick); + otrl_message_abort_smp(us, ops, u->bu->ic, context); + otrl_sm_state_free(context->smstate); + } else { + char *question = g_strndup((char *)tlv->data, tlv->len); + irc_usermsg(irc, "smp: question from %s: \"%s\"", u->nick, + question); + irc_usermsg(irc, "smp: respond with \x02otr smp %s \x02", + u->nick); + g_free(question); + /* smp stays in EXPECT1 until user responds */ + } + } tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1); if (tlv) { if (nextMsg != OTRL_SMP_EXPECT1) { -- cgit v1.2.3