chore: Add copyright header to C files who had none

This commit is contained in:
Michael Vetter
2026-03-09 13:14:44 +01:00
parent 798edce22a
commit 833090aac5
41 changed files with 442 additions and 114 deletions

View File

@@ -1,3 +1,11 @@
/*
* functionaltests.c
*
* Copyright (C) 2015 - 2018 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

View File

@@ -1,3 +1,11 @@
/*
* proftest.c
*
* Copyright (C) 2015 - 2016 James Booth <boothj5@gmail.com>
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <sys/stat.h>
#include <sys/wait.h>
#include <glib.h>
@@ -56,8 +64,8 @@ prof_expect(int fd, ...)
pfd.fd = fd;
pfd.events = POLLIN;
GError *error = NULL;
GRegex *ansi = g_regex_new("\\x1b\\[[0-9;]*[a-zA-Z]|\\x1b\\([a-zA-Z]", 0, 0, &error);
GError* error = NULL;
GRegex* ansi = g_regex_new("\\x1b\\[[0-9;]*[a-zA-Z]|\\x1b\\([a-zA-Z]", 0, 0, &error);
if (error) {
g_error_free(error);
return 0;
@@ -70,7 +78,7 @@ prof_expect(int fd, ...)
if (type == prof_expect_exact) {
gchar* escaped = g_regex_escape_string(pattern, -1);
error = NULL;
GRegex *regex = g_regex_new(escaped, G_REGEX_DOTALL | G_REGEX_OPTIMIZE, 0, &error);
GRegex* regex = g_regex_new(escaped, G_REGEX_DOTALL | G_REGEX_OPTIMIZE, 0, &error);
if (error) {
g_error_free(error);
g_free(escaped);
@@ -80,10 +88,10 @@ prof_expect(int fd, ...)
return 0;
}
g_free(escaped);
GMatchInfo *match_info;
GMatchInfo* match_info;
if (g_regex_match(regex, clean_output, 0, &match_info)) {
g_string_truncate(accumulated_output, 0);
g_string_truncate(accumulated_output, 0);
g_match_info_free(match_info);
g_regex_unref(regex);
g_free(clean_output);
@@ -94,9 +102,9 @@ prof_expect(int fd, ...)
g_match_info_free(match_info);
g_regex_unref(regex);
} else if (type == prof_expect_regexp) {
GMatchInfo *match_info;
GMatchInfo* match_info;
error = NULL;
GRegex *regex = g_regex_new(pattern, G_REGEX_DOTALL | G_REGEX_OPTIMIZE, 0, &error);
GRegex* regex = g_regex_new(pattern, G_REGEX_DOTALL | G_REGEX_OPTIMIZE, 0, &error);
if (error) {
g_error_free(error);
g_free(clean_output);
@@ -107,9 +115,9 @@ prof_expect(int fd, ...)
if (g_regex_match(regex, clean_output, 0, &match_info)) {
gint start_pos, end_pos;
g_match_info_fetch_pos(match_info, 0, &start_pos, &end_pos);
g_string_truncate(accumulated_output, 0);
g_match_info_free(match_info);
g_regex_unref(regex);
g_free(clean_output);
@@ -120,7 +128,7 @@ prof_expect(int fd, ...)
g_match_info_free(match_info);
g_regex_unref(regex);
}
g_free(clean_output);
int ret = poll(&pfd, 1, 10); // 10ms timeout for poll
@@ -253,7 +261,7 @@ prof_start(void)
pid_t pid = forkpty(&master, NULL, NULL, NULL);
if (pid == 0) {
system("stty sane -echo");
execlp("sh", "sh", "-c", "./tests/functionaltests/start_profanity.sh", (char *)0);
execlp("sh", "sh", "-c", "./tests/functionaltests/start_profanity.sh", (char*)0);
_exit(1);
}
prof_pid = pid;
@@ -263,8 +271,8 @@ prof_start(void)
int
init_prof_test(void** state)
{
const char *cfg = getenv("XDG_CONFIG_HOME");
const char *dat = getenv("XDG_DATA_HOME");
const char* cfg = getenv("XDG_CONFIG_HOME");
const char* dat = getenv("XDG_DATA_HOME");
config_orig = cfg ? g_strdup(cfg) : NULL;
data_orig = dat ? g_strdup(dat) : NULL;
@@ -272,7 +280,7 @@ init_prof_test(void** state)
setenv("XDG_DATA_HOME", XDG_DATA_HOME, 1);
usleep(1000 * 2000); // 2s delay between tests to let OS recover
int res = -1;
int port = 0;
for (int i = 0; i < 5; i++) {
@@ -337,7 +345,7 @@ int
close_prof_test(void** state)
{
prof_input("/quit");
// Give it some time to quit gracefully
int retries = 0;
int status;
@@ -445,7 +453,7 @@ prof_connect_with_roster(const char* roster)
assert_true(prof_output_regex("successfully"));
prof_expect_timeout = 10;
stbbr_wait_for("presence:*");
//usleep(1000 * 2000); // 2s delay
// usleep(1000 * 2000); // 2s delay
}
void

View File

@@ -1,3 +1,11 @@
/*
* proftest.h
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2020 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef __H_PROFTEST
#define __H_PROFTEST

View File

@@ -1,3 +1,11 @@
/*
* test_carbons.c
*
* Copyright (C) 2015 - 2017 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_carbons.h
*
* Copyright (C) 2015 - 2016 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void send_enable_carbons(void** state);
void connect_with_carbons_enabled(void** state);
void send_disable_carbons(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_chat_session.c
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_chat_session.h
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void sends_message_to_barejid_when_contact_offline(void** state);
void sends_message_to_barejid_when_contact_online(void** state);
void sends_message_to_fulljid_when_received_from_fulljid(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_connect.c
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_connect.h
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void connect_jid_requests_roster(void** state);
void connect_jid_sends_presence_after_receiving_roster(void** state);
void connect_jid_requests_bookmarks(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_disconnect.c
*
* Copyright (C) 2016 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1 +1,9 @@
/*
* test_disconnect.h
*
* Copyright (C) 2016 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void disconnect_ends_session(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_message.c
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_message.h
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void message_send(void** state);
void message_receive_console(void** state);
void message_receive_chatwin(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_muc.c
*
* Copyright (C) 2015 - 2018 James Booth <boothj5@gmail.com>
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_muc.h
*
* Copyright (C) 2015 - 2018 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void sends_room_join(void** state);
void sends_room_join_with_nick(void** state);
void sends_room_join_with_password(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_ping.c
*
* Copyright (C) 2015 - 2017 James Booth <boothj5@gmail.com>
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>
@@ -11,15 +19,15 @@ void
ping_server(void** state)
{
stbbr_for_query("http://jabber.org/protocol/disco#info",
"<iq id='*' to='stabber@localhost/profanity' type='result' from='localhost'>"
"<query xmlns='http://jabber.org/protocol/disco#info'>"
"<identity category='server' type='im' name='Prosody'/>"
"<feature var='urn:xmpp:ping'/>"
"</query>"
"</iq>");
"<iq id='*' to='stabber@localhost/profanity' type='result' from='localhost'>"
"<query xmlns='http://jabber.org/protocol/disco#info'>"
"<identity category='server' type='im' name='Prosody'/>"
"<feature var='urn:xmpp:ping'/>"
"</query>"
"</iq>");
stbbr_for_xmlns("urn:xmpp:ping",
"<iq id='*' type='result' to='stabber@localhost/profanity'/>");
"<iq id='*' type='result' to='stabber@localhost/profanity'/>");
prof_connect();
@@ -42,11 +50,11 @@ void
ping_server_not_supported(void** state)
{
stbbr_for_query("http://jabber.org/protocol/disco#info",
"<iq id='*' to='stabber@localhost/profanity' type='result' from='localhost'>"
"<query xmlns='http://jabber.org/protocol/disco#info'>"
"<identity category='server' type='im' name='Stabber'/>"
"</query>"
"</iq>");
"<iq id='*' to='stabber@localhost/profanity' type='result' from='localhost'>"
"<query xmlns='http://jabber.org/protocol/disco#info'>"
"<identity category='server' type='im' name='Stabber'/>"
"</query>"
"</iq>");
prof_connect();
@@ -82,7 +90,7 @@ ping_jid(void** state)
"</iq>");
stbbr_for_xmlns("urn:xmpp:ping",
"<iq id='*' type='result' from='buddy1@localhost/mobile' to='stabber@localhost/profanity'/>");
"<iq id='*' type='result' from='buddy1@localhost/mobile' to='stabber@localhost/profanity'/>");
prof_connect();

View File

@@ -1,3 +1,11 @@
/*
* test_ping.h
*
* Copyright (C) 2015 - 2017 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void ping_server(void** state);
void ping_server_not_supported(void** state);
void ping_responds_to_server_request(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_presence.c
*
* Copyright (C) 2015 - 2017 James Booth <boothj5@gmail.com>
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_presence.h
*
* Copyright (C) 2015 - 2017 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void presence_away(void** state);
void presence_away_with_message(void** state);
void presence_online(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_receipts.c
*
* Copyright (C) 2015 - 2016 James Booth <boothj5@gmail.com>
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_receipts.h
*
* Copyright (C) 2015 - 2016 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void does_not_send_receipt_request_to_barejid(void** state);
void send_receipt_request(void** state);
void send_receipt_on_request(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_rooms.c
*
* Copyright (C) 2015 - 2018 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>
@@ -11,12 +19,12 @@ void
rooms_query(void** state)
{
stbbr_for_query("http://jabber.org/protocol/disco#items",
"<iq id='*' type='result' to='stabber@localhost/profanity' from='conference.localhost'>"
"<query xmlns='http://jabber.org/protocol/disco#items'>"
"<item jid='chatroom@conference.localhost' name='A chat room'/>"
"<item jid='hangout@conference.localhost' name='Another chat room'/>"
"</query>"
"</iq>");
"<iq id='*' type='result' to='stabber@localhost/profanity' from='conference.localhost'>"
"<query xmlns='http://jabber.org/protocol/disco#items'>"
"<item jid='chatroom@conference.localhost' name='A chat room'/>"
"<item jid='hangout@conference.localhost' name='Another chat room'/>"
"</query>"
"</iq>");
prof_connect();

View File

@@ -1 +1,9 @@
/*
* test_rooms.h
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void rooms_query(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_roster.c
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_roster.h
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void sends_new_item(void** state);
void sends_new_item_nick(void** state);
void sends_remove_item(void** state);

View File

@@ -1,3 +1,11 @@
/*
* test_software.c
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <glib.h>
#include "prof_cmocka.h"
#include <stdlib.h>

View File

@@ -1,3 +1,11 @@
/*
* test_software.h
*
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
void send_software_version_request(void** state);
void display_software_version_result(void** state);
void shows_message_when_software_version_error(void** state);