From 82523f448ba71d64b32a2f046aa37ca82794504b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Wed, 19 Nov 2014 07:12:41 +0100 Subject: [PATCH] Formatting. --- CMakeLists.txt | 6 ++++-- src/twc-bootstrap.c | 8 ++------ src/twc-bootstrap.h | 4 +--- src/twc-chat.c | 30 +++++++++++------------------- src/twc-chat.h | 9 +++------ src/twc-completion.c | 15 +++++---------- src/twc-tox-callbacks.c | 18 ++++++------------ 7 files changed, 32 insertions(+), 58 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39cdf52..f48ad55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,8 @@ cmake_minimum_required(VERSION 2.8.7) project(tox-weechat C) -set(PLUGIN_PATH "lib/weechat/plugins" CACHE PATH "Path to install the plugin binary to.") +set(PLUGIN_PATH "lib/weechat/plugins" CACHE PATH + "Path to install the plugin binary to.") add_library(tox MODULE src/twc.c @@ -41,7 +42,8 @@ add_library(tox MODULE src/twc-utils.c ) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Wno-unused-parameter") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ + -std=gnu99 -Wall -Wextra -Wno-unused-parameter") target_link_libraries(tox toxcore) target_link_libraries(tox toxav) diff --git a/src/twc-bootstrap.c b/src/twc-bootstrap.c index ec2a96a..cdf9597 100644 --- a/src/twc-bootstrap.c +++ b/src/twc-bootstrap.c @@ -65,17 +65,13 @@ int twc_bootstrap_count = sizeof(twc_bootstrap_addresses) * tox_bootstrap_from_address. */ int -twc_bootstrap_tox(Tox *tox, - const char *address, - uint16_t port, +twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port, const char *public_key) { char binary_key[TOX_FRIEND_ADDRESS_SIZE]; twc_hex2bin(public_key, TOX_FRIEND_ADDRESS_SIZE, binary_key); - int result = tox_bootstrap_from_address(tox, - address, - port, + int result = tox_bootstrap_from_address(tox, address, port, (uint8_t *)binary_key); return result; diff --git a/src/twc-bootstrap.h b/src/twc-bootstrap.h index 1790579..ea6ab0d 100644 --- a/src/twc-bootstrap.h +++ b/src/twc-bootstrap.h @@ -23,9 +23,7 @@ #include int -twc_bootstrap_tox(Tox *tox, - const char *address, - uint16_t port, +twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port, const char *public_key); void diff --git a/src/twc-chat.c b/src/twc-chat.c index 99e7b05..ddf5146 100644 --- a/src/twc-chat.c +++ b/src/twc-chat.c @@ -37,18 +37,17 @@ const char *twc_tag_received_message = "tox_received"; int twc_chat_buffer_input_callback(void *data, - struct t_gui_buffer *weechat_buffer, - const char *input_data); + struct t_gui_buffer *weechat_buffer, + const char *input_data); int twc_chat_buffer_close_callback(void *data, - struct t_gui_buffer *weechat_buffer); + struct t_gui_buffer *weechat_buffer); /** * Create a new chat. */ struct t_twc_chat * -twc_chat_new(struct t_twc_profile *profile, - const char *name) +twc_chat_new(struct t_twc_profile *profile, const char *name) { struct t_twc_chat *chat = malloc(sizeof(struct t_twc_chat)); if (!chat) @@ -82,8 +81,7 @@ twc_chat_new(struct t_twc_profile *profile, * Create a new friend chat. */ struct t_twc_chat * -twc_chat_new_friend(struct t_twc_profile *profile, - int32_t friend_number) +twc_chat_new_friend(struct t_twc_profile *profile, int32_t friend_number) { uint8_t client_id[TOX_CLIENT_ID_SIZE]; tox_get_client_id(profile->tox, friend_number, client_id); @@ -102,8 +100,7 @@ twc_chat_new_friend(struct t_twc_profile *profile, * Create a new group chat. */ struct t_twc_chat * -twc_chat_new_group(struct t_twc_profile *profile, - int32_t group_number) +twc_chat_new_group(struct t_twc_profile *profile, int32_t group_number) { char buffer_name[32]; sprintf(buffer_name, "group_chat_%d", group_number); @@ -190,8 +187,7 @@ twc_chat_queue_refresh(struct t_twc_chat *chat) */ struct t_twc_chat * twc_chat_search_friend(struct t_twc_profile *profile, - int32_t friend_number, - bool create_new) + int32_t friend_number, bool create_new) { size_t index; struct t_twc_list_item *item; @@ -213,8 +209,7 @@ twc_chat_search_friend(struct t_twc_profile *profile, */ struct t_twc_chat * twc_chat_search_group(struct t_twc_profile *profile, - int32_t group_number, - bool create_new) + int32_t group_number, bool create_new) { size_t index; struct t_twc_list_item *item; @@ -283,8 +278,7 @@ twc_chat_print_message(struct t_twc_chat *chat, * Send a message to the recipient(s) of a chat. */ void -twc_chat_send_message(struct t_twc_chat *chat, - const char *message, +twc_chat_send_message(struct t_twc_chat *chat, const char *message, enum TWC_MESSAGE_TYPE message_type) { if (chat->friend_number >= 0) @@ -311,8 +305,7 @@ twc_chat_send_message(struct t_twc_chat *chat, * Callback for a buffer receiving user input. */ int -twc_chat_buffer_input_callback(void *data, - struct t_gui_buffer *weechat_buffer, +twc_chat_buffer_input_callback(void *data, struct t_gui_buffer *weechat_buffer, const char *input_data) { struct t_twc_chat *chat = data; @@ -325,8 +318,7 @@ twc_chat_buffer_input_callback(void *data, * Callback for a buffer being closed. */ int -twc_chat_buffer_close_callback(void *data, - struct t_gui_buffer *weechat_buffer) +twc_chat_buffer_close_callback(void *data, struct t_gui_buffer *weechat_buffer) { struct t_twc_chat *chat = data; diff --git a/src/twc-chat.h b/src/twc-chat.h index a37efdb..89cab89 100644 --- a/src/twc-chat.h +++ b/src/twc-chat.h @@ -49,13 +49,11 @@ struct t_twc_chat struct t_twc_chat * twc_chat_search_friend(struct t_twc_profile *profile, - int32_t friend_number, - bool create_new); + int32_t friend_number, bool create_new); struct t_twc_chat * twc_chat_search_group(struct t_twc_profile *profile, - int32_t group_number, - bool create_new); + int32_t group_number, bool create_new); struct t_twc_chat * twc_chat_search_buffer(struct t_gui_buffer *target_buffer); @@ -68,8 +66,7 @@ twc_chat_print_message(struct t_twc_chat *chat, enum TWC_MESSAGE_TYPE message_type); void -twc_chat_send_message(struct t_twc_chat *chat, - const char *message, +twc_chat_send_message(struct t_twc_chat *chat, const char *message, enum TWC_MESSAGE_TYPE message_type); void diff --git a/src/twc-completion.c b/src/twc-completion.c index 9ee6cd5..73ababb 100644 --- a/src/twc-completion.c +++ b/src/twc-completion.c @@ -136,24 +136,19 @@ twc_completion_profile(void *data, void twc_completion_init() { - weechat_hook_completion("tox_profiles", - "profile", + weechat_hook_completion("tox_profiles", "profile", twc_completion_profile, (void *)(intptr_t)TWC_ALL_PROFILES); - weechat_hook_completion("tox_loaded_profiles", - "loaded profile", + weechat_hook_completion("tox_loaded_profiles", "loaded profile", twc_completion_profile, (void *)(intptr_t)TWC_LOADED_PROFILES); - weechat_hook_completion("tox_unloaded_profiles", - "unloaded profile", + weechat_hook_completion("tox_unloaded_profiles", "unloaded profile", twc_completion_profile, (void *)(intptr_t)TWC_UNLOADED_PROFILES); - weechat_hook_completion("tox_friend_tox_id", - "friend Tox ID", + weechat_hook_completion("tox_friend_tox_id", "friend Tox ID", twc_completion_friend, (void *)(intptr_t)TWC_COMPLETE_FRIEND_ID); - weechat_hook_completion("tox_friend_name", - "friend name", + weechat_hook_completion("tox_friend_name", "friend name", twc_completion_friend, (void *)(intptr_t)TWC_COMPLETE_FRIEND_NAME); } diff --git a/src/twc-tox-callbacks.c b/src/twc-tox-callbacks.c index 52fa7a4..170cd33 100644 --- a/src/twc-tox-callbacks.c +++ b/src/twc-tox-callbacks.c @@ -77,12 +77,9 @@ twc_friend_message_callback(Tox *tox, int32_t friend_number, const uint8_t *message, uint16_t length, void *data) { - twc_handle_friend_message(tox, - friend_number, - message, - length, - data, - TWC_MESSAGE_TYPE_MESSAGE); + twc_handle_friend_message(tox, friend_number, + message, length, + data, TWC_MESSAGE_TYPE_MESSAGE); } void @@ -90,12 +87,9 @@ twc_friend_action_callback(Tox *tox, int32_t friend_number, const uint8_t *message, uint16_t length, void *data) { - twc_handle_friend_message(tox, - friend_number, - message, - length, - data, - TWC_MESSAGE_TYPE_ACTION); + twc_handle_friend_message(tox, friend_number, + message, length, + data, TWC_MESSAGE_TYPE_ACTION); } void