tox-weechat/src/tox-weechat-commands.c

670 lines
22 KiB
C
Raw Normal View History

2014-09-02 18:47:08 +02:00
#include <string.h>
#include <weechat/weechat-plugin.h>
#include <tox/tox.h>
#include "tox-weechat.h"
#include "tox-weechat-utils.h"
#include "tox-weechat-identities.h"
2014-09-02 18:47:08 +02:00
#include "tox-weechat-chats.h"
#include "tox-weechat-friend-requests.h"
#include "tox-weechat-commands.h"
// TODO: something
extern int
tox_weechat_bootstrap_tox(Tox *tox, char *address, uint16_t port, char *public_key);
2014-09-02 23:49:41 +02:00
int
tox_weechat_cmd_bootstrap(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
2014-09-13 12:22:26 +02:00
if (!identity)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed on a Tox buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
2014-09-02 23:49:41 +02:00
if (argc != 4)
return WEECHAT_RC_ERROR;
char *address = argv[1];
uint16_t port = atoi(argv[2]);
char *tox_address = argv[3];
2014-09-07 03:04:42 +02:00
if (!tox_weechat_bootstrap_tox(identity->tox, address, port, tox_address))
2014-09-02 23:49:41 +02:00
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 23:49:41 +02:00
"%sInvalid arguments for bootstrap.",
weechat_prefix("error"));
}
return WEECHAT_RC_OK;
}
2014-09-02 18:47:08 +02:00
int
tox_weechat_cmd_friend(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
2014-09-13 12:22:26 +02:00
if (!identity)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed on a Tox buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
2014-09-02 18:47:08 +02:00
if (argc == 1 || (argc == 2 && weechat_strcasecmp(argv[1], "list") == 0))
{
2014-09-07 03:04:42 +02:00
size_t friend_count = tox_count_friendlist(identity->tox);
2014-09-02 18:59:11 +02:00
int32_t friend_numbers[friend_count];
2014-09-07 03:04:42 +02:00
tox_get_friendlist(identity->tox, friend_numbers, friend_count);
2014-09-02 18:59:11 +02:00
if (friend_count == 0)
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:59:11 +02:00
"%sYou have no friends :(",
weechat_prefix("network"));
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%s[#] Name [client ID]",
2014-09-02 18:59:11 +02:00
weechat_prefix("network"));
for (size_t i = 0; i < friend_count; ++i)
{
int32_t friend_number = friend_numbers[i];
2014-09-07 03:04:42 +02:00
char *name = tox_weechat_get_name_nt(identity->tox, friend_number);
2014-09-02 18:59:11 +02:00
uint8_t client_id[TOX_CLIENT_ID_SIZE];
2014-09-07 03:04:42 +02:00
tox_get_client_id(identity->tox, friend_number, client_id);
char *hex_address = malloc(TOX_CLIENT_ID_SIZE * 2 + 1);
tox_weechat_bin2hex(client_id,
TOX_CLIENT_ID_SIZE,
hex_address);
2014-09-02 18:59:11 +02:00
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:59:11 +02:00
"%s[%d] %s [%s]",
weechat_prefix("network"),
2014-09-07 03:04:42 +02:00
friend_number, name, hex_address);
2014-09-02 18:59:11 +02:00
free(name);
2014-09-07 03:04:42 +02:00
free(hex_address);
2014-09-02 18:59:11 +02:00
}
2014-09-02 18:47:08 +02:00
return WEECHAT_RC_OK;
}
2014-09-13 12:22:26 +02:00
else if (argc >= 3 && (weechat_strcasecmp(argv[1], "add") == 0))
2014-09-02 18:47:08 +02:00
{
2014-09-07 03:04:42 +02:00
char *address = malloc(TOX_FRIEND_ADDRESS_SIZE);
tox_weechat_hex2bin(argv[2], address);
2014-09-02 20:15:08 +02:00
char *message;
if (argc == 3 || strlen(argv_eol[3]) == 0)
message = "Hi! Please add me on Tox!";
else
message = argv_eol[3];
2014-09-07 03:04:42 +02:00
int32_t result = tox_add_friend(identity->tox,
(uint8_t *)address,
2014-09-02 20:15:08 +02:00
(uint8_t *)message,
strlen(message));
switch (result)
{
case TOX_FAERR_TOOLONG:
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%sFriend request message too long! Try again.",
weechat_prefix("error"));
break;
case TOX_FAERR_ALREADYSENT:
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%sYou have already sent a friend request to that address.",
weechat_prefix("error"));
break;
case TOX_FAERR_OWNKEY:
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%sYou can't add yourself as a friend.",
weechat_prefix("error"));
break;
case TOX_FAERR_BADCHECKSUM:
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%sInvalid friend address - try again.",
weechat_prefix("error"));
break;
case TOX_FAERR_NOMEM:
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%sCould not add friend (out of memory).",
weechat_prefix("error"));
break;
case TOX_FAERR_UNKNOWN:
case TOX_FAERR_SETNEWNOSPAM:
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%sCould not add friend (unknown error).",
weechat_prefix("error"));
break;
default:
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
"%sFriend request sent!",
2014-09-02 20:15:08 +02:00
weechat_prefix("network"));
break;
}
2014-09-02 18:47:08 +02:00
return WEECHAT_RC_OK;
}
2014-09-13 12:22:26 +02:00
else if (argc == 3 && (weechat_strcasecmp(argv[1], "remove") == 0))
2014-09-04 00:24:37 +02:00
{
char *endptr;
unsigned long friend_number = strtoul(argv[2], &endptr, 10);
2014-09-07 03:04:42 +02:00
if (endptr == argv[2] || !tox_friend_exists(identity->tox, friend_number))
2014-09-04 00:24:37 +02:00
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-04 00:24:37 +02:00
"%sInvalid friend number.",
weechat_prefix("error"));
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
char *name = tox_weechat_get_name_nt(identity->tox, friend_number);
if (tox_del_friend(identity->tox, friend_number) == 0)
2014-09-04 00:24:37 +02:00
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-04 00:24:37 +02:00
"%sRemoved %s from friend list.",
weechat_prefix("network"), name);
}
else
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-04 00:24:37 +02:00
"%sCould not remove friend!",
weechat_prefix("error"));
}
2014-09-07 03:04:42 +02:00
free(name);
2014-09-04 00:24:37 +02:00
return WEECHAT_RC_OK;
}
2014-09-13 12:22:26 +02:00
else if (argc == 3 &&
2014-09-02 18:47:08 +02:00
(weechat_strcasecmp(argv[1], "accept") == 0
2014-09-02 20:15:08 +02:00
|| weechat_strcasecmp(argv[1], "decline") == 0))
2014-09-02 18:47:08 +02:00
{
int accept = weechat_strcasecmp(argv[1], "accept") == 0;
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_friend_request *request;
2014-09-02 18:47:08 +02:00
if (weechat_strcasecmp(argv[2], "all") == 0)
{
int count = 0;
while ((request = tox_weechat_friend_request_with_num(identity, 0)) != NULL)
2014-09-02 18:47:08 +02:00
{
if (accept)
tox_weechat_accept_friend_request(request);
else
tox_weechat_decline_friend_request(request);
++count;
}
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%s%s %d friend requests.",
weechat_prefix("network"),
accept ? "Accepted" : "Declined",
count);
return WEECHAT_RC_OK;
}
else
{
char *endptr;
unsigned long num = strtoul(argv[2], &endptr, 10);
if (endptr == argv[2] || (request = tox_weechat_friend_request_with_num(identity, num)) == NULL)
2014-09-02 18:47:08 +02:00
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%sInvalid friend request ID.",
weechat_prefix("error"));
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
char *hex_address = malloc(TOX_CLIENT_ID_SIZE * 2 + 1);
tox_weechat_bin2hex(request->address,
TOX_CLIENT_ID_SIZE,
hex_address);
2014-09-02 18:47:08 +02:00
if (accept)
tox_weechat_accept_friend_request(request);
else
tox_weechat_decline_friend_request(request);
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%s%s friend request from %s.",
weechat_prefix("network"),
accept ? "Accepted" : "Declined",
2014-09-07 03:04:42 +02:00
hex_address);
free(hex_address);
2014-09-02 18:47:08 +02:00
return WEECHAT_RC_OK;
}
}
2014-09-13 12:22:26 +02:00
else if (argc == 2 && weechat_strcasecmp(argv[1], "requests") == 0)
2014-09-02 18:47:08 +02:00
{
2014-09-07 03:04:42 +02:00
if (identity->friend_requests == NULL)
2014-09-02 18:47:08 +02:00
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%sNo pending friend requests :(",
weechat_prefix("network"));
}
else
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%sPending friend requests:",
weechat_prefix("network"));
int num = 0;
2014-09-07 03:04:42 +02:00
for (struct t_tox_weechat_friend_request *request = identity->friend_requests;
request;
request = request->next_request)
2014-09-02 18:47:08 +02:00
{
2014-09-07 03:04:42 +02:00
char *hex_address = malloc(TOX_CLIENT_ID_SIZE * 2 + 1);
tox_weechat_bin2hex(request->address,
TOX_CLIENT_ID_SIZE,
hex_address);
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%s[%d] Address: %s\n"
"[%d] Message: %s",
weechat_prefix("network"),
num, hex_address,
num, request->message);
free(hex_address);
++num;
}
}
return WEECHAT_RC_OK;
}
return WEECHAT_RC_ERROR;
}
2014-09-02 20:15:08 +02:00
int
tox_weechat_cmd_me(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
if (argc == 1)
return WEECHAT_RC_ERROR;
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
struct t_tox_weechat_chat *chat = tox_weechat_get_chat_for_buffer(buffer);
2014-09-02 20:15:08 +02:00
2014-09-13 12:22:26 +02:00
if (!chat)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed in a chat buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
tox_send_action(identity->tox,
2014-09-02 20:15:08 +02:00
chat->friend_number,
(uint8_t *)argv_eol[1],
strlen(argv_eol[1]));
2014-09-07 03:04:42 +02:00
char *name = tox_weechat_get_self_name_nt(identity->tox);
2014-09-02 20:15:08 +02:00
tox_weechat_chat_print_action(chat, name, argv_eol[1]);
free(name);
return WEECHAT_RC_OK;
}
int
tox_weechat_cmd_msg(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
if (argc == 1)
return WEECHAT_RC_ERROR;
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
2014-09-13 12:22:26 +02:00
if (!identity)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed in a Tox buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
2014-09-02 20:15:08 +02:00
char *endptr;
unsigned long friend_number = strtoul(argv[1], &endptr, 10);
2014-09-07 03:04:42 +02:00
if (endptr == argv[1] || !tox_friend_exists(identity->tox, friend_number))
2014-09-02 20:15:08 +02:00
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:15:08 +02:00
"%sInvalid friend number.",
weechat_prefix("error"));
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_chat *chat = tox_weechat_get_friend_chat(identity, friend_number);
2014-09-02 20:15:08 +02:00
if (argc >= 3)
{
2014-09-07 03:04:42 +02:00
tox_send_message(identity->tox,
2014-09-02 20:15:08 +02:00
friend_number,
2014-09-13 12:22:26 +02:00
(uint8_t *)argv_eol[2],
strlen(argv_eol[2]));
2014-09-07 03:04:42 +02:00
char *name = tox_weechat_get_self_name_nt(identity->tox);
2014-09-13 12:22:26 +02:00
tox_weechat_chat_print_message(chat, name, argv_eol[2]);
2014-09-02 20:15:08 +02:00
free(name);
}
return WEECHAT_RC_OK;
}
2014-09-02 18:47:08 +02:00
int
tox_weechat_cmd_myaddress(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
2014-09-13 12:22:26 +02:00
if (!identity)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed in a Tox buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
2014-09-02 18:47:08 +02:00
uint8_t address[TOX_FRIEND_ADDRESS_SIZE];
2014-09-07 03:04:42 +02:00
tox_get_address(identity->tox, address);
2014-09-02 18:47:08 +02:00
2014-09-07 03:04:42 +02:00
char *address_str = malloc(TOX_FRIEND_ADDRESS_SIZE * 2 + 1);
tox_weechat_bin2hex(address, TOX_FRIEND_ADDRESS_SIZE, address_str);
2014-09-02 18:47:08 +02:00
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%sYour Tox address: %s",
weechat_prefix("network"),
address_str);
free(address_str);
return WEECHAT_RC_OK;
}
int
tox_weechat_cmd_name(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
2014-09-02 20:15:08 +02:00
if (argc == 1)
return WEECHAT_RC_ERROR;
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
2014-09-13 12:22:26 +02:00
if (!identity)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed on a Tox buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
2014-09-02 20:15:08 +02:00
char *name = argv_eol[1];
2014-09-02 18:47:08 +02:00
2014-09-07 03:04:42 +02:00
int result = tox_set_name(identity->tox, (uint8_t *)name, strlen(name));
2014-09-02 18:47:08 +02:00
if (result == -1)
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 18:47:08 +02:00
"%s%s",
weechat_prefix("error"),
"Could not change name.");
2014-09-02 20:15:08 +02:00
return WEECHAT_RC_OK;
2014-09-02 18:47:08 +02:00
}
weechat_bar_item_update("input_prompt");
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-02 20:24:47 +02:00
"%sYou are now known as %s",
weechat_prefix("network"),
name);
2014-09-07 03:04:42 +02:00
for (struct t_tox_weechat_chat *chat = identity->chats;
2014-09-02 20:15:08 +02:00
chat;
2014-09-07 03:04:42 +02:00
chat = chat->next_chat)
2014-09-02 20:15:08 +02:00
{
2014-09-02 20:24:47 +02:00
weechat_printf(chat->buffer,
"%sYou are now known as %s",
weechat_prefix("network"),
name);
2014-09-02 20:15:08 +02:00
}
2014-09-02 18:47:08 +02:00
return WEECHAT_RC_OK;
}
2014-09-03 15:19:09 +02:00
int
tox_weechat_cmd_status(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
if (argc != 2)
return WEECHAT_RC_ERROR;
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
2014-09-13 12:22:26 +02:00
if (!identity)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed in a Tox buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
2014-09-03 15:19:09 +02:00
TOX_USERSTATUS status = TOX_USERSTATUS_INVALID;
if (weechat_strcasecmp(argv[1], "online") == 0)
status = TOX_USERSTATUS_NONE;
else if (weechat_strcasecmp(argv[1], "busy") == 0)
status = TOX_USERSTATUS_BUSY;
else if (weechat_strcasecmp(argv[1], "away") == 0)
status = TOX_USERSTATUS_AWAY;
if (status == TOX_USERSTATUS_INVALID)
return WEECHAT_RC_ERROR;
2014-09-07 03:04:42 +02:00
tox_set_user_status(identity->tox, status);
weechat_bar_item_update("away");
2014-09-03 15:19:09 +02:00
return WEECHAT_RC_OK;
}
2014-09-03 00:19:46 +02:00
int
tox_weechat_cmd_statusmsg(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
2014-09-07 03:04:42 +02:00
struct t_tox_weechat_identity *identity = tox_weechat_identity_for_buffer(buffer);
2014-09-13 12:22:26 +02:00
if (!identity)
{
weechat_printf(NULL,
"%s%s: command \"%s\" must be executed in a Tox buffer",
weechat_prefix("error"),
weechat_plugin->name,
argv[0]);
return WEECHAT_RC_OK;
}
2014-09-07 03:04:42 +02:00
2014-09-03 00:19:46 +02:00
char *message = argc > 1 ? argv_eol[1] : " ";
2014-09-07 03:04:42 +02:00
int result = tox_set_status_message(identity->tox,
(uint8_t *)message,
strlen(message));
2014-09-03 00:19:46 +02:00
if (result == -1)
{
2014-09-07 03:04:42 +02:00
weechat_printf(identity->buffer,
2014-09-03 00:19:46 +02:00
"%s%s",
weechat_prefix("error"),
"Could not set status message.");
}
return WEECHAT_RC_OK;
}
2014-09-13 12:22:26 +02:00
int
tox_weechat_cmd_tox(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
if (argc == 1 || (argc == 2 && weechat_strcasecmp(argv[1], "list") == 0))
{
weechat_printf(NULL,
"%sAll Tox identities:",
weechat_prefix("network"));
for (struct t_tox_weechat_identity *identity = tox_weechat_identities;
identity;
identity = identity->next_identity)
{
weechat_printf(NULL,
"%s%s",
weechat_prefix("network"),
identity->name);
}
return WEECHAT_RC_OK;
}
else if (argc == 3 && (weechat_strcasecmp(argv[1], "add") == 0))
{
char *name = argv[2];
if (tox_weechat_identity_name_search(name))
{
weechat_printf(NULL,
"%s%s: Identity \"%s\" already exists!",
weechat_prefix("error"),
weechat_plugin->name,
name);
}
struct t_tox_weechat_identity *identity = tox_weechat_identity_new(name);
weechat_printf(NULL,
"%s%s: Identity \"%s\" created!",
weechat_prefix("network"),
weechat_plugin->name,
identity->name);
return WEECHAT_RC_OK;
}
else if (argc == 3 && (weechat_strcasecmp(argv[1], "connect") == 0))
{
char *name = argv[2];
struct t_tox_weechat_identity *identity = tox_weechat_identity_name_search(name);
if (!identity)
{
weechat_printf(NULL,
"%s%s: Identity \"%s\" does not exist.",
weechat_prefix("error"),
weechat_plugin->name,
name);
}
else
{
tox_weechat_identity_connect(identity);
}
return WEECHAT_RC_OK;
}
return WEECHAT_RC_ERROR;
}
2014-09-02 18:47:08 +02:00
void
tox_weechat_commands_init()
{
2014-09-02 23:49:41 +02:00
weechat_hook_command("bootstrap",
"bootstrap the Tox DHT",
"<address> <port> <client id>",
" address: internet address of node to bootstrap with\n"
" port: port of the node\n"
"client id: Tox client of the node",
NULL, tox_weechat_cmd_bootstrap, NULL);
2014-09-02 18:47:08 +02:00
weechat_hook_command("friend",
"manage friends",
"list"
" || add <address> [<message>]"
2014-09-04 00:24:37 +02:00
" || remove <number>"
2014-09-02 18:47:08 +02:00
" || requests"
" || accept <number>|all"
" || decline <number>|all",
" list: list all friends\n"
" add: add a friend by their public Tox address\n"
"requests: list friend requests\n"
" accept: accept friend requests\n"
" decline: decline friend requests\n",
NULL, tox_weechat_cmd_friend, NULL);
weechat_hook_command("me",
"send an action to the current chat",
"<message>",
"message: message to send",
NULL, tox_weechat_cmd_me, NULL);
2014-09-02 20:15:08 +02:00
weechat_hook_command("msg",
"send a message to a Tox friend",
"<id> [<message>]",
" id: friend number of the person to message\n"
"message: message to send",
NULL, tox_weechat_cmd_msg, NULL);
2014-09-02 18:47:08 +02:00
weechat_hook_command("myaddress",
"get your Tox address to give to friends",
"", "",
NULL, tox_weechat_cmd_myaddress, NULL);
weechat_hook_command("name",
"change your Tox name",
"<name>",
"name: your new name",
NULL, tox_weechat_cmd_name, NULL);
2014-09-03 00:19:46 +02:00
2014-09-03 15:19:09 +02:00
weechat_hook_command("status",
"change your Tox status",
"online|busy|away",
"",
NULL, tox_weechat_cmd_status, NULL);
2014-09-03 00:19:46 +02:00
weechat_hook_command("statusmsg",
"change your Tox status message",
"[<message>]",
"message: your new status message",
NULL, tox_weechat_cmd_statusmsg, NULL);
2014-09-13 12:22:26 +02:00
weechat_hook_command("tox",
"manage Tox identities",
"list"
" || add <name>"
" || del <name>"
" || connect <name>",
" list: list all Tox identity\n"
" add: create a new Tox identity\n"
" del: delete a Tox identity\n"
"connect: connect a Tox identity to the network\n",
NULL, tox_weechat_cmd_tox, NULL);
2014-09-02 18:47:08 +02:00
}