mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 00:16:22 +00:00
remaining otr functions take ProfChatWin
This commit is contained in:
@@ -573,13 +573,18 @@ otr_smp_secret(const char *const recipient, const char *secret)
|
||||
}
|
||||
|
||||
// if recipient initiated SMP, send response, else initialise
|
||||
ProfChatWin *chatwin = wins_get_chat(recipient);
|
||||
if (g_hash_table_contains(smp_initiators, recipient)) {
|
||||
otrl_message_respond_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
|
||||
ui_otr_authenticating(recipient);
|
||||
if (chatwin) {
|
||||
ui_otr_authenticating(chatwin);
|
||||
}
|
||||
g_hash_table_remove(smp_initiators, context->username);
|
||||
} else {
|
||||
otrl_message_initiate_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
|
||||
ui_otr_authetication_waiting(recipient);
|
||||
if (chatwin) {
|
||||
ui_otr_authetication_waiting(chatwin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,7 +602,10 @@ otr_smp_question(const char *const recipient, const char *question, const char *
|
||||
}
|
||||
|
||||
otrl_message_initiate_smp_q(user_state, &ops, NULL, context, question, (const unsigned char*)answer, strlen(answer));
|
||||
ui_otr_authetication_waiting(recipient);
|
||||
ProfChatWin *chatwin = wins_get_chat(recipient);
|
||||
if (chatwin) {
|
||||
ui_otr_authetication_waiting(chatwin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -176,24 +176,22 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
|
||||
otrl_message_abort_smp(user_state, ops, NULL, context);
|
||||
} else {
|
||||
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
|
||||
if (context->smstate->received_question == 0) {
|
||||
ProfChatWin *chatwin = wins_get_chat(context->username);
|
||||
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
|
||||
if (chatwin) {
|
||||
ProfChatWin *chatwin = wins_get_chat(context->username);
|
||||
if (chatwin) {
|
||||
if (context->smstate->received_question == 0) {
|
||||
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
|
||||
ui_smp_successful(chatwin);
|
||||
}
|
||||
ui_trust(context->username);
|
||||
} else {
|
||||
if (chatwin) {
|
||||
ui_trust(chatwin);
|
||||
} else {
|
||||
ui_smp_unsuccessful_sender(chatwin);
|
||||
ui_untrust(chatwin);
|
||||
}
|
||||
ui_untrust(context->username);
|
||||
}
|
||||
} else {
|
||||
if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
|
||||
ui_smp_answer_success(context->username);
|
||||
} else {
|
||||
ui_smp_answer_failure(context->username);
|
||||
if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
|
||||
ui_smp_answer_success(chatwin);
|
||||
} else {
|
||||
ui_smp_answer_failure(chatwin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,16 +203,14 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
|
||||
} else {
|
||||
context->smstate->nextExpected = OTRL_SMP_EXPECT1;
|
||||
ProfChatWin *chatwin = wins_get_chat(context->username);
|
||||
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
|
||||
if (chatwin) {
|
||||
if (chatwin) {
|
||||
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
|
||||
ui_smp_successful(chatwin);
|
||||
}
|
||||
ui_trust(context->username);
|
||||
} else {
|
||||
if (chatwin) {
|
||||
ui_trust(chatwin);
|
||||
} else {
|
||||
ui_smp_unsuccessful_receiver(chatwin);
|
||||
ui_untrust(chatwin);
|
||||
}
|
||||
ui_untrust(context->username);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,8 +220,8 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
|
||||
ProfChatWin *chatwin = wins_get_chat(context->username);
|
||||
if (chatwin) {
|
||||
ui_smp_aborted(chatwin);
|
||||
ui_untrust(chatwin);
|
||||
}
|
||||
ui_untrust(context->username);
|
||||
otr_untrust(context->username);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,30 +195,28 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
|
||||
break;
|
||||
|
||||
case OTRL_SMPEVENT_SUCCESS:
|
||||
if (context->smstate->received_question == 0) {
|
||||
if (chatwin) {
|
||||
if (chatwin) {
|
||||
if (context->smstate->received_question == 0) {
|
||||
ui_smp_successful(chatwin);
|
||||
ui_trust(chatwin);
|
||||
} else {
|
||||
ui_smp_answer_success(chatwin);
|
||||
}
|
||||
ui_trust(context->username);
|
||||
} else {
|
||||
ui_smp_answer_success(context->username);
|
||||
}
|
||||
break;
|
||||
|
||||
case OTRL_SMPEVENT_FAILURE:
|
||||
if (context->smstate->received_question == 0) {
|
||||
if (nextMsg == OTRL_SMP_EXPECT3) {
|
||||
if (chatwin) {
|
||||
if (chatwin) {
|
||||
if (context->smstate->received_question == 0) {
|
||||
if (nextMsg == OTRL_SMP_EXPECT3) {
|
||||
ui_smp_unsuccessful_sender(chatwin);
|
||||
}
|
||||
} else if (nextMsg == OTRL_SMP_EXPECT4) {
|
||||
if (chatwin) {
|
||||
} else if (nextMsg == OTRL_SMP_EXPECT4) {
|
||||
ui_smp_unsuccessful_receiver(chatwin);
|
||||
}
|
||||
ui_untrust(chatwin);
|
||||
} else {
|
||||
ui_smp_answer_failure(chatwin);
|
||||
}
|
||||
ui_untrust(context->username);
|
||||
} else {
|
||||
ui_smp_answer_failure(context->username);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -233,8 +231,8 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
|
||||
case OTRL_SMPEVENT_ABORT:
|
||||
if (chatwin) {
|
||||
ui_smp_aborted(chatwin);
|
||||
ui_untrust(chatwin);
|
||||
}
|
||||
ui_untrust(context->username);
|
||||
break;
|
||||
|
||||
case OTRL_SMPEVENT_IN_PROGRESS:
|
||||
|
||||
Reference in New Issue
Block a user