Add BBS identification and version to msgs

This commit is contained in:
Andrew Pamment 2016-04-11 21:30:37 +10:00
parent ae411a9eb5
commit 0b1829879f

View File

@ -261,6 +261,7 @@ char *external_editor(int socket, struct user_record *user, char *to, char *from
FILE *fptr; FILE *fptr;
char *body = NULL; char *body = NULL;
char buffer[256]; char buffer[256];
char buffer2[256];
int len; int len;
int totlen; int totlen;
char *body2 = NULL; char *body2 = NULL;
@ -359,8 +360,9 @@ char *external_editor(int socket, struct user_record *user, char *to, char *from
} }
} }
snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d (%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, tagline);
body2 = (char *)malloc(totlen + 19 + strlen(tagline)); body2 = (char *)malloc(totlen + 2 + strlen(buffer));
j = 0; j = 0;
@ -374,7 +376,7 @@ char *external_editor(int socket, struct user_record *user, char *to, char *from
body2[j] = '\0'; body2[j] = '\0';
} }
sprintf(buffer, "\r---\r * Origin: %s \r", tagline);
strcat(body2, buffer); strcat(body2, buffer);
free(body); free(body);
@ -447,8 +449,10 @@ char *editor(int socket, struct user_record *user, char *quote, char *from) {
tagline = conf.default_tagline; tagline = conf.default_tagline;
} }
size += 18; snprintf(buffer, 256, "\r--- MagickaBBS v%d.%d (%s)\r * Origin: %s \r", VERSION_MAJOR, VERSION_MINOR, VERSION_STR, tagline);
size += strlen(tagline);
size += 2;
size += strlen(buffer);
msg = (char *)malloc(size); msg = (char *)malloc(size);
memset(msg, 0, size); memset(msg, 0, size);
@ -458,7 +462,6 @@ char *editor(int socket, struct user_record *user, char *quote, char *from) {
free(content[i]); free(content[i]);
} }
sprintf(buffer, "\r---\r * Origin: %s \r", tagline);
strcat(msg, buffer); strcat(msg, buffer);
free(content); free(content);