added some better error checking for print_nickname() anr print_statuschange()

This commit is contained in:
charmlesscoin 2013-08-03 18:02:09 -04:00
parent 43f6608530
commit 6222e32848

View File

@ -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)