From 76de1e7f4b88d7966808e1b1f960220ac7db2774 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sun, 7 Jan 2018 22:59:39 +1000 Subject: [PATCH] Attempt to add first/last names to bluewave scan --- magicka.strings | 1 + src/bluewave.c | 7 +++++-- src/users.c | 10 ++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/magicka.strings b/magicka.strings index 1117657..fdd6402 100644 --- a/magicka.strings +++ b/magicka.strings @@ -242,3 +242,4 @@ File exists!\r\n \r\nFirstname may not begin or end with a space\r\n \r\nLastname may not begin or end with a space\r\n \r\nFirst & Last Name combination in use!\r\n +\r\nSpaces not allowed\r\n diff --git a/src/bluewave.c b/src/bluewave.c index 54365d7..08e9ef0 100644 --- a/src/bluewave.c +++ b/src/bluewave.c @@ -61,8 +61,10 @@ int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file struct fido_addr *fido; char *body; struct tm timeStruct; + char realname[66]; char *month_name[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + snprintf(realname, 65, "%s %s", gUser->firstname, gUser->lastname); if (msghs == NULL) { return totmsgs; } @@ -111,7 +113,7 @@ int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file } if (msghs->msgs[k]->to != NULL) { - if (strcasecmp(msghs->msgs[k]->to, gUser->loginname) == 0) { + if (strcasecmp(msghs->msgs[k]->to, gUser->loginname) == 0 || strncasecmp(msghs->msgs[k]->to, realname, 42) == 0) { personal_msgs++; } } @@ -246,7 +248,8 @@ void bwave_create_packet() { hdr.ver = PACKET_LEVEL; strncpy(hdr.loginname, gUser->loginname, 42); - strncpy(hdr.aliasname, gUser->loginname, 42); + //strncpy(hdr.aliasname, gUser->loginname, 42); + snprintf(hdr.aliasname, 42, "%s %s", gUser->firstname, gUser->lastname); hdr.zone = converts(conf.main_aka->zone); hdr.node = converts(conf.main_aka->node); hdr.net = converts(conf.main_aka->net); diff --git a/src/users.c b/src/users.c index 4d4b0d8..581b355 100644 --- a/src/users.c +++ b/src/users.c @@ -655,7 +655,10 @@ struct user_record *new_user() { s_printf(get_string(167)); continue; } - + if (strchr(buffer, ' ') != NULL) { + s_printf(get_string(244)); + continue; + } s_printf("\r\n"); user->firstname = strdup(buffer); nameok = 1; @@ -674,7 +677,10 @@ struct user_record *new_user() { s_printf(get_string(167)); continue; } - + if (strchr(buffer, ' ') != NULL) { + s_printf(get_string(244)); + continue; + } s_printf("\r\n"); nameok = 1; user->lastname = strdup(buffer);