about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG2
-rw-r--r--src/log.c2
-rw-r--r--tests/functionaltests/functionaltests.c2
-rw-r--r--tests/functionaltests/test_muc.c54
-rw-r--r--tests/functionaltests/test_muc.h2
5 files changed, 60 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index ba2199ba..2abe4bce 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,7 +2,7 @@
 =====
 
 - Allow moving vertical window positions (/titlebar, /mainwin, /statusbar, /inputwin)
-- Allow loading/unloading all pluguns (/plugins)
+- Allow loading/unloading all plugins (/plugins)
 - Allow installing plugins from directory (/plugins)
 - Theme option for status bar time (statusbar.time)
 - Case/accent insensitive autocompletion
diff --git a/src/log.c b/src/log.c
index 78306c3c..886e6aac 100644
--- a/src/log.c
+++ b/src/log.c
@@ -228,7 +228,7 @@ _rotate_log_file(void)
     size_t len = strlen(log_file);
     char *log_file_new = malloc(len + 3);
 
-    strncpy(log_file_new, log_file, len);
+    memcpy(log_file_new, log_file, len);
     log_file_new[len] = '.';
     log_file_new[len+1] = '1';
     log_file_new[len+2] = 0;
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index b634cfd2..5e8656b7 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -101,6 +101,8 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(shows_history_message),
         PROF_FUNC_TEST(shows_occupant_join),
         PROF_FUNC_TEST(shows_message),
+        PROF_FUNC_TEST(shows_me_message_from_occupant),
+        PROF_FUNC_TEST(shows_me_message_from_self),
         PROF_FUNC_TEST(shows_all_messages_in_console_when_window_not_focussed),
         PROF_FUNC_TEST(shows_first_message_in_console_when_window_not_focussed),
         PROF_FUNC_TEST(shows_no_message_in_console_when_window_not_focussed),
diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c
index e7fc8dcb..3aac9988 100644
--- a/tests/functionaltests/test_muc.c
+++ b/tests/functionaltests/test_muc.c
@@ -209,6 +209,60 @@ shows_message(void **state)
 }
 
 void
+shows_me_message_from_occupant(void **state)
+{
+    prof_connect();
+
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+            "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
+            "<x xmlns='http://jabber.org/protocol/muc#user'>"
+                "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
+            "</x>"
+            "<status code='110'/>"
+        "</presence>"
+    );
+
+    prof_input("/join testroom@conference.localhost");
+    assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
+
+    stbbr_send(
+        "<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
+            "<body>/me did something</body>"
+        "</message>"
+    );
+
+    assert_true(prof_output_exact("*testoccupant did something"));
+}
+
+void
+shows_me_message_from_self(void **state)
+{
+    prof_connect();
+
+    stbbr_for_id("prof_join_4",
+        "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+            "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>"
+            "<x xmlns='http://jabber.org/protocol/muc#user'>"
+                "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
+            "</x>"
+            "<status code='110'/>"
+        "</presence>"
+    );
+
+    prof_input("/join testroom@conference.localhost");
+    assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
+
+    stbbr_send(
+        "<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
+            "<body>/me did something</body>"
+        "</message>"
+    );
+
+    assert_true(prof_output_exact("*stabber did something"));
+}
+
+void
 shows_all_messages_in_console_when_window_not_focussed(void **state)
 {
     prof_connect();
diff --git a/tests/functionaltests/test_muc.h b/tests/functionaltests/test_muc.h
index 4f3c4f5d..1636bd05 100644
--- a/tests/functionaltests/test_muc.h
+++ b/tests/functionaltests/test_muc.h
@@ -7,6 +7,8 @@ void shows_subject_on_join(void **state);
 void shows_history_message(void **state);
 void shows_occupant_join(void **state);
 void shows_message(void **state);
+void shows_me_message_from_occupant(void **state);
+void shows_me_message_from_self(void **state);
 void shows_all_messages_in_console_when_window_not_focussed(void **state);
 void shows_first_message_in_console_when_window_not_focussed(void **state);
 void shows_no_message_in_console_when_window_not_focussed(void **state);