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

Added focus param to ui_room_join, not set for bookmark autojoin

Issue #194
This commit is contained in:
James Booth 2014-04-13 02:52:25 +01:00
parent f332b6681e
commit 71180f66d7
7 changed files with 20 additions and 12 deletions

View File

@ -1663,7 +1663,7 @@ cmd_join(gchar **args, struct cmd_help_t help)
if (!muc_room_is_active(room)) {
presence_join_room(room, nick, passwd);
}
ui_room_join(room);
ui_room_join(room, TRUE);
muc_remove_invite(room);
jid_destroy(room_arg);

View File

@ -502,5 +502,6 @@ handle_autoping_cancel(void)
void
handle_bookmark_autojoin(char *jid)
{
ui_room_join(jid);
ui_room_join(jid, FALSE);
muc_remove_invite(jid);
}

View File

@ -1219,7 +1219,7 @@ _ui_outgoing_msg(const char * const from, const char * const to,
}
static void
_ui_room_join(char *room)
_ui_room_join(char *room, gboolean focus)
{
ProfWin *window = wins_get_by_recipient(room);
int num = 0;
@ -1230,7 +1230,12 @@ _ui_room_join(char *room)
}
num = wins_get_num(window);
ui_switch_win(num);
if (focus) {
ui_switch_win(num);
} else {
status_bar_active(num);
}
}
static void

View File

@ -100,7 +100,7 @@ void (*ui_disconnected)(void);
void (*ui_recipient_gone)(const char * const barejid);
void (*ui_outgoing_msg)(const char * const from, const char * const to,
const char * const message);
void (*ui_room_join)(char *room);
void (*ui_room_join)(char *room, gboolean focus);
void (*ui_room_roster)(const char * const room, GList *roster, const char * const presence);
void (*ui_room_history)(const char * const room_jid, const char * const nick,
GTimeVal tv_stamp, const char * const message);

View File

@ -109,7 +109,7 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state)
mock_presence_join_room();
presence_join_room_expect(expected_room, nick, NULL);
ui_room_join_expect(expected_room);
ui_room_join_expect(expected_room, TRUE);
gboolean result = cmd_join(args, *help);
assert_true(result);
@ -136,7 +136,7 @@ void cmd_join_uses_supplied_nick(void **state)
mock_presence_join_room();
presence_join_room_expect(room, nick, NULL);
ui_room_join_expect(room);
ui_room_join_expect(room, TRUE);
gboolean result = cmd_join(args, *help);
assert_true(result);
@ -163,7 +163,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
mock_presence_join_room();
presence_join_room_expect(room, account_nick, NULL);
ui_room_join_expect(room);
ui_room_join_expect(room, TRUE);
gboolean result = cmd_join(args, *help);
assert_true(result);
@ -193,7 +193,7 @@ void cmd_join_uses_password_when_supplied(void **state)
mock_presence_join_room();
presence_join_room_expect(expected_room, account_nick, password);
ui_room_join_expect(expected_room);
ui_room_join_expect(expected_room, TRUE);
gboolean result = cmd_join(args, *help);
assert_true(result);

View File

@ -166,9 +166,10 @@ gboolean _mock_ui_current_win_is_otr(void)
}
static
void _mock_ui_room_join(char *room)
void _mock_ui_room_join(char *room, gboolean focus)
{
check_expected(room);
check_expected(focus);
}
static
@ -433,10 +434,11 @@ ui_current_win_is_otr_returns(gboolean result)
}
void
ui_room_join_expect(char *room)
ui_room_join_expect(char *room, gboolean focus)
{
ui_room_join = _mock_ui_room_join;
expect_string(_mock_ui_room_join, room, room);
expect_value(_mock_ui_room_join, focus, focus);
}
void

View File

@ -59,7 +59,7 @@ void ui_current_print_line_expect(char *message);
void ui_current_win_is_otr_returns(gboolean result);
void ui_room_join_expect(char *room);
void ui_room_join_expect(char *room, gboolean focus);
void mock_cons_show_roster(void);
void cons_show_roster_expect(GSList *list);