1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

ui_smp_recipient_initiated takes ProfChatWin

This commit is contained in:
James Booth 2015-10-26 23:22:59 +00:00
parent 93c3feeacf
commit 55e857d6a8
5 changed files with 16 additions and 9 deletions

View File

@ -140,7 +140,10 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
if (nextMsg != OTRL_SMP_EXPECT1) { if (nextMsg != OTRL_SMP_EXPECT1) {
otrl_message_abort_smp(user_state, ops, NULL, context); otrl_message_abort_smp(user_state, ops, NULL, context);
} else { } else {
ui_smp_recipient_initiated(context->username); ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) {
ui_smp_recipient_initiated(chatwin);
}
g_hash_table_insert(smp_initiators, strdup(context->username), strdup(context->username)); g_hash_table_insert(smp_initiators, strdup(context->username), strdup(context->username));
} }
} }

View File

@ -37,6 +37,7 @@
#include <libotr/message.h> #include <libotr/message.h>
#include "ui/ui.h" #include "ui/ui.h"
#include "window_list.h"
#include "log.h" #include "log.h"
#include "otr/otr.h" #include "otr/otr.h"
#include "otr/otrlib.h" #include "otr/otrlib.h"
@ -176,10 +177,14 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
OtrlMessageAppOps *ops = otr_messageops(); OtrlMessageAppOps *ops = otr_messageops();
GHashTable *smp_initiators = otr_smpinitators(); GHashTable *smp_initiators = otr_smpinitators();
ProfChatWin *chatwin = wins_get_chat(context->username);
switch(smp_event) switch(smp_event)
{ {
case OTRL_SMPEVENT_ASK_FOR_SECRET: case OTRL_SMPEVENT_ASK_FOR_SECRET:
ui_smp_recipient_initiated(context->username); if (chatwin) {
ui_smp_recipient_initiated(chatwin);
}
g_hash_table_insert(smp_initiators, strdup(context->username), strdup(context->username)); g_hash_table_insert(smp_initiators, strdup(context->username), strdup(context->username));
break; break;

View File

@ -102,12 +102,11 @@ ui_gone_insecure(ProfChatWin *chatwin)
} }
void void
ui_smp_recipient_initiated(const char *const barejid) ui_smp_recipient_initiated(ProfChatWin *chatwin)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); assert(chatwin != NULL);
if (chatwin) {
win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "%s wants to authenticate your identity, use '/otr secret <secret>'.", barejid); win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "%s wants to authenticate your identity, use '/otr secret <secret>'.", chatwin->barejid);
}
} }
void void

View File

@ -66,7 +66,7 @@ void ui_gone_secure(ProfChatWin *chatwin, gboolean trusted);
void ui_gone_insecure(ProfChatWin *chatwin); void ui_gone_insecure(ProfChatWin *chatwin);
void ui_trust(const char *const barejid); void ui_trust(const char *const barejid);
void ui_untrust(const char *const barejid); void ui_untrust(const char *const barejid);
void ui_smp_recipient_initiated(const char *const barejid); void ui_smp_recipient_initiated(ProfChatWin *chatwin);
void ui_smp_recipient_initiated_q(const char *const barejid, const char *question); void ui_smp_recipient_initiated_q(const char *const barejid, const char *question);
void ui_smp_successful(const char *const barejid); void ui_smp_successful(const char *const barejid);

View File

@ -70,7 +70,7 @@ void ui_gone_secure(ProfChatWin *chatwin, gboolean trusted) {}
void ui_gone_insecure(ProfChatWin *chatwin) {} void ui_gone_insecure(ProfChatWin *chatwin) {}
void ui_trust(const char * const barejid) {} void ui_trust(const char * const barejid) {}
void ui_untrust(const char * const barejid) {} void ui_untrust(const char * const barejid) {}
void ui_smp_recipient_initiated(const char * const barejid) {} void ui_smp_recipient_initiated(ProfChatWin *chatwin) {}
void ui_smp_recipient_initiated_q(const char * const barejid, const char *question) {} void ui_smp_recipient_initiated_q(const char * const barejid, const char *question) {}
void ui_smp_successful(const char * const barejid) {} void ui_smp_successful(const char * const barejid) {}