Changeset 9cc653c


Ignore:
Timestamp:
2010-09-19T19:12:49Z (9 years ago)
Author:
Sven Moritz Hallberg <pesco@…>
Branches:
master
Children:
10d89be
Parents:
2171044
Message:

let 'otr smpq' only work for smp init, not reply

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    r2171044 r9cc653c  
    11881188        }
    11891189       
    1190         /* warning: the following assumes that smstates are cleared whenever an SMP
    1191            is completed or aborted! */
    1192         if(ctx->smstate->secret == NULL) {
     1190        if(question) {
     1191                /* this was 'otr smpq', just initiate */
    11931192                irc_usermsg(irc, "smp: initiating with %s...", u->nick);
    1194                 if(question) {
    1195                         otrl_message_initiate_smp_q(irc->otr->us, &otr_ops,
    1196                                 u->bu->ic, ctx, question,
    1197                                 (unsigned char *)secret, strlen(secret));
    1198                 } else {
     1193                otrl_message_initiate_smp_q(irc->otr->us, &otr_ops, u->bu->ic, ctx,
     1194                        question, (unsigned char *)secret, strlen(secret));
     1195                /* smp is now in EXPECT2 */
     1196        } else {
     1197                /* this was 'otr smp', initiate or reply */
     1198                /* warning: the following assumes that smstates are cleared whenever an SMP
     1199                   is completed or aborted! */
     1200                if(ctx->smstate->secret == NULL) {
     1201                        irc_usermsg(irc, "smp: initiating with %s...", u->nick);
    11991202                        otrl_message_initiate_smp(irc->otr->us, &otr_ops,
    12001203                                u->bu->ic, ctx, (unsigned char *)secret, strlen(secret));
    1201                 }
    1202                 /* smp is now in EXPECT2 */
    1203         } else {
    1204                 /* if we're still in EXPECT1 but smstate is initialized, we must have
    1205                    received the SMP1, so let's issue a response */
    1206                 irc_usermsg(irc, "smp: responding to %s...", u->nick);
    1207                 otrl_message_respond_smp(irc->otr->us, &otr_ops,
    1208                         u->bu->ic, ctx, (unsigned char *)secret, strlen(secret));
    1209                 /* smp is now in EXPECT3 */
     1204                        /* smp is now in EXPECT2 */
     1205                } else {
     1206                        /* if we're still in EXPECT1 but smstate is initialized, we must have
     1207                           received the SMP1, so let's issue a response */
     1208                        irc_usermsg(irc, "smp: responding to %s...", u->nick);
     1209                        otrl_message_respond_smp(irc->otr->us, &otr_ops,
     1210                                u->bu->ic, ctx, (unsigned char *)secret, strlen(secret));
     1211                        /* smp is now in EXPECT3 */
     1212                }
    12101213        }
    12111214}
Note: See TracChangeset for help on using the changeset viewer.