aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-12-20 23:26:05 +0000
committerJames Booth <boothj5@gmail.com>2015-12-20 23:26:05 +0000
commitd9f5a2bda65ff9b5a147a11caed1031be93809d6 (patch)
treee038d05eae86065bbd5a4abf66c9c6a79229e9ad
parent1b88b5706ea58ff61d88b7f24e548a72676e7b42 (diff)
downloadprofani-tty-d9f5a2bda65ff9b5a147a11caed1031be93809d6.tar.gz
Updated console new message text
-rw-r--r--src/ui/console.c18
-rw-r--r--src/ui/privwin.c19
-rw-r--r--src/ui/ui.h1
-rw-r--r--tests/functionaltests/test_chat_session.c8
-rw-r--r--tests/functionaltests/test_message.c2
-rw-r--r--tests/functionaltests/test_muc.c2
6 files changed, 34 insertions, 16 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index f6af1377..7776af37 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -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();
}
diff --git a/src/ui/privwin.c b/src/ui/privwin.c
index 77a0a92d..b6f1a04d 100644
--- a/src/ui/privwin.c
+++ b/src/ui/privwin.c
@@ -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
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 7bb15545..d6d71b24 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -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);
diff --git a/tests/functionaltests/test_chat_session.c b/tests/functionaltests/test_chat_session.c
index 9d3f8eb6..9e779afa 100644
--- a/tests/functionaltests/test_chat_session.c
+++ b/tests/functionaltests/test_chat_session.c
@@ -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(
diff --git a/tests/functionaltests/test_message.c b/tests/functionaltests/test_message.c
index bff89e7d..707b2560 100644
--- a/tests/functionaltests/test_message.c
+++ b/tests/functionaltests/test_message.c
@@ -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)"));
}
diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c
index 47cbd84e..c0c4aaee 100644
--- a/tests/functionaltests/test_muc.c
+++ b/tests/functionaltests/test_muc.c
@@ -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)"));
}