diff options
| author | Sven Moritz Hallberg <pesco@khjk.org> | 2010-09-19 19:29:10 +0200 | 
|---|---|---|
| committer | Sven Moritz Hallberg <pesco@khjk.org> | 2010-09-19 19:29:10 +0200 | 
| commit | 76e2f624b3adee07d6ea970961411d8a7c734745 (patch) | |
| tree | 51da0f94cb87d9ceb6cacc89bd775439371f7d84 | |
| parent | 2dcaf9a0fabdb92a191e64759d116f316de7dfc2 (diff) | |
handle SMP1Q packets (smp init with question)
| -rw-r--r-- | otr.c | 16 | 
1 files changed, 16 insertions, 0 deletions
| @@ -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 <answer>\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) { | 
