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 @@
/*
* profapi.h
*
* Copyright (C) 2016 - 2017 James Booth <boothj5@gmail.com>
* Copyright (C) 2021 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/** @file
C plugin API.
*/
@@ -12,13 +20,13 @@ List of all hooks which plugins may implement: {@link profhooks.h}
typedef char* PROF_WIN_TAG;
/** Type representing a function pointer to a command callback */
typedef void(*CMD_CB)(char **args);
typedef void (*CMD_CB)(char** args);
/** Type representing a function pointer to a timed callback */
typedef void(*TIMED_CB)(void);
typedef void (*TIMED_CB)(void);
/** Type representing a function pointer to a window callback */
typedef void(*WINDOW_CB)(PROF_WIN_TAG win, char *line);
typedef void (*WINDOW_CB)(PROF_WIN_TAG win, char* line);
/** Highlights the console window in the status bar. */
void prof_cons_alert(void);
@@ -28,7 +36,7 @@ Show a message in the console window.
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_cons_show(const char * const message);
int prof_cons_show(const char* const message);
/**
Show a message in the console, using the specified theme.
@@ -39,14 +47,14 @@ Themes are specified in ~/.local/share/profanity/plugin_themes
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_cons_show_themed(const char *const group, const char *const item, const char *const def, const char *const message);
int prof_cons_show_themed(const char* const group, const char* const item, const char* const def, const char* const message);
/**
Show a message indicating the command has been called incorrectly.
@param cmd the command name with leading slash, e.g. "/say"
@return 1 on success, 0 on failure
*/
int prof_cons_bad_cmd_usage(const char *const cmd);
int prof_cons_bad_cmd_usage(const char* const cmd);
/**
Register a new command, with help information, and callback for command execution.
@@ -60,9 +68,9 @@ Profanity will do some basic validation when the command is called using the arg
@param examples example usages
@param callback The {@link CMD_CB} function to execute when the command is invoked
*/
void prof_register_command(const char *command_name, int min_args, int max_args,
char **synopsis, const char *description, char *arguments[][2], char **examples,
CMD_CB callback);
void prof_register_command(const char* command_name, int min_args, int max_args,
char** synopsis, const char* description, char* arguments[][2], char** examples,
CMD_CB callback);
/**
Register a function that Profanity will call periodically.
@@ -76,7 +84,7 @@ Add values to be autocompleted by Profanity for a command, or command argument.
@param key the prefix to trigger autocompletion
@param items the items to return on autocompletion
*/
void prof_completer_add(const char *key, char **items);
void prof_completer_add(const char* key, char** items);
/**
Remove values from autocompletion for a command, or command argument.
@@ -84,21 +92,21 @@ Remove values from autocompletion for a command, or command argument.
@param key the prefix from which to remove the autocompletion items
@param items the items to remove
*/
void prof_completer_remove(const char *key, char **items);
void prof_completer_remove(const char* key, char** items);
/**
Remove all values from autocompletion for a command, or command argument.
@param key the prefix from which to clear the autocompletion items
*/
void prof_completer_clear(const char *key);
void prof_completer_clear(const char* key);
/**
Add filepath autocompletion for a command, or command argument.
@param prefix the prefix from which filepath autocompletion will be triggered
*/
void prof_filepath_completer_add(const char *prefix);
void prof_filepath_completer_add(const char* prefix);
/**
Send a desktop notification.
@@ -106,13 +114,13 @@ Send a desktop notification.
@param timeout_ms the length of time before the notification disappears in milliseconds
@param category the category of the notification, also displayed
*/
void prof_notify(const char *message, int timeout_ms, const char *category);
void prof_notify(const char* message, int timeout_ms, const char* category);
/**
Send a line of input to Profanity to execute.
@param line the line to send
*/
void prof_send_line(char *line);
void prof_send_line(char* line);
/**
Retrieve the Jabber ID of the current chat recipient, when in a chat window.
@@ -142,13 +150,13 @@ char* prof_get_current_nick(void);
Retrieve the nickname for a given barejid if it is in the roster.
@return the users nickname e.g. "eddie", or the input barejid if it is not in the roster.
*/
char* prof_get_name_from_roster(const char *barejid);
char* prof_get_name_from_roster(const char* barejid);
/**
Retrieve the barejid for a given nickname if it is in the roster.
@return the users barejid e.g. "eddie@server.tld", or NULL if the nickname is not in the roster.
*/
char* prof_get_barejid_from_roster(const char *name);
char* prof_get_barejid_from_roster(const char* name);
/**
Retrieve nicknames of all occupants in a chat room, when in a chat room window.
@@ -161,31 +169,31 @@ Retrieve current nickname used in chat room.
@param barejid The room's Jabber ID
@return Room nickname.
*/
char* prof_get_room_nick(const char *barejid);
char* prof_get_room_nick(const char* barejid);
/**
Write to the Profanity log at level DEBUG.
@param message The message to log
*/
void prof_log_debug(const char *message);
void prof_log_debug(const char* message);
/**
Write to the Profanity log at level INFO.
@param message The message to log
*/
void prof_log_info(const char *message);
void prof_log_info(const char* message);
/**
Write to the Profanity log at level WARNING.
@param message The message to log
*/
void prof_log_warning(const char *message);
void prof_log_warning(const char* message);
/**
Write to the Profanity log at level ERROR.
@param message The message to log
*/
void prof_log_error(const char *message);
void prof_log_error(const char* message);
/**
Create a plugin window.
@@ -214,7 +222,7 @@ Show a message in the plugin window.
@param message The message to print
@return 1 on success, 0 on failure
*/
int prof_win_show(PROF_WIN_TAG win, char *message);
int prof_win_show(PROF_WIN_TAG win, char* message);
/**
Show a message in the plugin window, using the specified theme.
@@ -226,14 +234,14 @@ Themes are specified in ~/.local/share/profanity/plugin_themes
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_win_show_themed(PROF_WIN_TAG tag, char *group, char *key, char *def, char *message);
int prof_win_show_themed(PROF_WIN_TAG tag, char* group, char* key, char* def, char* message);
/**
Send an XMPP stanza
@param stanza an XMPP stanza
@return 1 if the stanza was sent successfully, 0 otherwise
*/
int prof_send_stanza(char *stanza);
int prof_send_stanza(char* stanza);
/**
Get a boolean setting
@@ -243,7 +251,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param def default value if setting not found
@return the setting, or default value
*/
int prof_settings_boolean_get(char *group, char *key, int def);
int prof_settings_boolean_get(char* group, char* key, int def);
/**
Set a boolean setting
@@ -252,7 +260,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param key the item name within the group
@param value value to set
*/
void prof_settings_boolean_set(char *group, char *key, int value);
void prof_settings_boolean_set(char* group, char* key, int value);
/**
Get a string setting
@@ -262,7 +270,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param def default value if setting not found
@return the setting, or default value
*/
char* prof_settings_string_get(char *group, char *key, char *def);
char* prof_settings_string_get(char* group, char* key, char* def);
/**
Set a string setting
@@ -271,7 +279,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param key the item name within the group
@param value value to set
*/
void prof_settings_string_set(char *group, char *key, char *value);
void prof_settings_string_set(char* group, char* key, char* value);
/**
Get a string list setting
@@ -281,7 +289,7 @@ The string list setting items are separated by semicolons.
@param key the item name within the group
@return the list setting
*/
char** prof_settings_string_list_get(char *group, char *key);
char** prof_settings_string_list_get(char* group, char* key);
/**
Add an item to a string list setting
@@ -291,7 +299,7 @@ If the list does not exist, a new one will be created with the element added
@param key the item name within the group
@param value item to add
*/
void prof_settings_string_list_add(char *group, char *key, char *value);
void prof_settings_string_list_add(char* group, char* key, char* value);
/**
Remove an item from a string list setting
@@ -301,7 +309,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param value item to remove
@return 1 if the item was removed, or is not in the list, 0 if the list does not exist
*/
int prof_settings_string_list_remove(char *group, char *key, char *value);
int prof_settings_string_list_remove(char* group, char* key, char* value);
/**
Remove all items from a string list setting
@@ -310,7 +318,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param key the item name within the group
@return 1 if the list was cleared, 0 if the list does not exist
*/
int prof_settings_string_list_clear(char *group, char *key);
int prof_settings_string_list_clear(char* group, char* key);
/**
Get an integer setting
@@ -320,7 +328,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param def default value if setting not found
@return the setting, or default value
*/
int prof_settings_int_get(char *group, char *key, int def);
int prof_settings_int_get(char* group, char* key, int def);
/**
Set an integer setting
@@ -329,7 +337,7 @@ Settings must be specified in ~/.local/share/profanity/plugin_settings
@param key the item name within the group
@param value value to set
*/
void prof_settings_int_set(char *group, char *key, int value);
void prof_settings_int_set(char* group, char* key, int value);
/**
Trigger incoming message handling, this plugin will make profanity act as if the message has been received
@@ -337,20 +345,20 @@ Trigger incoming message handling, this plugin will make profanity act as if the
@param resource resource of the sender of the message
@param message the message text
*/
void prof_incoming_message(char *barejid, char *resource, char *message);
void prof_incoming_message(char* barejid, char* resource, char* message);
/**
Add a service discovery feature the list supported by Profanity.
If a session is already connected, a presence update will be sent to allow any client/server caches to update their feature list for Profanity
@param feature the service discovery feature to be added
*/
void prof_disco_add_feature(char *feature);
void prof_disco_add_feature(char* feature);
/**
End any encrypted session with the specified user.
@param barejid Jabber ID of the recipient
*/
void prof_encryption_reset(char *barejid);
void prof_encryption_reset(char* barejid);
/**
Set the text to display in the titlebar encryption indicator for recipient.
@@ -358,14 +366,14 @@ Set the text to display in the titlebar encryption indicator for recipient.
@param enctext The text to display
@return 1 on success, 0 on failure
*/
int prof_chat_set_titlebar_enctext(char *barejid, char *enctext);
int prof_chat_set_titlebar_enctext(char* barejid, char* enctext);
/**
Let profanity decide what to show in the titlebar encryption indicator for recipient.
@param barejid Jabber ID of the recipient
@return 1 on success, 0 on failure
*/
int prof_chat_unset_titlebar_enctext(char *barejid);
int prof_chat_unset_titlebar_enctext(char* barejid);
/**
Set the incoming message prefix character for specified contact.
@@ -373,14 +381,14 @@ Set the incoming message prefix character for specified contact.
@param ch The character to display
@return 1 on success, 0 on failure
*/
int prof_chat_set_incoming_char(char *barejid, char *ch);
int prof_chat_set_incoming_char(char* barejid, char* ch);
/**
Reset the incoming message prefix character for specified contact.
@param barejid Jabber ID of the recipient
@return 1 on success, 0 on failure
*/
int prof_chat_unset_incoming_char(char *barejid);
int prof_chat_unset_incoming_char(char* barejid);
/**
Set the outgoing message prefix character for specified contact.
@@ -388,14 +396,14 @@ Set the outgoing message prefix character for specified contact.
@param ch The character to display
@return 1 on success, 0 on failure
*/
int prof_chat_set_outgoing_char(char *barejid, char *ch);
int prof_chat_set_outgoing_char(char* barejid, char* ch);
/**
Reset the outgoing message prefix character for specified contact.
@param barejid Jabber ID of the recipient
@return 1 on success, 0 on failure
*/
int prof_chat_unset_outgoing_char(char *barejid);
int prof_chat_unset_outgoing_char(char* barejid);
/**
Set the text to display in the titlebar encryption indicator for room.
@@ -403,14 +411,14 @@ Set the text to display in the titlebar encryption indicator for room.
@param enctext The text to display
@return 1 on success, 0 on failure
*/
int prof_room_set_titlebar_enctext(char *roomjid, char *enctext);
int prof_room_set_titlebar_enctext(char* roomjid, char* enctext);
/**
Let profanity decide what to show in the titlebar encryption indicator for room.
@param roomjid Jabber ID of the room
@return 1 on success, 0 on failure
*/
int prof_room_unset_titlebar_enctext(char *roomjid);
int prof_room_unset_titlebar_enctext(char* roomjid);
/**
Set the message prefix character for specified room.
@@ -418,14 +426,14 @@ Set the message prefix character for specified room.
@param ch The character to display
@return 1 on success, 0 on failure
*/
int prof_room_set_message_char(char *roomjid, char *ch);
int prof_room_set_message_char(char* roomjid, char* ch);
/**
Reset the message prefix character for specified room.
@param roomjid Jabber ID of the room
@return 1 on success, 0 on failure
*/
int prof_room_unset_message_char(char *roomjid);
int prof_room_unset_message_char(char* roomjid);
/**
Show a message in a chat window.
@@ -433,7 +441,7 @@ Show a message in a chat window.
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_chat_show(char *barejid, char *message);
int prof_chat_show(char* barejid, char* message);
/**
Show a message in a chat window, using the specified theme, and prefix character
@@ -446,7 +454,7 @@ Themes are specified in ~/.local/share/profanity/plugin_themes
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_chat_show_themed(char *barejid, char *group, char *item, char *def, char *ch, char *message);
int prof_chat_show_themed(char* barejid, char* group, char* item, char* def, char* ch, char* message);
/**
Show a message in a chat room window.
@@ -454,7 +462,7 @@ Show a message in a chat room window.
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_room_show(char *roomjid, char *message);
int prof_room_show(char* roomjid, char* message);
/**
Show a message in a chat room window, using the specified theme, and prefix character
@@ -467,4 +475,4 @@ Themes are specified in ~/.local/share/profanity/plugin_themes
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_room_show_themed(char *roomjid, char *group, char *item, char *def, char *ch, char *message);
int prof_room_show_themed(char* roomjid, char* group, char* item, char* def, char* ch, char* message);