Formatting.
This commit is contained in:
parent
9d62668113
commit
82523f448b
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -23,9 +23,7 @@
|
||||
#include <tox/tox.h>
|
||||
|
||||
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
|
||||
|
@ -47,8 +47,7 @@ twc_chat_buffer_close_callback(void *data,
|
||||
* 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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user