mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
added some better error checking for print_nickname() anr print_statuschange()
This commit is contained in:
parent
43f6608530
commit
6222e32848
|
@ -343,19 +343,21 @@ 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)
|
||||||
{
|
{
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
getname(friendnumber, (uint8_t*)name);
|
if(getname(friendnumber, (uint8_t*)name) != -1) {
|
||||||
char msg[100+length];
|
char msg[100+length];
|
||||||
sprintf(msg, "[i] [%d] %s is now known as %s.", friendnumber, name, string);
|
sprintf(msg, "[i] [%d] %s is now known as %s.", friendnumber, name, string);
|
||||||
new_lines(msg);
|
new_lines(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_statuschange(int friendnumber, 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);
|
if(getname(friendnumber, (uint8_t*)name) != -1) {
|
||||||
char msg[100+length+strlen(name)+1];
|
char msg[100+length+strlen(name)+1];
|
||||||
sprintf(msg, "[i] [%d] %s's status changed to %s.", friendnumber, name, string);
|
sprintf(msg, "[i] [%d] %s's status changed to %s.", friendnumber, name, string);
|
||||||
new_lines(msg);
|
new_lines(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_key(char *path)
|
void load_key(char *path)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user