From c0b099f347975852c5ee36f1295b3e02a246af12 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 20 Dec 2015 19:29:17 +0000 Subject: [PATCH 1/3] Fixed cygwin dependencies --- install-all.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install-all.sh b/install-all.sh index e545dd38..e435d0a2 100755 --- a/install-all.sh +++ b/install-all.sh @@ -65,9 +65,9 @@ cygwin_prepare() if ! command -v apt-cyg &>/dev/null; then cyg_install_apt_cyg; fi if [ -n "$CYG_MIRROR" ]; then - apt-cyg -m $CYG_MIRROR install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool + apt-cyg -m $CYG_MIRROR install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool libpcre-devel else - apt-cyg install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool + apt-cyg install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool libpcre-devel fi } From 1b88b5706ea58ff61d88b7f24e548a72676e7b42 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 20 Dec 2015 22:50:03 +0000 Subject: [PATCH 2/3] Change console incoming message text to include "win" --- src/ui/console.c | 2 +- tests/functionaltests/test_chat_session.c | 8 ++++---- tests/functionaltests/test_message.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ui/console.c b/src/ui/console.c index 4e7077c4..f6af1377 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -325,7 +325,7 @@ 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 (%d)", short_from, ui_index); + win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< incoming from %s (win %d)", short_from, ui_index); cons_alert(); } diff --git a/tests/functionaltests/test_chat_session.c b/tests/functionaltests/test_chat_session.c index d1229e90..9d3f8eb6 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) "First message" "" ); - assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); + assert_true(prof_output_exact("<< incoming from Buddy1/mobile (win 2)")); prof_input("/msg buddy1@localhost Hi there"); @@ -91,7 +91,7 @@ sends_subsequent_messages_to_fulljid(void **state) "First message" "" ); - assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); + assert_true(prof_output_exact("<< incoming from 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) "First message" "" ); - assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); + assert_true(prof_output_exact("<< incoming from 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) "From first resource" "" ); - assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); + assert_true(prof_output_exact("<< incoming from 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 0957b309..bff89e7d 100644 --- a/tests/functionaltests/test_message.c +++ b/tests/functionaltests/test_message.c @@ -38,5 +38,5 @@ message_receive(void **state) "" ); - assert_true(prof_output_exact("<< incoming from someuser@chatserv.org/laptop (2)")); + assert_true(prof_output_exact("<< incoming from someuser@chatserv.org/laptop (win 2)")); } From d9f5a2bda65ff9b5a147a11caed1031be93809d6 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 20 Dec 2015 23:26:05 +0000 Subject: [PATCH 3/3] Updated console new message text --- src/ui/console.c | 18 ++++++++++++++++-- src/ui/privwin.c | 19 +++++++++++-------- src/ui/ui.h | 1 + tests/functionaltests/test_chat_session.c | 8 ++++---- tests/functionaltests/test_message.c | 2 +- tests/functionaltests/test_muc.c | 2 +- 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) "First 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) "First 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) "First 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) "From first resource" "" ); - 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) "" ); - 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) "" ); - 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)")); }