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)
|
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
|
add_library(tox MODULE
|
||||||
src/twc.c
|
src/twc.c
|
||||||
@ -41,7 +42,8 @@ add_library(tox MODULE
|
|||||||
src/twc-utils.c
|
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 toxcore)
|
||||||
target_link_libraries(tox toxav)
|
target_link_libraries(tox toxav)
|
||||||
|
@ -65,17 +65,13 @@ int twc_bootstrap_count = sizeof(twc_bootstrap_addresses)
|
|||||||
* tox_bootstrap_from_address.
|
* tox_bootstrap_from_address.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
twc_bootstrap_tox(Tox *tox,
|
twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port,
|
||||||
const char *address,
|
|
||||||
uint16_t port,
|
|
||||||
const char *public_key)
|
const char *public_key)
|
||||||
{
|
{
|
||||||
char binary_key[TOX_FRIEND_ADDRESS_SIZE];
|
char binary_key[TOX_FRIEND_ADDRESS_SIZE];
|
||||||
twc_hex2bin(public_key, TOX_FRIEND_ADDRESS_SIZE, binary_key);
|
twc_hex2bin(public_key, TOX_FRIEND_ADDRESS_SIZE, binary_key);
|
||||||
|
|
||||||
int result = tox_bootstrap_from_address(tox,
|
int result = tox_bootstrap_from_address(tox, address, port,
|
||||||
address,
|
|
||||||
port,
|
|
||||||
(uint8_t *)binary_key);
|
(uint8_t *)binary_key);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -23,9 +23,7 @@
|
|||||||
#include <tox/tox.h>
|
#include <tox/tox.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
twc_bootstrap_tox(Tox *tox,
|
twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port,
|
||||||
const char *address,
|
|
||||||
uint16_t port,
|
|
||||||
const char *public_key);
|
const char *public_key);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -47,8 +47,7 @@ twc_chat_buffer_close_callback(void *data,
|
|||||||
* Create a new chat.
|
* Create a new chat.
|
||||||
*/
|
*/
|
||||||
struct t_twc_chat *
|
struct t_twc_chat *
|
||||||
twc_chat_new(struct t_twc_profile *profile,
|
twc_chat_new(struct t_twc_profile *profile, const char *name)
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
struct t_twc_chat *chat = malloc(sizeof(struct t_twc_chat));
|
struct t_twc_chat *chat = malloc(sizeof(struct t_twc_chat));
|
||||||
if (!chat)
|
if (!chat)
|
||||||
@ -82,8 +81,7 @@ twc_chat_new(struct t_twc_profile *profile,
|
|||||||
* Create a new friend chat.
|
* Create a new friend chat.
|
||||||
*/
|
*/
|
||||||
struct t_twc_chat *
|
struct t_twc_chat *
|
||||||
twc_chat_new_friend(struct t_twc_profile *profile,
|
twc_chat_new_friend(struct t_twc_profile *profile, int32_t friend_number)
|
||||||
int32_t friend_number)
|
|
||||||
{
|
{
|
||||||
uint8_t client_id[TOX_CLIENT_ID_SIZE];
|
uint8_t client_id[TOX_CLIENT_ID_SIZE];
|
||||||
tox_get_client_id(profile->tox, friend_number, client_id);
|
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.
|
* Create a new group chat.
|
||||||
*/
|
*/
|
||||||
struct t_twc_chat *
|
struct t_twc_chat *
|
||||||
twc_chat_new_group(struct t_twc_profile *profile,
|
twc_chat_new_group(struct t_twc_profile *profile, int32_t group_number)
|
||||||
int32_t group_number)
|
|
||||||
{
|
{
|
||||||
char buffer_name[32];
|
char buffer_name[32];
|
||||||
sprintf(buffer_name, "group_chat_%d", group_number);
|
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 *
|
struct t_twc_chat *
|
||||||
twc_chat_search_friend(struct t_twc_profile *profile,
|
twc_chat_search_friend(struct t_twc_profile *profile,
|
||||||
int32_t friend_number,
|
int32_t friend_number, bool create_new)
|
||||||
bool create_new)
|
|
||||||
{
|
{
|
||||||
size_t index;
|
size_t index;
|
||||||
struct t_twc_list_item *item;
|
struct t_twc_list_item *item;
|
||||||
@ -213,8 +209,7 @@ twc_chat_search_friend(struct t_twc_profile *profile,
|
|||||||
*/
|
*/
|
||||||
struct t_twc_chat *
|
struct t_twc_chat *
|
||||||
twc_chat_search_group(struct t_twc_profile *profile,
|
twc_chat_search_group(struct t_twc_profile *profile,
|
||||||
int32_t group_number,
|
int32_t group_number, bool create_new)
|
||||||
bool create_new)
|
|
||||||
{
|
{
|
||||||
size_t index;
|
size_t index;
|
||||||
struct t_twc_list_item *item;
|
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.
|
* Send a message to the recipient(s) of a chat.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
twc_chat_send_message(struct t_twc_chat *chat,
|
twc_chat_send_message(struct t_twc_chat *chat, const char *message,
|
||||||
const char *message,
|
|
||||||
enum TWC_MESSAGE_TYPE message_type)
|
enum TWC_MESSAGE_TYPE message_type)
|
||||||
{
|
{
|
||||||
if (chat->friend_number >= 0)
|
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.
|
* Callback for a buffer receiving user input.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
twc_chat_buffer_input_callback(void *data,
|
twc_chat_buffer_input_callback(void *data, struct t_gui_buffer *weechat_buffer,
|
||||||
struct t_gui_buffer *weechat_buffer,
|
|
||||||
const char *input_data)
|
const char *input_data)
|
||||||
{
|
{
|
||||||
struct t_twc_chat *chat = data;
|
struct t_twc_chat *chat = data;
|
||||||
@ -325,8 +318,7 @@ twc_chat_buffer_input_callback(void *data,
|
|||||||
* Callback for a buffer being closed.
|
* Callback for a buffer being closed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
twc_chat_buffer_close_callback(void *data,
|
twc_chat_buffer_close_callback(void *data, struct t_gui_buffer *weechat_buffer)
|
||||||
struct t_gui_buffer *weechat_buffer)
|
|
||||||
{
|
{
|
||||||
struct t_twc_chat *chat = data;
|
struct t_twc_chat *chat = data;
|
||||||
|
|
||||||
|
@ -49,13 +49,11 @@ struct t_twc_chat
|
|||||||
|
|
||||||
struct t_twc_chat *
|
struct t_twc_chat *
|
||||||
twc_chat_search_friend(struct t_twc_profile *profile,
|
twc_chat_search_friend(struct t_twc_profile *profile,
|
||||||
int32_t friend_number,
|
int32_t friend_number, bool create_new);
|
||||||
bool create_new);
|
|
||||||
|
|
||||||
struct t_twc_chat *
|
struct t_twc_chat *
|
||||||
twc_chat_search_group(struct t_twc_profile *profile,
|
twc_chat_search_group(struct t_twc_profile *profile,
|
||||||
int32_t group_number,
|
int32_t group_number, bool create_new);
|
||||||
bool create_new);
|
|
||||||
|
|
||||||
struct t_twc_chat *
|
struct t_twc_chat *
|
||||||
twc_chat_search_buffer(struct t_gui_buffer *target_buffer);
|
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);
|
enum TWC_MESSAGE_TYPE message_type);
|
||||||
|
|
||||||
void
|
void
|
||||||
twc_chat_send_message(struct t_twc_chat *chat,
|
twc_chat_send_message(struct t_twc_chat *chat, const char *message,
|
||||||
const char *message,
|
|
||||||
enum TWC_MESSAGE_TYPE message_type);
|
enum TWC_MESSAGE_TYPE message_type);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -136,24 +136,19 @@ twc_completion_profile(void *data,
|
|||||||
void
|
void
|
||||||
twc_completion_init()
|
twc_completion_init()
|
||||||
{
|
{
|
||||||
weechat_hook_completion("tox_profiles",
|
weechat_hook_completion("tox_profiles", "profile",
|
||||||
"profile",
|
|
||||||
twc_completion_profile,
|
twc_completion_profile,
|
||||||
(void *)(intptr_t)TWC_ALL_PROFILES);
|
(void *)(intptr_t)TWC_ALL_PROFILES);
|
||||||
weechat_hook_completion("tox_loaded_profiles",
|
weechat_hook_completion("tox_loaded_profiles", "loaded profile",
|
||||||
"loaded profile",
|
|
||||||
twc_completion_profile,
|
twc_completion_profile,
|
||||||
(void *)(intptr_t)TWC_LOADED_PROFILES);
|
(void *)(intptr_t)TWC_LOADED_PROFILES);
|
||||||
weechat_hook_completion("tox_unloaded_profiles",
|
weechat_hook_completion("tox_unloaded_profiles", "unloaded profile",
|
||||||
"unloaded profile",
|
|
||||||
twc_completion_profile,
|
twc_completion_profile,
|
||||||
(void *)(intptr_t)TWC_UNLOADED_PROFILES);
|
(void *)(intptr_t)TWC_UNLOADED_PROFILES);
|
||||||
weechat_hook_completion("tox_friend_tox_id",
|
weechat_hook_completion("tox_friend_tox_id", "friend Tox ID",
|
||||||
"friend Tox ID",
|
|
||||||
twc_completion_friend,
|
twc_completion_friend,
|
||||||
(void *)(intptr_t)TWC_COMPLETE_FRIEND_ID);
|
(void *)(intptr_t)TWC_COMPLETE_FRIEND_ID);
|
||||||
weechat_hook_completion("tox_friend_name",
|
weechat_hook_completion("tox_friend_name", "friend name",
|
||||||
"friend name",
|
|
||||||
twc_completion_friend,
|
twc_completion_friend,
|
||||||
(void *)(intptr_t)TWC_COMPLETE_FRIEND_NAME);
|
(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,
|
const uint8_t *message, uint16_t length,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
twc_handle_friend_message(tox,
|
twc_handle_friend_message(tox, friend_number,
|
||||||
friend_number,
|
message, length,
|
||||||
message,
|
data, TWC_MESSAGE_TYPE_MESSAGE);
|
||||||
length,
|
|
||||||
data,
|
|
||||||
TWC_MESSAGE_TYPE_MESSAGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -90,12 +87,9 @@ twc_friend_action_callback(Tox *tox, int32_t friend_number,
|
|||||||
const uint8_t *message, uint16_t length,
|
const uint8_t *message, uint16_t length,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
twc_handle_friend_message(tox,
|
twc_handle_friend_message(tox, friend_number,
|
||||||
friend_number,
|
message, length,
|
||||||
message,
|
data, TWC_MESSAGE_TYPE_ACTION);
|
||||||
length,
|
|
||||||
data,
|
|
||||||
TWC_MESSAGE_TYPE_ACTION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user