diff --git a/src/chatlog/chatlinestorage.cpp b/src/chatlog/chatlinestorage.cpp
index 2497e8ceb..5491abfa3 100644
--- a/src/chatlog/chatlinestorage.cpp
+++ b/src/chatlog/chatlinestorage.cpp
@@ -1,3 +1,22 @@
+/*
+ Copyright © 2020-2021 by The qTox Project Contributors
+
+ This file is part of qTox, a Qt-based graphical interface for Tox.
+
+ qTox is libre software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ qTox is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with qTox. If not, see .
+*/
+
#include "chatlinestorage.h"
#include
diff --git a/src/chatlog/chatlinestorage.h b/src/chatlog/chatlinestorage.h
index c63229177..20bc1f5a2 100644
--- a/src/chatlog/chatlinestorage.h
+++ b/src/chatlog/chatlinestorage.h
@@ -1,3 +1,22 @@
+/*
+ Copyright © 2021 by The qTox Project Contributors
+
+ This file is part of qTox, a Qt-based graphical interface for Tox.
+
+ qTox is libre software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ qTox is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with qTox. If not, see .
+*/
+
#pragma once
#include "src/chatlog/chatline.h"
diff --git a/src/chatlog/chatwidget.cpp b/src/chatlog/chatwidget.cpp
index 330698ab4..899ce5c4f 100644
--- a/src/chatlog/chatwidget.cpp
+++ b/src/chatlog/chatwidget.cpp
@@ -536,8 +536,6 @@ void ChatWidget::insertChatlines(std::map chatLines)
auto date = QDateTime(chatLog.at(idx).getTimestamp().date());
#endif
- auto insertionIdx = std::distance(chatLineStorage->begin(), insertedMessageIt);
-
if (!chatLineStorage->contains(date)) {
// If there is no dateline for the given date we need to insert it
// above the line we'd like to insert.
diff --git a/test/chatlog/chatlinestorage_test.cpp b/test/chatlog/chatlinestorage_test.cpp
index c1d494798..0b020f386 100644
--- a/test/chatlog/chatlinestorage_test.cpp
+++ b/test/chatlog/chatlinestorage_test.cpp
@@ -1,3 +1,21 @@
+/*
+ Copyright © 2021 by The qTox Project Contributors
+
+ This file is part of qTox, a Qt-based graphical interface for Tox.
+
+ qTox is libre software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ qTox is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with qTox. If not, see .
+*/
#include "src/chatlog/chatlinestorage.h"
#include