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

Updated console new message text

This commit is contained in:
James Booth 2015-12-20 23:26:05 +00:00
parent 1b88b5706e
commit d9f5a2bda6
6 changed files with 34 additions and 16 deletions

View File

@ -311,7 +311,7 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
ui_index = 0;
}
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< incoming from %s in %s (win %d)", nick, room, ui_index);
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s in %s (win %d)", nick, room, ui_index);
cons_alert();
}
@ -325,7 +325,21 @@ cons_show_incoming_message(const char *const short_from, const int win_index)
if (ui_index == 10) {
ui_index = 0;
}
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< incoming from %s (win %d)", short_from, ui_index);
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< chat message: %s (win %d)", short_from, ui_index);
cons_alert();
}
void
cons_show_incoming_private_message(const char *const nick, const char *const room, const int win_index)
{
ProfWin *console = wins_get_console();
int ui_index = win_index;
if (ui_index == 10) {
ui_index = 0;
}
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< private message: %s in %s (win %d)", nick, room, ui_index);
cons_alert();
}

View File

@ -51,14 +51,17 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDat
ProfWin *window = (ProfWin*) privatewin;
int num = wins_get_num(window);
char *display_from = get_nick_from_full_jid(privatewin->fulljid);
Jid *jidp = jid_create(privatewin->fulljid);
if (jidp == NULL) {
return;
}
gboolean is_current = wins_is_current(window);
gboolean notify = prefs_do_chat_notify(is_current, message);
// currently viewing chat window with sender
if (wins_is_current(window)) {
win_print_incoming_message(window, timestamp, display_from, message, PROF_MSG_PLAIN);
win_print_incoming_message(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
title_bar_set_typing(FALSE);
status_bar_active(num);
@ -69,8 +72,8 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDat
privatewin->notify = TRUE;
}
status_bar_new(num);
cons_show_incoming_message(display_from, num);
win_print_incoming_message(window, timestamp, display_from, message, PROF_MSG_PLAIN);
cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num);
win_print_incoming_message(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
if (prefs_get_boolean(PREF_FLASH)) {
flash();
@ -82,7 +85,7 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDat
}
if (!notify) {
free(display_from);
jid_destroy(jidp);
return;
}
@ -92,12 +95,12 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDat
}
if (prefs_get_boolean(PREF_NOTIFY_CHAT_TEXT)) {
notify_message(display_from, ui_index, message);
notify_message(jidp->resourcepart, ui_index, message);
} else {
notify_message(display_from, ui_index, NULL);
notify_message(jidp->resourcepart, ui_index, NULL);
}
free(display_from);
jid_destroy(jidp);
}
void

View File

@ -259,6 +259,7 @@ void cons_check_version(gboolean not_available_msg);
void cons_show_typing(const char *const barejid);
void cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index);
void cons_show_incoming_message(const char *const short_from, const int win_index);
void cons_show_incoming_private_message(const char *const nick, const char *const room, const int win_index);
void cons_show_room_invites(GSList *invites);
void cons_show_received_subs(void);
void cons_show_sent_subs(void);

View File

@ -63,7 +63,7 @@ sends_message_to_fulljid_when_received_from_fulljid(void **state)
"<body>First message</body>"
"</message>"
);
assert_true(prof_output_exact("<< incoming from Buddy1/mobile (win 2)"));
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Hi there");
@ -91,7 +91,7 @@ sends_subsequent_messages_to_fulljid(void **state)
"<body>First message</body>"
"</message>"
);
assert_true(prof_output_exact("<< incoming from Buddy1/mobile (win 2)"));
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received(
@ -132,7 +132,7 @@ resets_to_barejid_after_presence_received(void **state)
"<body>First message</body>"
"</message>"
);
assert_true(prof_output_exact("<< incoming from Buddy1/mobile (win 2)"));
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received(
@ -182,7 +182,7 @@ new_session_when_message_received_from_different_fulljid(void **state)
"<body>From first resource</body>"
"</message>"
);
assert_true(prof_output_exact("<< incoming from Buddy1/mobile (win 2)"));
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
prof_input("/msg buddy1@localhost Outgoing 1");
assert_true(stbbr_received(

View File

@ -38,5 +38,5 @@ message_receive(void **state)
"</message>"
);
assert_true(prof_output_exact("<< incoming from someuser@chatserv.org/laptop (win 2)"));
assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
}

View File

@ -250,5 +250,5 @@ shows_message_in_console_when_window_not_focussed(void **state)
"</message>"
);
assert_true(prof_output_exact("<< incoming from testoccupant in testroom@conference.localhost (win 2)"));
assert_true(prof_output_exact("<< room message: testoccupant in testroom@conference.localhost (win 2)"));
}