Merge branch 'master' into openpgp
This commit is contained in:
@@ -423,30 +423,23 @@ void cmd_otr_theirfp_shows_message_when_in_private(void **state)
|
||||
|
||||
void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state)
|
||||
{
|
||||
char *recipient = "someuser@someserver.com";
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "theirfp", NULL };
|
||||
|
||||
ProfWin window;
|
||||
window.type = WIN_CHAT;
|
||||
ProfChatWin chatwin;
|
||||
chatwin.window = window;
|
||||
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
||||
chatwin->barejid = strdup(recipient);
|
||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
||||
will_return(win_create_chat, &chatwin->window);
|
||||
|
||||
wins_init();
|
||||
wins_new_chat(recipient);
|
||||
wins_set_current_by_num(2);
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||
|
||||
gboolean result = cmd_otr(&window, args, *help);
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
wins_close_current();
|
||||
}
|
||||
|
||||
void cmd_otr_theirfp_shows_fingerprint(void **state)
|
||||
@@ -458,32 +451,27 @@ void cmd_otr_theirfp_shows_fingerprint(void **state)
|
||||
GString *message = g_string_new(recipient);
|
||||
g_string_append(message, "'s OTR fingerprint: ");
|
||||
g_string_append(message, fingerprint);
|
||||
|
||||
ProfWin window;
|
||||
window.type = WIN_CHAT;
|
||||
|
||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
||||
chatwin->barejid = strdup(recipient);
|
||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
||||
chatwin->enc_mode = PROF_ENC_OTR;
|
||||
will_return(win_create_chat, &chatwin->window);
|
||||
|
||||
wins_init();
|
||||
wins_new_chat(recipient);
|
||||
wins_set_current_by_num(2);
|
||||
ProfChatWin chatwin;
|
||||
chatwin.window = window;
|
||||
chatwin.barejid = recipient;
|
||||
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||
chatwin.enc_mode = PROF_ENC_OTR;
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
expect_string(otr_get_their_fingerprint, recipient, chatwin->barejid);
|
||||
expect_string(otr_get_their_fingerprint, recipient, recipient);
|
||||
will_return(otr_get_their_fingerprint, strdup(fingerprint));
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, message->str);
|
||||
|
||||
gboolean result = cmd_otr(&window, args, *help);
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||
assert_true(result);
|
||||
|
||||
g_string_free(message, TRUE);
|
||||
free(help);
|
||||
wins_close_current();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -524,28 +512,23 @@ void cmd_otr_start_shows_message_when_already_started(void **state)
|
||||
char *recipient = "someone@server.org";
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "start", NULL };
|
||||
ProfWin window;
|
||||
window.type = WIN_CHAT;
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
||||
chatwin->barejid = strdup(recipient);
|
||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
||||
chatwin->enc_mode = PROF_ENC_OTR;
|
||||
will_return(win_create_chat, &chatwin->window);
|
||||
|
||||
wins_init();
|
||||
wins_new_chat(recipient);
|
||||
wins_set_current_by_num(2);
|
||||
ProfWin window;
|
||||
window.type = WIN_CHAT;
|
||||
ProfChatWin chatwin;
|
||||
chatwin.window = window;
|
||||
chatwin.barejid = recipient;
|
||||
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||
chatwin.enc_mode = PROF_ENC_OTR;
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");
|
||||
|
||||
gboolean result = cmd_otr(&window, args, *help);
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
wins_close_current();
|
||||
}
|
||||
|
||||
void cmd_otr_start_shows_message_when_no_key(void **state)
|
||||
@@ -553,29 +536,24 @@ void cmd_otr_start_shows_message_when_no_key(void **state)
|
||||
char *recipient = "someone@server.org";
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "start", NULL };
|
||||
ProfWin window;
|
||||
window.type = WIN_CHAT;
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
will_return(otr_key_loaded, FALSE);
|
||||
|
||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
||||
chatwin->barejid = strdup(recipient);
|
||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
||||
chatwin->enc_mode = PROF_ENC_NONE;
|
||||
will_return(win_create_chat, &chatwin->window);
|
||||
|
||||
wins_init();
|
||||
wins_new_chat(recipient);
|
||||
wins_set_current_by_num(2);
|
||||
ProfWin window;
|
||||
window.type = WIN_CHAT;
|
||||
ProfChatWin chatwin;
|
||||
chatwin.window = window;
|
||||
chatwin.barejid = recipient;
|
||||
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||
chatwin.enc_mode = PROF_ENC_NONE;
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
|
||||
|
||||
gboolean result = cmd_otr(&window, args, *help);
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
wins_close_current();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -585,30 +563,26 @@ cmd_otr_start_sends_otr_query_message_to_current_recipeint(void **state)
|
||||
char *query_message = "?OTR?";
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "start", NULL };
|
||||
|
||||
ProfWin window;
|
||||
window.type = WIN_CHAT;
|
||||
|
||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
||||
chatwin->barejid = strdup(recipient);
|
||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
||||
will_return(win_create_chat, &chatwin->window);
|
||||
|
||||
wins_init();
|
||||
wins_new_chat(recipient);
|
||||
wins_set_current_by_num(2);
|
||||
ProfChatWin chatwin;
|
||||
chatwin.window = window;
|
||||
chatwin.barejid = recipient;
|
||||
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||
chatwin.enc_mode = PROF_ENC_NONE;
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
will_return(otr_key_loaded, TRUE);
|
||||
will_return(otr_start_query, query_message);
|
||||
|
||||
expect_string(message_send_chat_encrypted, barejid, chatwin->barejid);
|
||||
expect_string(message_send_chat_encrypted, barejid, recipient);
|
||||
expect_string(message_send_chat_encrypted, msg, query_message);
|
||||
|
||||
gboolean result = cmd_otr(&window, args, *help);
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
wins_close_current();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user