On Wed, Nov 28, 2012 at 01:41:19PM -0500, David Goulet wrote: > So, what I do now is once I've found the right Fingerprint object (from > the human representation), I iterate over all contexts of the > fingerprint and check for an encrypted msgstate. Basically: > > for (context = fp->context; context != NULL; context = context->next) { > if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED) { > return 1; > } > }
I think that's not quite right. That will iterate over *all* contexts starting with the one you found, not all contexts with the same master. I think you want: for (context = fp->context; context != NULL && context->m_context == fp->context; context = context->next) { But even that only checks whether *any* child of the same master is encrypted, so you'd miss the case where another child of the same master is ENCRYPTED, but with a different fp. So perhaps: for (context = fp->context; context != NULL && context->m_context == fp->context; context = context->next) { if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && context->active_fingerprint == fp) { return 1; } } - Ian _______________________________________________ OTR-dev mailing list OTR-dev@lists.cypherpunks.ca http://lists.cypherpunks.ca/mailman/listinfo/otr-dev