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

Renamed chatwin OTR functions

This commit is contained in:
James Booth 2015-10-27 21:23:56 +00:00
parent 0fd616167e
commit 40dcd59727
8 changed files with 81 additions and 81 deletions

View File

@ -1531,7 +1531,7 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args)
} else { } else {
#ifdef HAVE_LIBOTR #ifdef HAVE_LIBOTR
if (otr_is_secure(barejid)) { if (otr_is_secure(barejid)) {
ui_gone_secure(chatwin, otr_is_trusted(barejid)); chatwin_otr_secured(chatwin, otr_is_trusted(barejid));
} }
#endif #endif
} }
@ -4892,7 +4892,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args)
return TRUE; return TRUE;
} }
ui_gone_secure(chatwin, otr_is_trusted(barejid)); chatwin_otr_secured(chatwin, otr_is_trusted(barejid));
return TRUE; return TRUE;
// no recipient, use current chat // no recipient, use current chat
@ -4938,7 +4938,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args)
return TRUE; return TRUE;
} }
ui_gone_insecure(chatwin); chatwin_otr_unsecured(chatwin);
otr_end_session(chatwin->barejid); otr_end_session(chatwin->barejid);
return TRUE; return TRUE;
@ -4955,7 +4955,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args)
return TRUE; return TRUE;
} }
ui_trust(chatwin); chatwin_otr_trust(chatwin);
otr_trust(chatwin->barejid); otr_trust(chatwin->barejid);
return TRUE; return TRUE;
@ -4972,7 +4972,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args)
return TRUE; return TRUE;
} }
ui_untrust(chatwin); chatwin_otr_untrust(chatwin);
otr_untrust(chatwin->barejid); otr_untrust(chatwin->barejid);
return TRUE; return TRUE;

View File

@ -315,7 +315,7 @@ sv_ev_message_receipt(char *barejid, char *id)
if (!chatwin) if (!chatwin)
return; return;
ui_message_receipt(chatwin, id); chatwin_receipt_received(chatwin, id);
} }
void void

View File

@ -149,7 +149,7 @@ cb_gone_secure(void *opdata, ConnContext *context)
chatwin = (ProfChatWin*) wins_new_chat(context->username); chatwin = (ProfChatWin*) wins_new_chat(context->username);
} }
ui_gone_secure(chatwin, otr_is_trusted(context->username)); chatwin_otr_secured(chatwin, otr_is_trusted(context->username));
} }
char* char*
@ -577,13 +577,13 @@ otr_smp_secret(const char *const recipient, const char *secret)
if (g_hash_table_contains(smp_initiators, recipient)) { if (g_hash_table_contains(smp_initiators, recipient)) {
otrl_message_respond_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret)); otrl_message_respond_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
if (chatwin) { if (chatwin) {
ui_otr_authenticating(chatwin); chatwin_otr_smp_authenticating(chatwin);
} }
g_hash_table_remove(smp_initiators, context->username); g_hash_table_remove(smp_initiators, context->username);
} else { } else {
otrl_message_initiate_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret)); otrl_message_initiate_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret));
if (chatwin) { if (chatwin) {
ui_otr_authetication_waiting(chatwin); chatwin_otr_smp_authenticaton_wait(chatwin);
} }
} }
} }
@ -604,7 +604,7 @@ 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)); otrl_message_initiate_smp_q(user_state, &ops, NULL, context, question, (const unsigned char*)answer, strlen(answer));
ProfChatWin *chatwin = wins_get_chat(recipient); ProfChatWin *chatwin = wins_get_chat(recipient);
if (chatwin) { if (chatwin) {
ui_otr_authetication_waiting(chatwin); chatwin_otr_smp_authenticaton_wait(chatwin);
} }
} }
@ -749,7 +749,7 @@ otr_decrypt_message(const char *const from, const char *const message, gboolean
otrl_context_force_plaintext(context); otrl_context_force_plaintext(context);
ProfChatWin *chatwin = wins_get_chat(from); ProfChatWin *chatwin = wins_get_chat(from);
if (chatwin) { if (chatwin) {
ui_gone_insecure(chatwin); chatwin_otr_unsecured(chatwin);
} }
} }
} }

View File

