diff options
author | James Booth <boothj5@gmail.com> | 2015-10-27 21:23:56 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-10-27 21:23:56 +0000 |
commit | 40dcd597270c375ff2d0abc36554f6436f406a03 (patch) | |
tree | 49f3a6e07da36c0b1a8e5f7e99c40085b58d374d | |
parent | 0fd616167ee86562077327695f5f32974e9f5578 (diff) | |
download | profani-tty-40dcd597270c375ff2d0abc36554f6436f406a03.tar.gz |
Renamed chatwin OTR functions
-rw-r--r-- | src/command/commands.c | 10 | ||||
-rw-r--r-- | src/event/server_events.c | 2 | ||||
-rw-r--r-- | src/otr/otr.c | 10 | ||||
-rw-r--r-- | src/otr/otrlibv3.c | 28 | ||||
-rw-r--r-- | src/otr/otrlibv4.c | 22 | ||||
-rw-r--r-- | src/ui/chatwin.c | 30 | ||||
-rw-r--r-- | src/ui/ui.h | 30 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 36 |
8 files changed, 84 insertions, 84 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index c7cf9340..5ff92321 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1531,7 +1531,7 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args) } else { #ifdef HAVE_LIBOTR if (otr_is_secure(barejid)) { - ui_gone_secure(chatwin, otr_is_trusted(barejid)); + chatwin_otr_secured(chatwin, otr_is_trusted(barejid)); } #endif } @@ -4892,7 +4892,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args) return TRUE; } - ui_gone_secure(chatwin, otr_is_trusted(barejid)); + chatwin_otr_secured(chatwin, otr_is_trusted(barejid)); return TRUE; // no recipient, use current chat @@ -4938,7 +4938,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args) return TRUE; } - ui_gone_insecure(chatwin); + chatwin_otr_unsecured(chatwin); otr_end_session(chatwin->barejid); return TRUE; @@ -4955,7 +4955,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args) return TRUE; } - ui_trust(chatwin); + chatwin_otr_trust(chatwin); otr_trust(chatwin->barejid); return TRUE; @@ -4972,7 +4972,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args) return TRUE; } - ui_untrust(chatwin); + chatwin_otr_untrust(chatwin); otr_untrust(chatwin->barejid); return TRUE; diff --git a/src/event/server_events.c b/src/event/server_events.c index 1f8d53cc..026b5147 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -315,7 +315,7 @@ sv_ev_message_receipt(char *barejid, char *id) if (!chatwin) return; - ui_message_receipt(chatwin, id); + chatwin_receipt_received(chatwin, id); } void diff --git a/src/otr/otr.c b/src/otr/otr.c index bdecf22d..c016501c 100644 --- a/src/otr/otr.c +++ b/src/otr/otr.c @@ -149,7 +149,7 @@ cb_gone_secure(void *opdata, ConnContext *context) 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* @@ -577,13 +577,13 @@ otr_smp_secret(const char *const recipient, const char *secret) if (g_hash_table_contains(smp_initiators, recipient)) { otrl_message_respond_smp(user_state, &ops, NULL, context, (const unsigned char*)secret, strlen(secret)); if (chatwin) { - ui_otr_authenticating(chatwin); + chatwin_otr_smp_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)); 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)); ProfChatWin *chatwin = wins_get_chat(recipient); 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); ProfChatWin *chatwin = wins_get_chat(from); if (chatwin) { - ui_gone_insecure(chatwin); + chatwin_otr_unsecured(chatwin); } } } diff --git a/src/otr/otrlibv3.c b/src/otr/otrlibv3.c index c32bd239..8fa89a26 100644 --- a/src/otr/otrlibv3.c +++ b/src/otr/otrlibv3.c @@ -143,7 +143,7 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext } else { ProfChatWin *chatwin = wins_get_chat(context->username); if (chatwin) { - ui_smp_recipient_initiated(chatwin); + chatwin_otr_smp_init(chatwin); } 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 *eoq = memchr(question, '\0', tlv->len); 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 (context->smstate->received_question == 0) { if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) { - ui_smp_successful(chatwin); - ui_trust(chatwin); + chatwin_otr_smp_success(chatwin); + chatwin_otr_trust(chatwin); } else { - ui_smp_unsuccessful_sender(chatwin); - ui_untrust(chatwin); + chatwin_otr_smp_sender_failed(chatwin); + chatwin_otr_untrust(chatwin); } } else { if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { - ui_smp_answer_success(chatwin); + chatwin_otr_smp_answer_success(chatwin); } 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); if (chatwin) { if (context->active_fingerprint->trust && (context->active_fingerprint->trust[0] != '\0')) { - ui_smp_successful(chatwin); - ui_trust(chatwin); + chatwin_otr_smp_success(chatwin); + chatwin_otr_trust(chatwin); } else { - ui_smp_unsuccessful_receiver(chatwin); - ui_untrust(chatwin); + chatwin_otr_smp_receiver_failed(chatwin); + chatwin_otr_untrust(chatwin); } } } @@ -220,8 +220,8 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext context->smstate->nextExpected = OTRL_SMP_EXPECT1; ProfChatWin *chatwin = wins_get_chat(context->username); if (chatwin) { - ui_smp_aborted(chatwin); - ui_untrust(chatwin); + chatwin_otr_smp_aborted(chatwin); + chatwin_otr_untrust(chatwin); } otr_untrust(context->username); } diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c index a82a98a8..cdfef5dd 100644 --- a/src/otr/otrlibv4.c +++ b/src/otr/otrlibv4.c @@ -183,24 +183,24 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event, { case OTRL_SMPEVENT_ASK_FOR_SECRET: if (chatwin) { - ui_smp_recipient_initiated(chatwin); + chatwin_otr_smp_init(chatwin); } g_hash_table_insert(smp_initiators, strdup(context->username), strdup(context->username)); break; case OTRL_SMPEVENT_ASK_FOR_ANSWER: if (chatwin) { - ui_smp_recipient_initiated_q(chatwin, question); + chatwin_otr_smp_init_q(chatwin, question); } break; case OTRL_SMPEVENT_SUCCESS: if (chatwin) { if (context->smstate->received_question == 0) { - ui_smp_successful(chatwin); - ui_trust(chatwin); + chatwin_otr_smp_success(chatwin); + chatwin_otr_trust(chatwin); } else { - ui_smp_answer_success(chatwin); + chatwin_otr_smp_answer_success(chatwin); } } break; @@ -209,13 +209,13 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event, if (chatwin) { if (context->smstate->received_question == 0) { if (nextMsg == OTRL_SMP_EXPECT3) { - ui_smp_unsuccessful_sender(chatwin); + chatwin_otr_smp_sender_failed(chatwin); } 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 { - ui_smp_answer_failure(chatwin); + chatwin_otr_smp_answer_failure(chatwin); } } break; @@ -230,8 +230,8 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event, case OTRL_SMPEVENT_ABORT: if (chatwin) { - ui_smp_aborted(chatwin); - ui_untrust(chatwin); + chatwin_otr_smp_aborted(chatwin); + chatwin_otr_untrust(chatwin); } break; diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 9d61a62b..004a24bd 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -48,7 +48,7 @@ static void _win_show_history(ProfChatWin *chatwin, const char *const contact); void -ui_message_receipt(ProfChatWin *chatwin, const char *const id) +chatwin_receipt_received(ProfChatWin *chatwin, const char *const id) { assert(chatwin != NULL); @@ -57,7 +57,7 @@ ui_message_receipt(ProfChatWin *chatwin, const char *const id) } void -ui_gone_secure(ProfChatWin *chatwin, gboolean trusted) +chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted) { assert(chatwin != NULL); @@ -87,7 +87,7 @@ ui_gone_secure(ProfChatWin *chatwin, gboolean trusted) } void -ui_gone_insecure(ProfChatWin *chatwin) +chatwin_otr_unsecured(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -102,7 +102,7 @@ ui_gone_insecure(ProfChatWin *chatwin) } void -ui_smp_recipient_initiated(ProfChatWin *chatwin) +chatwin_otr_smp_init(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -111,7 +111,7 @@ ui_smp_recipient_initiated(ProfChatWin *chatwin) } void -ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) +chatwin_otr_smp_init_q(ProfChatWin *chatwin, const char *question) { assert(chatwin != NULL); @@ -122,7 +122,7 @@ ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) } void -ui_smp_unsuccessful_sender(ProfChatWin *chatwin) +chatwin_otr_smp_sender_failed(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -131,7 +131,7 @@ ui_smp_unsuccessful_sender(ProfChatWin *chatwin) } void -ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) +chatwin_otr_smp_receiver_failed(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -140,7 +140,7 @@ ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) } void -ui_smp_aborted(ProfChatWin *chatwin) +chatwin_otr_smp_aborted(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -148,7 +148,7 @@ ui_smp_aborted(ProfChatWin *chatwin) } void -ui_smp_successful(ProfChatWin *chatwin) +chatwin_otr_smp_success(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -156,7 +156,7 @@ ui_smp_successful(ProfChatWin *chatwin) } void -ui_smp_answer_success(ProfChatWin *chatwin) +chatwin_otr_smp_answer_success(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -164,7 +164,7 @@ ui_smp_answer_success(ProfChatWin *chatwin) } void -ui_smp_answer_failure(ProfChatWin *chatwin) +chatwin_otr_smp_answer_failure(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -172,7 +172,7 @@ ui_smp_answer_failure(ProfChatWin *chatwin) } void -ui_otr_authenticating(ProfChatWin *chatwin) +chatwin_otr_smp_authenticating(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -180,7 +180,7 @@ ui_otr_authenticating(ProfChatWin *chatwin) } void -ui_otr_authetication_waiting(ProfChatWin *chatwin) +chatwin_otr_smp_authenticaton_wait(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -188,7 +188,7 @@ ui_otr_authetication_waiting(ProfChatWin *chatwin) } void -ui_trust(ProfChatWin *chatwin) +chatwin_otr_trust(ProfChatWin *chatwin) { assert(chatwin != NULL); @@ -203,7 +203,7 @@ ui_trust(ProfChatWin *chatwin) } void -ui_untrust(ProfChatWin *chatwin) +chatwin_otr_untrust(ProfChatWin *chatwin) { assert(chatwin != NULL); diff --git a/src/ui/ui.h b/src/ui/ui.h index 5d92797d..eed77ba7 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -62,23 +62,23 @@ GSList* ui_get_chat_recipients(void); void ui_switch_win(ProfWin *window); void ui_sigwinch_handler(int sig); -void ui_gone_secure(ProfChatWin *chatwin, gboolean trusted); -void ui_gone_insecure(ProfChatWin *chatwin); -void ui_trust(ProfChatWin *chatwin); -void ui_untrust(ProfChatWin *chatwin); -void ui_smp_recipient_initiated(ProfChatWin *chatwin); -void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question); +void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted); +void chatwin_otr_unsecured(ProfChatWin *chatwin); +void chatwin_otr_trust(ProfChatWin *chatwin); +void chatwin_otr_untrust(ProfChatWin *chatwin); +void chatwin_otr_smp_init(ProfChatWin *chatwin); +void chatwin_otr_smp_init_q(ProfChatWin *chatwin, const char *question); -void ui_smp_successful(ProfChatWin *chatwin); -void ui_smp_unsuccessful_sender(ProfChatWin *chatwin); -void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin); -void ui_smp_aborted(ProfChatWin *chatwin); +void chatwin_otr_smp_success(ProfChatWin *chatwin); +void chatwin_otr_smp_sender_failed(ProfChatWin *chatwin); +void chatwin_otr_smp_receiver_failed(ProfChatWin *chatwin); +void chatwin_otr_smp_aborted(ProfChatWin *chatwin); -void ui_smp_answer_success(ProfChatWin *chatwin); -void ui_smp_answer_failure(ProfChatWin *chatwin); +void chatwin_otr_smp_answer_success(ProfChatWin *chatwin); +void chatwin_otr_smp_answer_failure(ProfChatWin *chatwin); -void ui_otr_authenticating(ProfChatWin *chatwin); -void ui_otr_authetication_waiting(ProfChatWin *chatwin); +void chatwin_otr_smp_authenticating(ProfChatWin *chatwin); +void chatwin_otr_smp_authenticaton_wait(ProfChatWin *chatwin); 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_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_message_receipt(ProfChatWin *chatwin, const char *const id); +void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id); void ui_disconnected(void); void ui_recipient_gone(const char *const barejid, const char *const resource); diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index f6f4cb78..de36676a 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -66,23 +66,23 @@ GSList* ui_get_chat_recipients(void) void ui_switch_win(ProfWin *win) {} -void ui_gone_secure(ProfChatWin *chatwin, gboolean trusted) {} -void ui_gone_insecure(ProfChatWin *chatwin) {} -void ui_trust(ProfChatWin *chatwin) {} -void ui_untrust(ProfChatWin *chatwin) {} -void ui_smp_recipient_initiated(ProfChatWin *chatwin) {} -void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) {} - -void ui_smp_successful(ProfChatWin *chatwin) {} -void ui_smp_unsuccessful_sender(ProfChatWin *chatwin) {} -void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) {} -void ui_smp_aborted(ProfChatWin *chatwin) {} - -void ui_smp_answer_success(ProfChatWin *chatwin) {} -void ui_smp_answer_failure(ProfChatWin *chatwin) {} - -void ui_otr_authenticating(ProfChatWin *chatwin) {} -void ui_otr_authetication_waiting(ProfChatWin *chatwin) {} +void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted) {} +void chatwin_otr_unsecured(ProfChatWin *chatwin) {} +void chatwin_otr_trust(ProfChatWin *chatwin) {} +void chatwin_otr_untrust(ProfChatWin *chatwin) {} +void chatwin_otr_smp_init(ProfChatWin *chatwin) {} +void chatwin_otr_smp_init_q(ProfChatWin *chatwin, const char *question) {} + +void chatwin_otr_smp_success(ProfChatWin *chatwin) {} +void chatwin_otr_smp_sender_failed(ProfChatWin *chatwin) {} +void chatwin_otr_smp_receiver_failed(ProfChatWin *chatwin) {} +void chatwin_otr_smp_aborted(ProfChatWin *chatwin) {} + +void chatwin_otr_smp_answer_success(ProfChatWin *chatwin) {} +void chatwin_otr_smp_answer_failure(ProfChatWin *chatwin) {} + +void chatwin_otr_smp_authenticating(ProfChatWin *chatwin) {} +void chatwin_otr_smp_authenticaton_wait(ProfChatWin *chatwin) {} void ui_sigwinch_handler(int sig) {} 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_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) {} |