mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge pull request #382 from nurupo/master
Separated userstatus_kind from userstatus
This commit is contained in:
commit
225f74e844
|
@ -65,7 +65,7 @@ void parent_confirm_message(int num, uint8_t *data, uint16_t length)
|
||||||
request_flags |= SECOND_FLAG;
|
request_flags |= SECOND_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parent_confirm_status(int num, USERSTATUS_KIND status, uint8_t *data, uint16_t length)
|
void parent_confirm_status(int num, uint8_t *data, uint16_t length)
|
||||||
{
|
{
|
||||||
puts("OK");
|
puts("OK");
|
||||||
request_flags |= FIRST_FLAG;
|
request_flags |= FIRST_FLAG;
|
||||||
|
@ -110,7 +110,7 @@ void child_got_request(uint8_t *public_key, uint8_t *data, uint16_t length)
|
||||||
request_flags |= FIRST_FLAG;
|
request_flags |= FIRST_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void child_got_statuschange(int friend_num, USERSTATUS_KIND status, uint8_t *string, uint16_t length)
|
void child_got_statuschange(int friend_num, uint8_t *string, uint16_t length)
|
||||||
{
|
{
|
||||||
request_flags |= SECOND_FLAG;
|
request_flags |= SECOND_FLAG;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ int main(int argc, char *argv[])
|
||||||
msync(child_id, crypto_box_PUBLICKEYBYTES, MS_SYNC);
|
msync(child_id, crypto_box_PUBLICKEYBYTES, MS_SYNC);
|
||||||
|
|
||||||
m_callback_friendrequest(child_got_request);
|
m_callback_friendrequest(child_got_request);
|
||||||
m_callback_userstatus(child_got_statuschange);
|
m_callback_statusmessage(child_got_statuschange);
|
||||||
|
|
||||||
/* wait on the friend request */
|
/* wait on the friend request */
|
||||||
while(!(request_flags & FIRST_FLAG))
|
while(!(request_flags & FIRST_FLAG))
|
||||||
|
@ -196,7 +196,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
msync(parent_id, crypto_box_PUBLICKEYBYTES, MS_SYNC);
|
msync(parent_id, crypto_box_PUBLICKEYBYTES, MS_SYNC);
|
||||||
m_callback_userstatus(parent_confirm_status);
|
m_callback_statusmessage(parent_confirm_status);
|
||||||
m_callback_friendmessage(parent_confirm_message);
|
m_callback_friendmessage(parent_confirm_message);
|
||||||
|
|
||||||
/* hacky way to give the child time to set up */
|
/* hacky way to give the child time to set up */
|
||||||
|
|
|
@ -62,16 +62,16 @@ END_TEST
|
||||||
START_TEST(test_m_get_userstatus_size)
|
START_TEST(test_m_get_userstatus_size)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
ck_assert_msg((m_get_userstatus_size(-1) == -1),
|
ck_assert_msg((m_get_statusmessage_size(-1) == -1),
|
||||||
"m_get_userstatus_size did NOT catch an argument of -1");
|
"m_get_statusmessage_size did NOT catch an argument of -1");
|
||||||
ck_assert_msg((m_get_userstatus_size(REALLY_BIG_NUMBER) == -1),
|
ck_assert_msg((m_get_statusmessage_size(REALLY_BIG_NUMBER) == -1),
|
||||||
"m_get_userstatus_size did NOT catch the following argument: %d\n",
|
"m_get_statusmessage_size did NOT catch the following argument: %d\n",
|
||||||
REALLY_BIG_NUMBER);
|
REALLY_BIG_NUMBER);
|
||||||
rc = m_get_userstatus_size(friend_id_num);
|
rc = m_get_statusmessage_size(friend_id_num);
|
||||||
|
|
||||||
/* this WILL error if the original m_addfriend_norequest() failed */
|
/* this WILL error if the original m_addfriend_norequest() failed */
|
||||||
ck_assert_msg((rc > 0 && rc <= MAX_USERSTATUS_LENGTH),
|
ck_assert_msg((rc > 0 && rc <= MAX_STATUSMESSAGE_LENGTH),
|
||||||
"m_get_userstatus_size is returning out of range values!\n"
|
"m_get_statusmessage_size is returning out of range values!\n"
|
||||||
"(this can be caused by the error of m_addfriend_norequest"
|
"(this can be caused by the error of m_addfriend_norequest"
|
||||||
" in the beginning of the suite)\n");
|
" in the beginning of the suite)\n");
|
||||||
}
|
}
|
||||||
|
@ -83,15 +83,13 @@ START_TEST(test_m_set_userstatus)
|
||||||
uint16_t good_length = strlen(status);
|
uint16_t good_length = strlen(status);
|
||||||
uint16_t bad_length = REALLY_BIG_NUMBER;
|
uint16_t bad_length = REALLY_BIG_NUMBER;
|
||||||
|
|
||||||
if(m_set_userstatus(USERSTATUS_KIND_ONLINE,
|
if(m_set_statusmessage((uint8_t *)status, bad_length) != -1)
|
||||||
(uint8_t *)status, bad_length) != -1)
|
|
||||||
ck_abort_msg("m_set_userstatus did NOT catch the following length: %d\n",
|
ck_abort_msg("m_set_userstatus did NOT catch the following length: %d\n",
|
||||||
REALLY_BIG_NUMBER);
|
REALLY_BIG_NUMBER);
|
||||||
|
|
||||||
if((m_set_userstatus(USERSTATUS_KIND_RETAIN,
|
if((m_set_statusmessage((uint8_t *)status, good_length)) != 0)
|
||||||
(uint8_t *)status, good_length)) != 0)
|
|
||||||
ck_abort_msg("m_set_userstatus did NOT return 0 on the following length: %d\n"
|
ck_abort_msg("m_set_userstatus did NOT return 0 on the following length: %d\n"
|
||||||
"MAX_USERSTATUS_LENGTH: %d\n", good_length, MAX_USERSTATUS_LENGTH);
|
"MAX_STATUSMESSAGE_LENGTH: %d\n", good_length, MAX_STATUSMESSAGE_LENGTH);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
186
core/Messenger.c
186
core/Messenger.c
|
@ -32,10 +32,11 @@ typedef struct {
|
||||||
uint8_t info[MAX_DATA_SIZE]; /* the data that is sent during the friend requests we do */
|
uint8_t info[MAX_DATA_SIZE]; /* the data that is sent during the friend requests we do */
|
||||||
uint8_t name[MAX_NAME_LENGTH];
|
uint8_t name[MAX_NAME_LENGTH];
|
||||||
uint8_t name_sent; /* 0 if we didn't send our name to this friend 1 if we have. */
|
uint8_t name_sent; /* 0 if we didn't send our name to this friend 1 if we have. */
|
||||||
uint8_t *userstatus;
|
uint8_t *statusmessage;
|
||||||
uint16_t userstatus_length;
|
uint16_t statusmessage_length;
|
||||||
|
uint8_t statusmessage_sent;
|
||||||
|
USERSTATUS userstatus;
|
||||||
uint8_t userstatus_sent;
|
uint8_t userstatus_sent;
|
||||||
USERSTATUS_KIND userstatus_kind;
|
|
||||||
uint16_t info_size; /* length of the info */
|
uint16_t info_size; /* length of the info */
|
||||||
uint32_t message_id; /* a semi-unique id used in read receipts */
|
uint32_t message_id; /* a semi-unique id used in read receipts */
|
||||||
uint8_t receives_read_receipts; /* shall we send read receipts to this person? */
|
uint8_t receives_read_receipts; /* shall we send read receipts to this person? */
|
||||||
|
@ -46,9 +47,9 @@ uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
|
||||||
static uint8_t self_name[MAX_NAME_LENGTH];
|
static uint8_t self_name[MAX_NAME_LENGTH];
|
||||||
static uint16_t self_name_length;
|
static uint16_t self_name_length;
|
||||||
|
|
||||||
static uint8_t *self_userstatus;
|
static uint8_t *self_statusmessage;
|
||||||
static uint16_t self_userstatus_len;
|
static uint16_t self_statusmessage_len;
|
||||||
static USERSTATUS_KIND self_userstatus_kind;
|
static USERSTATUS self_userstatus;
|
||||||
|
|
||||||
#define MAX_NUM_FRIENDS 256
|
#define MAX_NUM_FRIENDS 256
|
||||||
|
|
||||||
|
@ -125,9 +126,9 @@ int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length)
|
||||||
friendlist[i].crypt_connection_id = -1;
|
friendlist[i].crypt_connection_id = -1;
|
||||||
friendlist[i].friend_request_id = -1;
|
friendlist[i].friend_request_id = -1;
|
||||||
memcpy(friendlist[i].client_id, client_id, CLIENT_ID_SIZE);
|
memcpy(friendlist[i].client_id, client_id, CLIENT_ID_SIZE);
|
||||||
friendlist[i].userstatus = calloc(1, 1);
|
friendlist[i].statusmessage = calloc(1, 1);
|
||||||
friendlist[i].userstatus_length = 1;
|
friendlist[i].statusmessage_length = 1;
|
||||||
friendlist[i].userstatus_kind = USERSTATUS_KIND_OFFLINE;
|
friendlist[i].userstatus = USERSTATUS_NONE;
|
||||||
memcpy(friendlist[i].info, data, length);
|
memcpy(friendlist[i].info, data, length);
|
||||||
friendlist[i].info_size = length;
|
friendlist[i].info_size = length;
|
||||||
friendlist[i].message_id = 0;
|
friendlist[i].message_id = 0;
|
||||||
|
@ -152,8 +153,9 @@ int m_addfriend_norequest(uint8_t * client_id)
|
||||||
friendlist[i].crypt_connection_id = -1;
|
friendlist[i].crypt_connection_id = -1;
|
||||||
friendlist[i].friend_request_id = -1;
|
friendlist[i].friend_request_id = -1;
|
||||||
memcpy(friendlist[i].client_id, client_id, CLIENT_ID_SIZE);
|
memcpy(friendlist[i].client_id, client_id, CLIENT_ID_SIZE);
|
||||||
friendlist[i].userstatus = calloc(1, 1);
|
friendlist[i].statusmessage = calloc(1, 1);
|
||||||
friendlist[i].userstatus_length = 1;
|
friendlist[i].statusmessage_length = 1;
|
||||||
|
friendlist[i].userstatus = USERSTATUS_NONE;
|
||||||
friendlist[i].message_id = 0;
|
friendlist[i].message_id = 0;
|
||||||
friendlist[i].receives_read_receipts = 1; /* default: YES */
|
friendlist[i].receives_read_receipts = 1; /* default: YES */
|
||||||
numfriends++;
|
numfriends++;
|
||||||
|
@ -173,7 +175,7 @@ int m_delfriend(int friendnumber)
|
||||||
|
|
||||||
DHT_delfriend(friendlist[friendnumber].client_id);
|
DHT_delfriend(friendlist[friendnumber].client_id);
|
||||||
crypto_kill(friendlist[friendnumber].crypt_connection_id);
|
crypto_kill(friendlist[friendnumber].crypt_connection_id);
|
||||||
free(friendlist[friendnumber].userstatus);
|
free(friendlist[friendnumber].statusmessage);
|
||||||
memset(&friendlist[friendnumber], 0, sizeof(Friend));
|
memset(&friendlist[friendnumber], 0, sizeof(Friend));
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
@ -290,33 +292,28 @@ int getname(int friendnumber, uint8_t * name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_set_userstatus(USERSTATUS_KIND kind, uint8_t *status, uint16_t length)
|
int m_set_statusmessage(uint8_t *status, uint16_t length)
|
||||||
{
|
{
|
||||||
if (length > MAX_USERSTATUS_LENGTH)
|
if (length > MAX_STATUSMESSAGE_LENGTH)
|
||||||
return -1;
|
return -1;
|
||||||
if (kind != USERSTATUS_KIND_RETAIN) {
|
|
||||||
self_userstatus_kind = kind;
|
|
||||||
}
|
|
||||||
uint8_t *newstatus = calloc(length, 1);
|
uint8_t *newstatus = calloc(length, 1);
|
||||||
memcpy(newstatus, status, length);
|
memcpy(newstatus, status, length);
|
||||||
free(self_userstatus);
|
free(self_statusmessage);
|
||||||
self_userstatus = newstatus;
|
self_statusmessage = newstatus;
|
||||||
self_userstatus_len = length;
|
self_statusmessage_len = length;
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i < numfriends; ++i)
|
for (i = 0; i < numfriends; ++i)
|
||||||
friendlist[i].userstatus_sent = 0;
|
friendlist[i].statusmessage_sent = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_set_userstatus_kind(USERSTATUS_KIND kind) {
|
int m_set_userstatus(USERSTATUS status)
|
||||||
if (kind >= USERSTATUS_KIND_INVALID) {
|
{
|
||||||
|
if (status >= USERSTATUS_INVALID) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (kind == USERSTATUS_KIND_RETAIN) {
|
self_userstatus = status;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
self_userstatus_kind = kind;
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i < numfriends; ++i)
|
for (i = 0; i < numfriends; ++i)
|
||||||
friendlist[i].userstatus_sent = 0;
|
friendlist[i].userstatus_sent = 0;
|
||||||
|
@ -324,72 +321,83 @@ int m_set_userstatus_kind(USERSTATUS_KIND kind) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the size of friendnumber's user status
|
/* return the size of friendnumber's user status
|
||||||
guaranteed to be at most MAX_USERSTATUS_LENGTH */
|
guaranteed to be at most MAX_STATUSMESSAGE_LENGTH */
|
||||||
int m_get_userstatus_size(int friendnumber)
|
int m_get_statusmessage_size(int friendnumber)
|
||||||
{
|
{
|
||||||
if (friendnumber >= numfriends || friendnumber < 0)
|
if (friendnumber >= numfriends || friendnumber < 0)
|
||||||
return -1;
|
return -1;
|
||||||
return friendlist[friendnumber].userstatus_length;
|
return friendlist[friendnumber].statusmessage_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the user status of friendnumber into buf, truncating if needed to maxlen
|
/* copy the user status of friendnumber into buf, truncating if needed to maxlen
|
||||||
bytes, use m_get_userstatus_size to find out how much you need to allocate */
|
bytes, use m_get_statusmessage_size to find out how much you need to allocate */
|
||||||
int m_copy_userstatus(int friendnumber, uint8_t * buf, uint32_t maxlen)
|
int m_copy_statusmessage(int friendnumber, uint8_t * buf, uint32_t maxlen)
|
||||||
{
|
{
|
||||||
if (friendnumber >= numfriends || friendnumber < 0)
|
if (friendnumber >= numfriends || friendnumber < 0)
|
||||||
return -1;
|
return -1;
|
||||||
memset(buf, 0, maxlen);
|
memset(buf, 0, maxlen);
|
||||||
memcpy(buf, friendlist[friendnumber].userstatus, MIN(maxlen, MAX_USERSTATUS_LENGTH) - 1);
|
memcpy(buf, friendlist[friendnumber].statusmessage, MIN(maxlen, MAX_STATUSMESSAGE_LENGTH) - 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_copy_self_userstatus(uint8_t * buf, uint32_t maxlen)
|
int m_copy_self_statusmessage(uint8_t * buf, uint32_t maxlen)
|
||||||
{
|
{
|
||||||
memset(buf, 0, maxlen);
|
memset(buf, 0, maxlen);
|
||||||
memcpy(buf, self_userstatus, MIN(maxlen, MAX_USERSTATUS_LENGTH) - 1);
|
memcpy(buf, self_statusmessage, MIN(maxlen, MAX_STATUSMESSAGE_LENGTH) - 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
USERSTATUS_KIND m_get_userstatus_kind(int friendnumber) {
|
USERSTATUS m_get_userstatus(int friendnumber)
|
||||||
if (friendnumber >= numfriends || friendnumber < 0)
|
|
||||||
return USERSTATUS_KIND_INVALID;
|
|
||||||
USERSTATUS_KIND uk = friendlist[friendnumber].userstatus_kind;
|
|
||||||
if (uk >= USERSTATUS_KIND_INVALID) {
|
|
||||||
uk = USERSTATUS_KIND_ONLINE;
|
|
||||||
}
|
|
||||||
return uk;
|
|
||||||
}
|
|
||||||
|
|
||||||
USERSTATUS_KIND m_get_self_userstatus_kind(void) {
|
|
||||||
return self_userstatus_kind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int send_userstatus(int friendnumber, uint8_t * status, uint16_t length)
|
|
||||||
{
|
{
|
||||||
uint8_t *thepacket = malloc(length + 2);
|
if (friendnumber >= numfriends || friendnumber < 0)
|
||||||
memcpy(thepacket + 2, status, length);
|
return USERSTATUS_INVALID;
|
||||||
thepacket[0] = PACKET_ID_USERSTATUS;
|
USERSTATUS status = friendlist[friendnumber].userstatus;
|
||||||
thepacket[1] = self_userstatus_kind;
|
if (status >= USERSTATUS_INVALID) {
|
||||||
int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 2);
|
status = USERSTATUS_NONE;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
USERSTATUS m_get_self_userstatus(void)
|
||||||
|
{
|
||||||
|
return self_userstatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int send_statusmessage(int friendnumber, uint8_t * status, uint16_t length)
|
||||||
|
{
|
||||||
|
uint8_t *thepacket = malloc(length + 1);
|
||||||
|
memcpy(thepacket + 1, status, length);
|
||||||
|
thepacket[0] = PACKET_ID_STATUSMESSAGE;
|
||||||
|
int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 1);
|
||||||
free(thepacket);
|
free(thepacket);
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_friend_userstatus(int friendnumber, uint8_t * status, uint16_t length)
|
static int send_userstatus(int friendnumber, USERSTATUS status)
|
||||||
|
{
|
||||||
|
uint8_t *thepacket = malloc(1 + 1);
|
||||||
|
memcpy(thepacket + 1, &status, 1);
|
||||||
|
thepacket[0] = PACKET_ID_USERSTATUS;
|
||||||
|
int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, 1 + 1);
|
||||||
|
free(thepacket);
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_friend_statusmessage(int friendnumber, uint8_t * status, uint16_t length)
|
||||||
{
|
{
|
||||||
if (friendnumber >= numfriends || friendnumber < 0)
|
if (friendnumber >= numfriends || friendnumber < 0)
|
||||||
return -1;
|
return -1;
|
||||||
uint8_t *newstatus = calloc(length, 1);
|
uint8_t *newstatus = calloc(length, 1);
|
||||||
memcpy(newstatus, status, length);
|
memcpy(newstatus, status, length);
|
||||||
free(friendlist[friendnumber].userstatus);
|
free(friendlist[friendnumber].statusmessage);
|
||||||
friendlist[friendnumber].userstatus = newstatus;
|
friendlist[friendnumber].statusmessage = newstatus;
|
||||||
friendlist[friendnumber].userstatus_length = length;
|
friendlist[friendnumber].statusmessage_length = length;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_friend_userstatus_kind(int friendnumber, USERSTATUS_KIND k)
|
static void set_friend_userstatus(int friendnumber, USERSTATUS status)
|
||||||
{
|
{
|
||||||
friendlist[friendnumber].userstatus_kind = k;
|
friendlist[friendnumber].userstatus = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sets whether we send read receipts for friendnumber. */
|
/* Sets whether we send read receipts for friendnumber. */
|
||||||
|
@ -428,12 +436,20 @@ void m_callback_namechange(void (*function)(int, uint8_t *, uint16_t))
|
||||||
friend_namechange_isset = 1;
|
friend_namechange_isset = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void (*friend_statuschange)(int, USERSTATUS_KIND, uint8_t *, uint16_t);
|
static void (*friend_statusmessagechange)(int, uint8_t *, uint16_t);
|
||||||
static uint8_t friend_statuschange_isset = 0;
|
static uint8_t friend_statusmessagechange_isset = 0;
|
||||||
void m_callback_userstatus(void (*function)(int, USERSTATUS_KIND, uint8_t *, uint16_t))
|
void m_callback_statusmessage(void (*function)(int, uint8_t *, uint16_t))
|
||||||
{
|
{
|
||||||
friend_statuschange = function;
|
friend_statusmessagechange = function;
|
||||||
friend_statuschange_isset = 1;
|
friend_statusmessagechange_isset = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (*friend_userstatuschange)(int, USERSTATUS);
|
||||||
|
static uint8_t friend_userstatuschange_isset = 0;
|
||||||
|
void m_callback_userstatus(void (*function)(int, USERSTATUS))
|
||||||
|
{
|
||||||
|
friend_userstatuschange = function;
|
||||||
|
friend_userstatuschange_isset = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void (*read_receipt)(int, uint32_t);
|
static void (*read_receipt)(int, uint32_t);
|
||||||
|
@ -449,7 +465,7 @@ void m_callback_read_receipt(void (*function)(int, uint32_t))
|
||||||
int initMessenger(void)
|
int initMessenger(void)
|
||||||
{
|
{
|
||||||
new_keys();
|
new_keys();
|
||||||
m_set_userstatus(USERSTATUS_KIND_ONLINE, (uint8_t*)"Online", sizeof("Online"));
|
m_set_statusmessage((uint8_t*)"Online", sizeof("Online"));
|
||||||
initNetCrypto();
|
initNetCrypto();
|
||||||
IP ip;
|
IP ip;
|
||||||
ip.i = 0;
|
ip.i = 0;
|
||||||
|
@ -504,8 +520,12 @@ static void doFriends(void)
|
||||||
if (m_sendname(i, self_name, self_name_length))
|
if (m_sendname(i, self_name, self_name_length))
|
||||||
friendlist[i].name_sent = 1;
|
friendlist[i].name_sent = 1;
|
||||||
}
|
}
|
||||||
|
if (friendlist[i].statusmessage_sent == 0) {
|
||||||
|
if (send_statusmessage(i, self_statusmessage, self_statusmessage_len))
|
||||||
|
friendlist[i].statusmessage_sent = 1;
|
||||||
|
}
|
||||||
if (friendlist[i].userstatus_sent == 0) {
|
if (friendlist[i].userstatus_sent == 0) {
|
||||||
if (send_userstatus(i, self_userstatus, self_userstatus_len))
|
if (send_userstatus(i, self_userstatus))
|
||||||
friendlist[i].userstatus_sent = 1;
|
friendlist[i].userstatus_sent = 1;
|
||||||
}
|
}
|
||||||
len = read_cryptpacket(friendlist[i].crypt_connection_id, temp);
|
len = read_cryptpacket(friendlist[i].crypt_connection_id, temp);
|
||||||
|
@ -520,18 +540,24 @@ static void doFriends(void)
|
||||||
friendlist[i].name[len - 2] = 0; /* make sure the NULL terminator is present. */
|
friendlist[i].name[len - 2] = 0; /* make sure the NULL terminator is present. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PACKET_ID_STATUSMESSAGE: {
|
||||||
|
if (len < 2)
|
||||||
|
break;
|
||||||
|
uint8_t *status = calloc(MIN(len - 1, MAX_STATUSMESSAGE_LENGTH), 1);
|
||||||
|
memcpy(status, temp + 1, MIN(len - 1, MAX_STATUSMESSAGE_LENGTH));
|
||||||
|
if (friend_statusmessagechange_isset)
|
||||||
|
friend_statusmessagechange(i, status, MIN(len - 1, MAX_STATUSMESSAGE_LENGTH));
|
||||||
|
set_friend_statusmessage(i, status, MIN(len - 1, MAX_STATUSMESSAGE_LENGTH));
|
||||||
|
free(status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case PACKET_ID_USERSTATUS: {
|
case PACKET_ID_USERSTATUS: {
|
||||||
if (len > 2) {
|
if (len != 2)
|
||||||
uint8_t *status = calloc(MIN(len - 2, MAX_USERSTATUS_LENGTH), 1);
|
break;
|
||||||
memcpy(status, temp + 2, MIN(len - 2, MAX_USERSTATUS_LENGTH));
|
USERSTATUS status = temp[1];
|
||||||
if (friend_statuschange_isset)
|
if (friend_userstatuschange_isset)
|
||||||
friend_statuschange(i, temp[1], status, MIN(len - 2, MAX_USERSTATUS_LENGTH));
|
friend_userstatuschange(i, status);
|
||||||
set_friend_userstatus(i, status, MIN(len - 2, MAX_USERSTATUS_LENGTH));
|
set_friend_userstatus(i, status);
|
||||||
free(status);
|
|
||||||
} else if (friend_statuschange_isset) {
|
|
||||||
friend_statuschange(i, temp[1], friendlist[i].userstatus, friendlist[i].userstatus_length);
|
|
||||||
}
|
|
||||||
set_friend_userstatus_kind(i, temp[1]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PACKET_ID_MESSAGE: {
|
case PACKET_ID_MESSAGE: {
|
||||||
|
@ -694,7 +720,7 @@ int Messenger_load(uint8_t * data, uint32_t length)
|
||||||
if(temp[i].status != 0) {
|
if(temp[i].status != 0) {
|
||||||
int fnum = m_addfriend_norequest(temp[i].client_id);
|
int fnum = m_addfriend_norequest(temp[i].client_id);
|
||||||
setfriendname(fnum, temp[i].name);
|
setfriendname(fnum, temp[i].name);
|
||||||
/* set_friend_userstatus(fnum, temp[i].userstatus, temp[i].userstatus_length); */
|
/* set_friend_statusmessage(fnum, temp[i].statusmessage, temp[i].statusmessage_length); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(temp);
|
free(temp);
|
||||||
|
|
|
@ -36,10 +36,11 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_NAME_LENGTH 128
|
#define MAX_NAME_LENGTH 128
|
||||||
#define MAX_USERSTATUS_LENGTH 128
|
#define MAX_STATUSMESSAGE_LENGTH 128
|
||||||
|
|
||||||
#define PACKET_ID_NICKNAME 48
|
#define PACKET_ID_NICKNAME 48
|
||||||
#define PACKET_ID_USERSTATUS 49
|
#define PACKET_ID_STATUSMESSAGE 49
|
||||||
|
#define PACKET_ID_USERSTATUS 50
|
||||||
#define PACKET_ID_RECEIPT 65
|
#define PACKET_ID_RECEIPT 65
|
||||||
#define PACKET_ID_MESSAGE 64
|
#define PACKET_ID_MESSAGE 64
|
||||||
|
|
||||||
|
@ -58,24 +59,18 @@ extern "C" {
|
||||||
#define FAERR_ALREADYSENT -4
|
#define FAERR_ALREADYSENT -4
|
||||||
#define FAERR_UNKNOWN -5
|
#define FAERR_UNKNOWN -5
|
||||||
|
|
||||||
/* don't assume MAX_USERSTATUS_LENGTH will stay at 128, it may be increased
|
/* don't assume MAX_STATUSMESSAGE_LENGTH will stay at 128, it may be increased
|
||||||
to an absurdly large number later */
|
to an absurdly large number later */
|
||||||
|
|
||||||
/* USERSTATUS_KIND
|
/* USERSTATUS
|
||||||
* Represents the different kinds of userstatus
|
* Represents userstatuses someone can have. */
|
||||||
* someone can have.
|
|
||||||
* More on this later... */
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
USERSTATUS_KIND_RETAIN = (uint8_t)0, /* This is a special value that must not be returned by
|
USERSTATUS_NONE,
|
||||||
* m_get_userstatus_kind. You can pass it into m_set_userstatus
|
USERSTATUS_AWAY,
|
||||||
* to keep the current USERSTATUS_KIND. */
|
USERSTATUS_BUSY,
|
||||||
USERSTATUS_KIND_ONLINE, /* Recommended representation: Green. */
|
USERSTATUS_INVALID
|
||||||
USERSTATUS_KIND_AWAY, /* Recommended representation: Orange, or yellow. */
|
} USERSTATUS;
|
||||||
USERSTATUS_KIND_BUSY, /* Recommended representation: Red. */
|
|
||||||
USERSTATUS_KIND_OFFLINE, /* Recommended representation: Grey, semi-transparent. */
|
|
||||||
USERSTATUS_KIND_INVALID,
|
|
||||||
} USERSTATUS_KIND;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add a friend
|
* add a friend
|
||||||
|
@ -150,26 +145,26 @@ int getname(int friendnumber, uint8_t *name);
|
||||||
/* set our user status
|
/* set our user status
|
||||||
you are responsible for freeing status after
|
you are responsible for freeing status after
|
||||||
returns 0 on success, -1 on failure */
|
returns 0 on success, -1 on failure */
|
||||||
int m_set_userstatus(USERSTATUS_KIND kind, uint8_t *status, uint16_t length);
|
int m_set_statusmessage(uint8_t *status, uint16_t length);
|
||||||
int m_set_userstatus_kind(USERSTATUS_KIND kind);
|
int m_set_userstatus(USERSTATUS status);
|
||||||
|
|
||||||
/* return the length of friendnumber's user status,
|
/* return the length of friendnumber's status message,
|
||||||
including null
|
including null
|
||||||
pass it into malloc */
|
pass it into malloc */
|
||||||
int m_get_userstatus_size(int friendnumber);
|
int m_get_statusmessage_size(int friendnumber);
|
||||||
|
|
||||||
/* copy friendnumber's userstatus into buf, truncating if size is over maxlen
|
/* copy friendnumber's status message into buf, truncating if size is over maxlen
|
||||||
get the size you need to allocate from m_get_userstatus_size
|
get the size you need to allocate from m_get_statusmessage_size
|
||||||
The self variant will copy our own userstatus. */
|
The self variant will copy our own status message. */
|
||||||
int m_copy_userstatus(int friendnumber, uint8_t *buf, uint32_t maxlen);
|
int m_copy_statusmessage(int friendnumber, uint8_t *buf, uint32_t maxlen);
|
||||||
int m_copy_self_userstatus(uint8_t *buf, uint32_t maxlen);
|
int m_copy_self_statusmessage(uint8_t *buf, uint32_t maxlen);
|
||||||
|
|
||||||
/* Return one of USERSTATUS_KIND values, except USERSTATUS_KIND_RETAIN.
|
/* Return one of USERSTATUS values.
|
||||||
* Values unknown to your application should be represented as USERSTATUS_KIND_ONLINE.
|
* Values unknown to your application should be represented as USERSTATUS_NONE.
|
||||||
* As above, the self variant will return our own USERSTATUS_KIND.
|
* As above, the self variant will return our own USERSTATUS.
|
||||||
* If friendnumber is invalid, this shall return USERSTATUS_KIND_INVALID. */
|
* If friendnumber is invalid, this shall return USERSTATUS_INVALID. */
|
||||||
USERSTATUS_KIND m_get_userstatus_kind(int friendnumber);
|
USERSTATUS m_get_userstatus(int friendnumber);
|
||||||
USERSTATUS_KIND m_get_self_userstatus_kind(void);
|
USERSTATUS m_get_self_userstatus(void);
|
||||||
|
|
||||||
/* Sets whether we send read receipts for friendnumber.
|
/* Sets whether we send read receipts for friendnumber.
|
||||||
* This function is not lazy, and it will fail if yesno is not (0 or 1).*/
|
* This function is not lazy, and it will fail if yesno is not (0 or 1).*/
|
||||||
|
@ -188,10 +183,10 @@ void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t));
|
||||||
you are not responsible for freeing newname */
|
you are not responsible for freeing newname */
|
||||||
void m_callback_namechange(void (*function)(int, uint8_t *, uint16_t));
|
void m_callback_namechange(void (*function)(int, uint8_t *, uint16_t));
|
||||||
|
|
||||||
/* set the callback for user status changes
|
/* set the callback for status message changes
|
||||||
function(int friendnumber, USERSTATUS_KIND kind, uint8_t *newstatus, uint16_t length)
|
function(int friendnumber, uint8_t *newstatus, uint16_t length)
|
||||||
you are not responsible for freeing newstatus */
|
you are not responsible for freeing newstatus */
|
||||||
void m_callback_userstatus(void (*function)(int, USERSTATUS_KIND, uint8_t *, uint16_t));
|
void m_callback_statusmessage(void (*function)(int, uint8_t *, uint16_t));
|
||||||
|
|
||||||
/* set the callback for read receipts
|
/* set the callback for read receipts
|
||||||
function(int friendnumber, uint32_t receipt)
|
function(int friendnumber, uint32_t receipt)
|
||||||
|
|
|
@ -220,7 +220,7 @@ void line_eval(char *line)
|
||||||
print_friendlist();
|
print_friendlist();
|
||||||
}
|
}
|
||||||
else if (inpt_command == 's') {
|
else if (inpt_command == 's') {
|
||||||
uint8_t status[MAX_USERSTATUS_LENGTH];
|
uint8_t status[MAX_STATUSMESSAGE_LENGTH];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
size_t len = strlen(line);
|
size_t len = strlen(line);
|
||||||
for (i = 3; i < len; i++) {
|
for (i = 3; i < len; i++) {
|
||||||
|
@ -228,7 +228,7 @@ void line_eval(char *line)
|
||||||
status[i-3] = line[i];
|
status[i-3] = line[i];
|
||||||
}
|
}
|
||||||
status[i-3] = 0;
|
status[i-3] = 0;
|
||||||
m_set_userstatus(USERSTATUS_KIND_ONLINE, status, strlen((char*)status) + 1);
|
m_set_statusmessage(status, strlen((char*)status) + 1);
|
||||||
char numstring[100];
|
char numstring[100];
|
||||||
sprintf(numstring, "[i] changed status to %s", (char*)status);
|
sprintf(numstring, "[i] changed status to %s", (char*)status);
|
||||||
new_lines(numstring);
|
new_lines(numstring);
|
||||||
|
@ -364,7 +364,7 @@ void print_nickchange(int friendnumber, uint8_t *string, uint16_t length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t *string, uint16_t length)
|
void print_statuschange(int friendnumber, uint8_t *string, uint16_t length)
|
||||||
{
|
{
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
if(getname(friendnumber, (uint8_t*)name) != -1) {
|
if(getname(friendnumber, (uint8_t*)name) != -1) {
|
||||||
|
@ -464,7 +464,7 @@ int main(int argc, char *argv[])
|
||||||
m_callback_friendrequest(print_request);
|
m_callback_friendrequest(print_request);
|
||||||
m_callback_friendmessage(print_message);
|
m_callback_friendmessage(print_message);
|
||||||
m_callback_namechange(print_nickchange);
|
m_callback_namechange(print_nickchange);
|
||||||
m_callback_userstatus(print_statuschange);
|
m_callback_statusmessage(print_statuschange);
|
||||||
|
|
||||||
initscr();
|
initscr();
|
||||||
noecho();
|
noecho();
|
||||||
|
|
|
@ -86,7 +86,7 @@ void print_nickchange(int friendnumber, uint8_t *string, uint16_t length)
|
||||||
printf(msg);
|
printf(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_statuschange(int friendnumber,USERSTATUS_KIND kind, uint8_t *string, uint16_t length)
|
void print_statuschange(int friendnumber, uint8_t *string, uint16_t length)
|
||||||
{
|
{
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
getname(friendnumber, (uint8_t*)name);
|
getname(friendnumber, (uint8_t*)name);
|
||||||
|
@ -263,7 +263,7 @@ void change_nickname()
|
||||||
|
|
||||||
void change_status(int savetofile)
|
void change_status(int savetofile)
|
||||||
{
|
{
|
||||||
uint8_t status[MAX_USERSTATUS_LENGTH];
|
uint8_t status[MAX_STATUSMESSAGE_LENGTH];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
size_t len = strlen(line);
|
size_t len = strlen(line);
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void change_status(int savetofile)
|
||||||
}
|
}
|
||||||
|
|
||||||
status[i-3] = 0;
|
status[i-3] = 0;
|
||||||
m_set_userstatus(USERSTATUS_KIND_RETAIN, status, strlen((char*)status));
|
m_set_statusmessage(status, strlen((char*)status));
|
||||||
char numstring[100];
|
char numstring[100];
|
||||||
sprintf(numstring, "\n[i] changed status to %s\n\n", (char*)status);
|
sprintf(numstring, "\n[i] changed status to %s\n\n", (char*)status);
|
||||||
printf(numstring);
|
printf(numstring);
|
||||||
|
@ -403,11 +403,11 @@ int main(int argc, char *argv[])
|
||||||
FILE* status_file = NULL;
|
FILE* status_file = NULL;
|
||||||
status_file = fopen("statusfile.txt", "r");
|
status_file = fopen("statusfile.txt", "r");
|
||||||
if(status_file) {
|
if(status_file) {
|
||||||
uint8_t status[MAX_USERSTATUS_LENGTH];
|
uint8_t status[MAX_STATUSMESSAGE_LENGTH];
|
||||||
while (fgets(line, MAX_USERSTATUS_LENGTH, status_file) != NULL) {
|
while (fgets(line, MAX_STATUSMESSAGE_LENGTH, status_file) != NULL) {
|
||||||
sscanf(line, "%s", (char*)status);
|
sscanf(line, "%s", (char*)status);
|
||||||
}
|
}
|
||||||
m_set_userstatus(USERSTATUS_KIND_RETAIN, status, strlen((char*)status)+1);
|
m_set_statusmessage(status, strlen((char*)status)+1);
|
||||||
statusloaded = 1;
|
statusloaded = 1;
|
||||||
printf("%s\n", status);
|
printf("%s\n", status);
|
||||||
fclose(status_file);
|
fclose(status_file);
|
||||||
|
@ -416,7 +416,7 @@ int main(int argc, char *argv[])
|
||||||
m_callback_friendrequest(print_request);
|
m_callback_friendrequest(print_request);
|
||||||
m_callback_friendmessage(print_message);
|
m_callback_friendmessage(print_message);
|
||||||
m_callback_namechange(print_nickchange);
|
m_callback_namechange(print_nickchange);
|
||||||
m_callback_userstatus(print_statuschange);
|
m_callback_statusmessae(print_statuschange);
|
||||||
char idstring1[PUB_KEY_BYTES][5];
|
char idstring1[PUB_KEY_BYTES][5];
|
||||||
char idstring2[PUB_KEY_BYTES][5];
|
char idstring2[PUB_KEY_BYTES][5];
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
void do_header();
|
void do_header();
|
||||||
void print_message(int friendnumber, uint8_t * string, uint16_t length);
|
void print_message(int friendnumber, uint8_t * string, uint16_t length);
|
||||||
void print_nickchange(int friendnumber, uint8_t *string, uint16_t length);
|
void print_nickchange(int friendnumber, uint8_t *string, uint16_t length);
|
||||||
void print_statuschange(int friendnumber,USERSTATUS_KIND kind, uint8_t *string, uint16_t length);
|
void print_statuschange(int friendnumber, uint8_t *string, uint16_t length);
|
||||||
void load_key();
|
void load_key();
|
||||||
void add_friend();
|
void add_friend();
|
||||||
void list_friends();
|
void list_friends();
|
||||||
|
|
|
@ -161,7 +161,7 @@ void execute(ToxWindow *self, ChatContext *ctx, char *cmd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msg++;
|
msg++;
|
||||||
m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1);
|
m_set_statusmessage((uint8_t*) msg, strlen(msg)+1);
|
||||||
wprintw(ctx->history, "Status set to: %s\n", msg);
|
wprintw(ctx->history, "Status set to: %s\n", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ extern int active_window;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t name[MAX_NAME_LENGTH];
|
uint8_t name[MAX_NAME_LENGTH];
|
||||||
uint8_t status[MAX_USERSTATUS_LENGTH];
|
uint8_t status[MAX_STATUSMESSAGE_LENGTH];
|
||||||
int num;
|
int num;
|
||||||
int chatwin;
|
int chatwin;
|
||||||
} friend_t;
|
} friend_t;
|
||||||
|
@ -74,7 +74,7 @@ void friendlist_onNickChange(ToxWindow *self, int num, uint8_t *str, uint16_t le
|
||||||
|
|
||||||
void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len)
|
void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len)
|
||||||
{
|
{
|
||||||
if (len >= MAX_USERSTATUS_LENGTH || num >= num_friends)
|
if (len >= MAX_STATUSMESSAGE_LENGTH || num >= num_friends)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memcpy((char*) &friends[num].status, (char*) str, len);
|
memcpy((char*) &friends[num].status, (char*) str, len);
|
||||||
|
|
|
@ -69,7 +69,7 @@ void on_nickchange(int friendnumber, uint8_t *string, uint16_t length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t *string, uint16_t length)
|
void on_statuschange(int friendnumber, uint8_t *string, uint16_t length)
|
||||||
{
|
{
|
||||||
wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string);
|
wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string);
|
||||||
int i;
|
int i;
|
||||||
|
@ -113,7 +113,7 @@ static void init_tox()
|
||||||
m_callback_friendrequest(on_request);
|
m_callback_friendrequest(on_request);
|
||||||
m_callback_friendmessage(on_message);
|
m_callback_friendmessage(on_message);
|
||||||
m_callback_namechange(on_nickchange);
|
m_callback_namechange(on_nickchange);
|
||||||
m_callback_userstatus(on_statuschange);
|
m_callback_statusmessage(on_statuschange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_window_status()
|
void init_window_status()
|
||||||
|
|
|
@ -193,27 +193,22 @@ static void execute(ToxWindow *self, char *u_cmd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status++;
|
status++;
|
||||||
USERSTATUS_KIND status_kind;
|
USERSTATUS status_kind;
|
||||||
if (!strncmp(status, "online", strlen("online"))) {
|
if (!strncmp(status, "online", strlen("online"))) {
|
||||||
status_kind = USERSTATUS_KIND_ONLINE;
|
status_kind = USERSTATUS_NONE;
|
||||||
status_text = "ONLINE";
|
status_text = "ONLINE";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!strncmp(status, "away", strlen("away"))) {
|
else if (!strncmp(status, "away", strlen("away"))) {
|
||||||
status_kind = USERSTATUS_KIND_AWAY;
|
status_kind = USERSTATUS_AWAY;
|
||||||
status_text = "AWAY";
|
status_text = "AWAY";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!strncmp(status, "busy", strlen("busy"))) {
|
else if (!strncmp(status, "busy", strlen("busy"))) {
|
||||||
status_kind = USERSTATUS_KIND_BUSY;
|
status_kind = USERSTATUS_BUSY;
|
||||||
status_text = "BUSY";
|
status_text = "BUSY";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!strncmp(status, "offline", strlen("offline"))) {
|
|
||||||
status_kind = USERSTATUS_KIND_OFFLINE;
|
|
||||||
status_text = "OFFLINE";
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wprintw(self->window, "Invalid status.\n");
|
wprintw(self->window, "Invalid status.\n");
|
||||||
|
@ -222,12 +217,13 @@ static void execute(ToxWindow *self, char *u_cmd)
|
||||||
|
|
||||||
msg = strchr(status, ' ');
|
msg = strchr(status, ' ');
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
m_set_userstatus_kind(status_kind);
|
m_set_userstatus(status_kind);
|
||||||
wprintw(self->window, "Status set to: %s\n", status_text);
|
wprintw(self->window, "Status set to: %s\n", status_text);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg++;
|
msg++;
|
||||||
m_set_userstatus(status_kind, (uint8_t*) msg, strlen(msg)+1);
|
m_set_userstatus(status_kind);
|
||||||
|
m_set_statusmessage((uint8_t*) msg, strlen(msg)+1);
|
||||||
wprintw(self->window, "Status set to: %s, %s\n", status_text, msg);
|
wprintw(self->window, "Status set to: %s, %s\n", status_text, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +235,7 @@ static void execute(ToxWindow *self, char *u_cmd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msg++;
|
msg++;
|
||||||
m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1);
|
m_set_statusmessage((uint8_t*) msg, strlen(msg)+1);
|
||||||
wprintw(self->window, "Status set to: %s\n", msg);
|
wprintw(self->window, "Status set to: %s\n", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user