@ -143,7 +143,7 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
} else { } else {
ProfChatWin *chatwin = wins_get_chat(context->username); ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) { if (chatwin) {
ui_smp_recipient_initiated(chatwin); chatwin_otr_smp_init(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));
} }
@ -158,7 +158,7 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
char *question = (char *)tlv->data; char *question = (char *)tlv->data;
char *eoq = memchr(question, '\0', tlv->len); char *eoq = memchr(question, '\0', tlv->len);
if (eoq) { if (eoq) {
ui_smp_recipient_initiated_q(chatwin, question); chatwin_otr_smp_init_q(chatwin, question);
} }
} }
} }
@ -181,17 +181,17 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
if (chatwin) { if (chatwin) {
if (context->smstate->received_question == 0) { if (context->smstate->received_question == 0) {
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) { if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
ui_smp_successful(chatwin); chatwin_otr_smp_success(chatwin);
ui_trust(chatwin); chatwin_otr_trust(chatwin);
} else { } else {
ui_smp_unsuccessful_sender(chatwin); chatwin_otr_smp_sender_failed(chatwin);
ui_untrust(chatwin); chatwin_otr_untrust(chatwin);
} }
} else { } else {
if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
ui_smp_answer_success(chatwin); chatwin_otr_smp_answer_success(chatwin);
} else { } else {
ui_smp_answer_failure(chatwin); chatwin_otr_smp_answer_failure(chatwin);
} }
} }
} }
@ -206,11 +206,11 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
ProfChatWin *chatwin = wins_get_chat(context->username); ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) { if (chatwin) {
if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) { if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) {
ui_smp_successful(chatwin); chatwin_otr_smp_success(chatwin);
ui_trust(chatwin); chatwin_otr_trust(chatwin);
} else { } else {
ui_smp_unsuccessful_receiver(chatwin); chatwin_otr_smp_receiver_failed(chatwin);
ui_untrust(chatwin); chatwin_otr_untrust(chatwin);
} }
} }
} }
@ -220,8 +220,8 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
context->smstate->nextExpected = OTRL_SMP_EXPECT1; context->smstate->nextExpected = OTRL_SMP_EXPECT1;
ProfChatWin *chatwin = wins_get_chat(context->username); ProfChatWin *chatwin = wins_get_chat(context->username);
if (chatwin) { if (chatwin) {
ui_smp_aborted(chatwin); chatwin_otr_smp_aborted(chatwin);
ui_untrust(chatwin); chatwin_otr_untrust(chatwin);
} }
otr_untrust(context->username); otr_untrust(context->username);
} }

View File

