Added Taglines for Message Conferences
This commit is contained in:
parent
c5f357a9be
commit
9ca3609b7c
7
bbs.c
7
bbs.c
@ -213,6 +213,8 @@ static int mail_area_handler(void* user, const char* section, const char* name,
|
||||
} else {
|
||||
mc->realnames = 0;
|
||||
}
|
||||
} else if (strcasecmp(name, "tagline")) {
|
||||
mc->tagline = strdup(value);
|
||||
}
|
||||
} else if (strcasecmp(section, "network") == 0) {
|
||||
if (strcasecmp(name, "type") == 0) {
|
||||
@ -293,7 +295,9 @@ static int handler(void* user, const char* section, const char* name,
|
||||
conf->irc_port = atoi(value);
|
||||
} else if (strcasecmp(name, "irc channel") == 0) {
|
||||
conf->irc_channel = strdup(value);
|
||||
}
|
||||
} else if (strcasecmp(name, "default tagline") == 0) {
|
||||
conf->default_tagline = strdup(value);
|
||||
}
|
||||
} else if (strcasecmp(section, "paths") == 0){
|
||||
if (strcasecmp(name, "ansi path") == 0) {
|
||||
conf->ansi_path = strdup(value);
|
||||
@ -312,6 +316,7 @@ static int handler(void* user, const char* section, const char* name,
|
||||
conf->mail_conferences[conf->mail_conference_count] = (struct mail_conference *)malloc(sizeof(struct mail_conference));
|
||||
conf->mail_conferences[conf->mail_conference_count]->name = strdup(name);
|
||||
conf->mail_conferences[conf->mail_conference_count]->path = strdup(value);
|
||||
conf->mail_conferences[conf->mail_conference_count]->tagline = NULL;
|
||||
conf->mail_conferences[conf->mail_conference_count]->mail_area_count = 0;
|
||||
conf->mail_conference_count++;
|
||||
} else if (strcasecmp(section, "file directories") == 0) {
|
||||
|
2
bbs.h
2
bbs.h
@ -49,6 +49,7 @@ struct mail_area {
|
||||
struct mail_conference {
|
||||
char *name;
|
||||
char *path;
|
||||
char *tagline;
|
||||
int networked;
|
||||
int nettype;
|
||||
int realnames;
|
||||
@ -80,6 +81,7 @@ struct bbs_config {
|
||||
char *ansi_path;
|
||||
char *bbs_path;
|
||||
char *email_path;
|
||||
char *default_tagline;
|
||||
|
||||
char *irc_server;
|
||||
int irc_port;
|
||||
|
@ -6,6 +6,7 @@ New User Level = 10
|
||||
IRC Server = localhost
|
||||
IRC Port = 6667
|
||||
IRC Channel = #bbs
|
||||
Default Tagline = Brought to you by Another Magicka BBS!
|
||||
|
||||
[paths]
|
||||
ANSI Path = /home/andrew/MagickaBBS/ansis
|
||||
|
25
mail_menu.c
25
mail_menu.c
@ -28,7 +28,7 @@ s_JamBase *open_jam_base(char *path) {
|
||||
return jb;
|
||||
}
|
||||
|
||||
char *editor(int socket, char *quote, char *from) {
|
||||
char *editor(int socket, struct user_record *user, char *quote, char *from) {
|
||||
int lines = 0;
|
||||
char buffer[256];
|
||||
char linebuffer[80];
|
||||
@ -43,6 +43,7 @@ char *editor(int socket, char *quote, char *from) {
|
||||
int lineat=0;
|
||||
int qfrom,qto;
|
||||
int z;
|
||||
char *tagline;
|
||||
|
||||
if (quote != NULL) {
|
||||
for (i=0;i<strlen(quote);i++) {
|
||||
@ -78,6 +79,16 @@ char *editor(int socket, char *quote, char *from) {
|
||||
size += strlen(content[i]) + 1;
|
||||
}
|
||||
size ++;
|
||||
|
||||
if (conf.mail_conferences[user->cur_mail_conf]->tagline != NULL) {
|
||||
tagline = conf.mail_conferences[user->cur_mail_conf]->tagline;
|
||||
} else {
|
||||
tagline = conf.default_tagline;
|
||||
}
|
||||
|
||||
size += 7;
|
||||
size += strlen(tagline);
|
||||
|
||||
msg = (char *)malloc(size);
|
||||
memset(msg, 0, size);
|
||||
for (i=0;i<lines;i++) {
|
||||
@ -85,6 +96,10 @@ char *editor(int socket, char *quote, char *from) {
|
||||
strcat(msg, "\r");
|
||||
free(content[i]);
|
||||
}
|
||||
strcat(msg, "\r---\r");
|
||||
strcat(msg, tagline);
|
||||
strcat(msg, "\r");
|
||||
|
||||
free(content);
|
||||
if (quote != NULL) {
|
||||
for (i=0;i<quotelines;i++) {
|
||||
@ -392,7 +407,7 @@ void read_message(int socket, struct user_record *user, int mailno) {
|
||||
}
|
||||
to = (char *)malloc(strlen(buffer) + 1);
|
||||
strcpy(to, buffer);
|
||||
replybody = editor(socket, body, to);
|
||||
replybody = editor(socket, user, body, to);
|
||||
if (replybody != NULL) {
|
||||
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
|
||||
if (!jb) {
|
||||
@ -624,7 +639,7 @@ int mail_menu(int socket, struct user_record *user) {
|
||||
subject = strdup(buffer);
|
||||
|
||||
// post a message
|
||||
msg = editor(socket, NULL, NULL);
|
||||
msg = editor(socket, user, NULL, NULL);
|
||||
|
||||
if (msg != NULL) {
|
||||
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
|
||||
@ -980,7 +995,7 @@ int mail_menu(int socket, struct user_record *user) {
|
||||
subject = strdup(buffer);
|
||||
|
||||
// post a message
|
||||
msg = editor(socket, NULL, NULL);
|
||||
msg = editor(socket, user, NULL, NULL);
|
||||
|
||||
if (msg != NULL) {
|
||||
jb = open_jam_base(conf.email_path);
|
||||
@ -1217,7 +1232,7 @@ int mail_menu(int socket, struct user_record *user) {
|
||||
to = (char *)malloc(strlen(buffer) + 1);
|
||||
strcpy(to, buffer);
|
||||
|
||||
replybody = editor(socket, body, to);
|
||||
replybody = editor(socket, user, body, to);
|
||||
|
||||
if (replybody != NULL) {
|
||||
jb = open_jam_base(conf.email_path);
|
||||
|
Reference in New Issue
Block a user