@ -183,24 +183,24 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
{ {
case OTRL_SMPEVENT_ASK_FOR_SECRET: case OTRL_SMPEVENT_ASK_FOR_SECRET:
if (chatwin) { if (chatwin) {
ui_smp_recipient_initiated(chatwin); chatwin_otr_smp_init(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;
case OTRL_SMPEVENT_ASK_FOR_ANSWER: case OTRL_SMPEVENT_ASK_FOR_ANSWER:
if (chatwin) { if (chatwin) {
ui_smp_recipient_initiated_q(chatwin, question); chatwin_otr_smp_init_q(chatwin, question);
} }
break; break;
case OTRL_SMPEVENT_SUCCESS: case OTRL_SMPEVENT_SUCCESS:
if (chatwin) { if (chatwin) {
if (context->smstate->received_question == 0) { if (context->smstate->received_question == 0) {
ui_smp_successful(chatwin); chatwin_otr_smp_success(chatwin);
ui_trust(chatwin); chatwin_otr_trust(chatwin);
} else { } else {
ui_smp_answer_success(chatwin); chatwin_otr_smp_answer_success(chatwin);
} }
} }
break; break;
@ -209,13 +209,13 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
if (chatwin) { if (chatwin) {
if (context->smstate->received_question == 0) { if (context->smstate->received_question == 0) {
if (nextMsg == OTRL_SMP_EXPECT3) { if (nextMsg == OTRL_SMP_EXPECT3) {
ui_smp_unsuccessful_sender(chatwin); chatwin_otr_smp_sender_failed(chatwin);
} else if (nextMsg == OTRL_SMP_EXPECT4) { } else if (nextMsg == OTRL_SMP_EXPECT4) {
ui_smp_unsuccessful_receiver(chatwin); chatwin_otr_smp_receiver_failed(chatwin);
} }
ui_untrust(chatwin); chatwin_otr_untrust(chatwin);
} else { } else {
ui_smp_answer_failure(chatwin); chatwin_otr_smp_answer_failure(chatwin);
} }
} }
break; break;
@ -230,8 +230,8 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
case OTRL_SMPEVENT_ABORT: case OTRL_SMPEVENT_ABORT:
if (chatwin) { if (chatwin) {
ui_smp_aborted(chatwin); chatwin_otr_smp_aborted(chatwin);
ui_untrust(chatwin); chatwin_otr_untrust(chatwin);
} }
break; break;

View File

@ -48,7 +48,7 @@
static void _win_show_history(ProfChatWin *chatwin, const char *const contact); static void _win_show_history(ProfChatWin *chatwin, const char *const contact);
void void
ui_message_receipt(ProfChatWin *chatwin, const char *const id) chatwin_receipt_received(ProfChatWin *chatwin, const char *const id)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -57,7 +57,7 @@ ui_message_receipt(ProfChatWin *chatwin, const char *const id)
} }
void void
ui_gone_secure(ProfChatWin *chatwin, gboolean trusted) chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -87,7 +87,7 @@ ui_gone_secure(ProfChatWin *chatwin, gboolean trusted)
} }
void void
ui_gone_insecure(ProfChatWin *chatwin) chatwin_otr_unsecured(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -102,7 +102,7 @@ ui_gone_insecure(ProfChatWin *chatwin)
} }
void void
ui_smp_recipient_initiated(ProfChatWin *chatwin) chatwin_otr_smp_init(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -111,7 +111,7 @@ ui_smp_recipient_initiated(ProfChatWin *chatwin)
} }
void void
ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) chatwin_otr_smp_init_q(ProfChatWin *chatwin, const char *question)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -122,7 +122,7 @@ ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question)
} }
void void
ui_smp_unsuccessful_sender(ProfChatWin *chatwin) chatwin_otr_smp_sender_failed(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -131,7 +131,7 @@ ui_smp_unsuccessful_sender(ProfChatWin *chatwin)
} }
void void
ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) chatwin_otr_smp_receiver_failed(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -140,7 +140,7 @@ ui_smp_unsuccessful_receiver(ProfChatWin *chatwin)
} }
void void
ui_smp_aborted(ProfChatWin *chatwin) chatwin_otr_smp_aborted(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -148,7 +148,7 @@ ui_smp_aborted(ProfChatWin *chatwin)
} }
void void
ui_smp_successful(ProfChatWin *chatwin) chatwin_otr_smp_success(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -156,7 +156,7 @@ ui_smp_successful(ProfChatWin *chatwin)
} }
void void
ui_smp_answer_success(ProfChatWin *chatwin) chatwin_otr_smp_answer_success(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -164,7 +164,7 @@ ui_smp_answer_success(ProfChatWin *chatwin)
} }
void void
ui_smp_answer_failure(ProfChatWin *chatwin) chatwin_otr_smp_answer_failure(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -172,7 +172,7 @@ ui_smp_answer_failure(ProfChatWin *chatwin)
} }
void void
ui_otr_authenticating(ProfChatWin *chatwin) chatwin_otr_smp_authenticating(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -180,7 +180,7 @@ ui_otr_authenticating(ProfChatWin *chatwin)
} }
void void
ui_otr_authetication_waiting(ProfChatWin *chatwin) chatwin_otr_smp_authenticaton_wait(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -188,7 +188,7 @@ ui_otr_authetication_waiting(ProfChatWin *chatwin)
} }
void void
ui_trust(ProfChatWin *chatwin) chatwin_otr_trust(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);
@ -203,7 +203,7 @@ ui_trust(ProfChatWin *chatwin)
} }
void void
ui_untrust(ProfChatWin *chatwin) chatwin_otr_untrust(ProfChatWin *chatwin)
{ {
assert(chatwin != NULL); assert(chatwin != NULL);

View File

@ -62,23 +62,23 @@ GSList* ui_get_chat_recipients(void);
void ui_switch_win(ProfWin *window); void ui_switch_win(ProfWin *window);
void ui_sigwinch_handler(int sig); void ui_sigwinch_handler(int sig);
void ui_gone_secure(ProfChatWin *chatwin, gboolean trusted); void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted);
void ui_gone_insecure(ProfChatWin *chatwin); void chatwin_otr_unsecured(ProfChatWin *chatwin);
void ui_trust(ProfChatWin *chatwin); void chatwin_otr_trust(ProfChatWin *chatwin);
void ui_untrust(ProfChatWin *chatwin); void chatwin_otr_untrust(ProfChatWin *chatwin);
void ui_smp_recipient_initiated(ProfChatWin *chatwin); void chatwin_otr_smp_init(ProfChatWin *chatwin);
void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question); void chatwin_otr_smp_init_q(ProfChatWin *chatwin, const char *question);
void ui_smp_successful(ProfChatWin *chatwin); void chatwin_otr_smp_success(ProfChatWin *chatwin);
void ui_smp_unsuccessful_sender(ProfChatWin *chatwin); void chatwin_otr_smp_sender_failed(ProfChatWin *chatwin);
void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin); void chatwin_otr_smp_receiver_failed(ProfChatWin *chatwin);
void ui_smp_aborted(ProfChatWin *chatwin); void chatwin_otr_smp_aborted(ProfChatWin *chatwin);
void ui_smp_answer_success(ProfChatWin *chatwin); void chatwin_otr_smp_answer_success(ProfChatWin *chatwin);
void ui_smp_answer_failure(ProfChatWin *chatwin); void chatwin_otr_smp_answer_failure(ProfChatWin *chatwin);
void ui_otr_authenticating(ProfChatWin *chatwin); void chatwin_otr_smp_authenticating(ProfChatWin *chatwin);
void ui_otr_authetication_waiting(ProfChatWin *chatwin); void chatwin_otr_smp_authenticaton_wait(ProfChatWin *chatwin);
void ui_handle_otr_error(const char *const barejid, const char *const message); void ui_handle_otr_error(const char *const barejid, const char *const message);
@ -112,7 +112,7 @@ void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activi
void ui_contact_typing(const char *const barejid, const char *const resource); void ui_contact_typing(const char *const barejid, const char *const resource);
void ui_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode); void ui_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode);
void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp); void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp);
void ui_message_receipt(ProfChatWin *chatwin, const char *const id); void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id);
void ui_disconnected(void); void ui_disconnected(void);
void ui_recipient_gone(const char *const barejid, const char *const resource); void ui_recipient_gone(const char *const barejid, const char *const resource);

View File

@ -66,23 +66,23 @@ GSList* ui_get_chat_recipients(void)
void ui_switch_win(ProfWin *win) {} void ui_switch_win(ProfWin *win) {}
void ui_gone_secure(ProfChatWin *chatwin, gboolean trusted) {} void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted) {}
void ui_gone_insecure(ProfChatWin *chatwin) {} void chatwin_otr_unsecured(ProfChatWin *chatwin) {}
void ui_trust(ProfChatWin *chatwin) {} void chatwin_otr_trust(ProfChatWin *chatwin) {}
void ui_untrust(ProfChatWin *chatwin) {} void chatwin_otr_untrust(ProfChatWin *chatwin) {}
void ui_smp_recipient_initiated(ProfChatWin *chatwin) {} void chatwin_otr_smp_init(ProfChatWin *chatwin) {}
void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) {} void chatwin_otr_smp_init_q(ProfChatWin *chatwin, const char *question) {}
void ui_smp_successful(ProfChatWin *chatwin) {} void chatwin_otr_smp_success(ProfChatWin *chatwin) {}
void ui_smp_unsuccessful_sender(ProfChatWin *chatwin) {} void chatwin_otr_smp_sender_failed(ProfChatWin *chatwin) {}
void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) {} void chatwin_otr_smp_receiver_failed(ProfChatWin *chatwin) {}
void ui_smp_aborted(ProfChatWin *chatwin) {} void chatwin_otr_smp_aborted(ProfChatWin *chatwin) {}
void ui_smp_answer_success(ProfChatWin *chatwin) {} void chatwin_otr_smp_answer_success(ProfChatWin *chatwin) {}
void ui_smp_answer_failure(ProfChatWin *chatwin) {} void chatwin_otr_smp_answer_failure(ProfChatWin *chatwin) {}
void ui_otr_authenticating(ProfChatWin *chatwin) {} void chatwin_otr_smp_authenticating(ProfChatWin *chatwin) {}
void ui_otr_authetication_waiting(ProfChatWin *chatwin) {} void chatwin_otr_smp_authenticaton_wait(ProfChatWin *chatwin) {}
void ui_sigwinch_handler(int sig) {} void ui_sigwinch_handler(int sig) {}
unsigned long ui_get_idle_time(void) unsigned long ui_get_idle_time(void)
@ -185,7 +185,7 @@ void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activi
void ui_contact_typing(const char * const barejid, const char * const resource) {} void ui_contact_typing(const char * const barejid, const char * const resource) {}
void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) {} void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) {}
void ui_message_receipt(ProfChatWin *chatwin, const char * const id) {} void chatwin_receipt_received(ProfChatWin *chatwin, const char * const id) {}
void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp) {} void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp) {}