Added user registration code

This commit is contained in:
Michiel Broek 2005-04-20 16:59:32 +00:00
parent f0da8b1384
commit b8d4951a15
10 changed files with 213 additions and 76 deletions

View File

@ -265,7 +265,7 @@ Command: CISC:1,pid; Check sysop in chatmode.
Reply: 100:1,1; Yes and drop into chatmode. Reply: 100:1,1; Yes and drop into chatmode.
100:1,0; No. 100:1,0; No.
Command: CCON:3,pid,username,n; Connect to chatserver with username. n=1 user is sysop. Command: CCON:4,pid,username,unixname,n; Connect to chatserver with username. n=1 user is sysop.
Reply: 100:1,error; Error with message. Reply: 100:1,error; Error with message.
100:0; Ok. 100:0; Ok.

View File

@ -1249,6 +1249,8 @@ struct sysconfig {
int priority; /* Child process priority */ int priority; /* Child process priority */
unsigned do_sync : 1; /* Sync() during execute */ unsigned do_sync : 1; /* Sync() during execute */
unsigned is_upgraded : 1; /* For internal upgrade use */ unsigned is_upgraded : 1; /* For internal upgrade use */
char myfqdn[64]; /* My real FQDN */
}; };

View File

@ -540,7 +540,7 @@ void Chat(int sysop)
rsize = lines - 7; rsize = lines - 7;
rpointer = 0; rpointer = 0;
sprintf(buf, "CCON,3,%d,%s,%s;", mypid, CFG.sysop, sysop ? "1":"0"); sprintf(buf, "CCON,4,%d,%s,%s,%s;", mypid, CFG.sysop_name, CFG.sysop, sysop ? "1":"0");
Syslog('-', "> %s", buf); Syslog('-', "> %s", buf);
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strcpy(buf, socket_receive());

View File

@ -194,7 +194,7 @@ void Chat(char *username, char *channel)
sprintf(buf, "%-*s", 79, " MBSE BBS Chat Server"); sprintf(buf, "%-*s", 79, " MBSE BBS Chat Server");
mvprintw(1, 1, buf); mvprintw(1, 1, buf);
sprintf(buf, "CCON,3,%d,%s,0;", mypid, exitinfo.Name); sprintf(buf, "CCON,4,%d,%s,%s,0;", mypid, exitinfo.sUserName, exitinfo.Name);
Syslog('c', "> %s", buf); Syslog('c', "> %s", buf);
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strncpy(buf, socket_receive(), sizeof(buf)-1); strncpy(buf, socket_receive(), sizeof(buf)-1);

View File

@ -131,43 +131,46 @@ void e_reginfo(void)
{ {
clr_index(); clr_index();
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
mbse_mvprintw( 5, 6, "1.2 EDIT REGISTRATION INFO"); mbse_mvprintw( 5, 2, "1.2 EDIT REGISTRATION INFO");
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
mbse_mvprintw( 7, 6, "1. System name"); mbse_mvprintw( 7, 2, "1. BBS name");
mbse_mvprintw( 8, 6, "2. Domain name"); mbse_mvprintw( 8, 2, "2. Maildomain");
mbse_mvprintw( 9, 6, "3. Sysop uid"); mbse_mvprintw( 9, 2, "3. Sysop uid");
mbse_mvprintw(10, 6, "4. Sysop Fido"); mbse_mvprintw(10, 2, "4. Sysop Fido");
mbse_mvprintw(11, 6, "5. Location"); mbse_mvprintw(11, 2, "5. Location");
mbse_mvprintw(12, 6, "6. QWK/Bluewave"); mbse_mvprintw(12, 2, "6. OLR id");
mbse_mvprintw(13, 6, "7. Comment"); mbse_mvprintw(13, 2, "7. Comment");
mbse_mvprintw(14, 6, "8. Origin line"); mbse_mvprintw(14, 2, "8. Origin");
mbse_mvprintw(15, 6, "9. Startup uid"); mbse_mvprintw(15, 2, "9. Newuser");
mbse_mvprintw(16, 2, "10. My FQDN");
for (;;) { for (;;) {
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
show_str( 7,25,35, CFG.bbs_name); show_str( 7,17,35, CFG.bbs_name);
show_str( 8,25,35, CFG.sysdomain); show_str( 8,17,35, CFG.sysdomain);
show_str( 9,25, 8, CFG.sysop); show_str( 9,17, 8, CFG.sysop);
show_str(10,25,35, CFG.sysop_name); show_str(10,17,35, CFG.sysop_name);
show_str(11,25,35, CFG.location); show_str(11,17,35, CFG.location);
show_str(12,25, 8, CFG.bbsid); show_str(12,17, 8, CFG.bbsid);
show_str(13,25,55, CFG.comment); show_str(13,17,55, CFG.comment);
show_str(14,25,50, CFG.origin); show_str(14,17,50, CFG.origin);
show_str(15,25, 8, CFG.startname); show_str(15,17, 8, CFG.startname);
show_str(16,17,63, CFG.myfqdn);
switch(select_menu(9)) { switch(select_menu(10)) {
case 0: return; case 0: return;
case 1: E_STR( 7,25,35, CFG.bbs_name, "Name of this ^BBS^ system") case 1: E_STR( 7,17,35, CFG.bbs_name, "Name of this ^BBS^ system")
case 2: E_STR( 8,25,35, CFG.sysdomain, "Internet ^mail domain^ name of this system") case 2: E_STR( 8,17,35, CFG.sysdomain, "Internet ^mail domain^ name of this system")
case 3: E_STR( 9,25, 8, CFG.sysop, "^Unix name^ of the sysop") case 3: E_STR( 9,17, 8, CFG.sysop, "^Unix name^ of the sysop")
case 4: E_STR(10,25,35, CFG.sysop_name, "^Fidonet name^ of the sysop") case 4: E_STR(10,17,35, CFG.sysop_name, "^Fidonet name^ of the sysop")
case 5: E_STR(11,25,35, CFG.location, "^Location^ (city) of this system") case 5: E_STR(11,17,35, CFG.location, "^Location^ (city/country) of this system")
case 6: E_UPS(12,25, 8, CFG.bbsid, "^QWK/Bluewave^ packets name") case 6: E_UPS(12,17, 8, CFG.bbsid, "^QWK/Bluewave^ packets name")
case 7: E_STR(13,25,55, CFG.comment, "Some ^comment^ you may like to give") case 7: E_STR(13,17,55, CFG.comment, "Some ^comment^ you may like to give")
case 8: E_STR(14,25,50, CFG.origin, "Default ^origin^ line under echomail messages") case 8: E_STR(14,17,50, CFG.origin, "Default ^origin^ line under echomail messages")
case 9: E_STR(15,25, 8, CFG.startname, "The ^Unix username^ that is used to start the bbs") case 9: E_STR(15,17, 8, CFG.startname, "The ^Unix username^ for new users that is used to start the bbs")
case 10:E_STR(16,17,63, CFG.myfqdn, "My real internet ^Full Qualified Domain Name^ or IP address if not in the DNS")
}
} }
};
} }

View File

@ -185,6 +185,7 @@ int AppendIBC(void)
sprintf(ffile, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/ibcsrv.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
memset(&ibcsrv, 0, sizeof(ibcsrv)); memset(&ibcsrv, 0, sizeof(ibcsrv));
strcpy(ibcsrv.myname, CFG.myfqdn);
fwrite(&ibcsrv, sizeof(ibcsrv), 1, fil); fwrite(&ibcsrv, sizeof(ibcsrv), 1, fil);
fclose(fil); fclose(fil);
IBCUpdated = 1; IBCUpdated = 1;

View File

@ -48,7 +48,8 @@ typedef enum {CH_FREE, CH_PRIVATE, CH_PUBLIC} CHANNELTYPE;
*/ */
typedef struct _ch_user_rec { typedef struct _ch_user_rec {
pid_t pid; /* User's pid */ pid_t pid; /* User's pid */
char name[36]; /* His name used (may become nick) */ char realname[36]; /* Real name */
char nick[10]; /* Nickname */
time_t connected; /* Time connected */ time_t connected; /* Time connected */
int channel; /* Connected channel or -1 */ int channel; /* Connected channel or -1 */
int pointer; /* Message pointer */ int pointer; /* Message pointer */
@ -110,7 +111,7 @@ _channel chat_channels[MAXCHANNELS];
int buffer_head = 0; /* Messages buffer head */ int buffer_head = 0; /* Messages buffer head */
extern struct sysconfig CFG; /* System configuration */ extern struct sysconfig CFG; /* System configuration */
extern int s_bbsopen; /* The BBS open status */ extern int s_bbsopen; /* The BBS open status */
extern srv_list *servers; /* Connected servers */
/* /*
@ -133,11 +134,11 @@ void chat_dump(void)
for (i = 0; i < MAXCLIENT; i++) for (i = 0; i < MAXCLIENT; i++)
if (chat_users[i].pid) { if (chat_users[i].pid) {
if (first) { if (first) {
Syslog('u', " pid username ch chats sysop"); Syslog('u', " pid username nick ch chats sysop");
Syslog('u', "----- ------------------------------------ -- ----- -----"); Syslog('u', "----- ------------------------------------ --------- -- ----- -----");
first = FALSE; first = FALSE;
} }
Syslog('u', "%5d %-36s %2d %s %s", chat_users[i].pid, chat_users[i].name, chat_users[i].channel, Syslog('u', "%5d %-36s %-9s %2d %s %s", chat_users[i].pid, chat_users[i].realname, chat_users[i].nick, chat_users[i].channel,
chat_users[i].chatting?"True ":"False", chat_users[i].sysop?"True ":"False"); chat_users[i].chatting?"True ":"False", chat_users[i].sysop?"True ":"False");
} }
first = TRUE; first = TRUE;
@ -221,7 +222,7 @@ int join(pid_t pid, char *channel, int sysop)
chat_users[j].chatting = TRUE; chat_users[j].chatting = TRUE;
Syslog('-', "Added user %d to channel %d", j, i); Syslog('-', "Added user %d to channel %d", j, i);
chat_dump(); chat_dump();
sprintf(buf, "%s has joined channel #%s, now %d users", chat_users[j].name, channel, chat_channels[i].users); sprintf(buf, "%s has joined channel #%s, now %d users", chat_users[j].nick, channel, chat_channels[i].users);
chat_msg(i, NULL, buf); chat_msg(i, NULL, buf);
return TRUE; return TRUE;
} }
@ -298,8 +299,8 @@ int part(pid_t pid, char *reason)
* Inform other users * Inform other users
*/ */
if (reason != NULL) if (reason != NULL)
chat_msg(chat_users[i].channel, chat_users[i].name, reason); chat_msg(chat_users[i].channel, chat_users[i].nick, reason);
sprintf(buf, "%s has left channel #%s, %d users left", chat_users[i].name, chat_channels[chat_users[i].channel].name, sprintf(buf, "%s has left channel #%s, %d users left", chat_users[i].nick, chat_channels[chat_users[i].channel].name,
chat_channels[chat_users[i].channel].users); chat_channels[chat_users[i].channel].users);
chat_msg(chat_users[i].channel, NULL, buf); chat_msg(chat_users[i].channel, NULL, buf);
@ -385,9 +386,10 @@ void chat_msg(int channel, char *nick, char *msg)
*/ */
char *chat_connect(char *data) char *chat_connect(char *data)
{ {
char *pid, *usr; char *pid, *realname, *nick;
static char buf[200]; static char buf[200];
int i, j, count = 0, sys = FALSE; int i, count = 0, sys = FALSE;
srv_list *sl;
Syslog('-', "CCON:%s", data); Syslog('-', "CCON:%s", data);
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
@ -412,27 +414,40 @@ char *chat_connect(char *data)
*/ */
pid = strtok(data, ","); /* Should be 3 */ pid = strtok(data, ","); /* Should be 3 */
pid = strtok(NULL, ","); /* The pid */ pid = strtok(NULL, ","); /* The pid */
usr = strtok(NULL, ","); /* Username */ realname = strtok(NULL, ","); /* Username */
nick = strtok(NULL, ","); /* Mickname */
sys = atoi(strtok(NULL, ";")); /* Sysop flag */ sys = atoi(strtok(NULL, ";")); /* Sysop flag */
chat_users[i].pid = atoi(pid); chat_users[i].pid = atoi(pid);
strncpy(chat_users[i].name, usr, 36); strncpy(chat_users[i].realname, realname, 36);
strncpy(chat_users[i].nick, nick, 9);
chat_users[i].connected = time(NULL); chat_users[i].connected = time(NULL);
chat_users[i].pointer = buffer_head; chat_users[i].pointer = buffer_head;
chat_users[i].channel = -1; chat_users[i].channel = -1;
chat_users[i].sysop = sys; chat_users[i].sysop = sys;
Syslog('-', "Connected user %s (%s) with chatserver, slot %d, sysop %s", usr, pid, i, sys ? "True":"False"); Syslog('-', "Connected user %s (%s) with chatserver, slot %d, sysop %s", realname, pid, i, sys ? "True":"False");
/*
* Register with IBC
*/
add_user(CFG.myfqdn, nick, realname);
sprintf(buf, "USER %s@%s 0 * :%s", nick, CFG.myfqdn, realname);
send_all(buf);
/* /*
* Now put welcome message into the ringbuffer and report success. * Now put welcome message into the ringbuffer and report success.
*/ */
sprintf(buf, "MBSE BBS v%s chat server; type /help for help", VERSION); sprintf(buf, "MBSE BBS v%s chat server; type /help for help", VERSION);
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
sprintf(buf, "Welcome to the %s chat network", CFG.bbs_name); sprintf(buf, "Welcome to the Internet BBS Chat Network");
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
for (j = 0; j < MAXCLIENT; j++) sprintf(buf, "Current connected servers:");
if (chat_users[j].pid) system_msg(chat_users[i].pid, buf);
count++; for (sl = servers; sl; sl = sl->next) {
sprintf(buf, " %s (%d user%s)", sl->fullname, sl->users, (sl->users == 1) ? "":"s");
system_msg(chat_users[i].pid, buf);
count += sl->users;
}
sprintf(buf, "There %s %d user%s connected", (count != 1)?"are":"is", count, (count != 1)?"s":""); sprintf(buf, "There %s %d user%s connected", (count != 1)?"are":"is", count, (count != 1)?"s":"");
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
@ -459,6 +474,10 @@ char *chat_close(char *data)
for (i = 0; i < MAXCLIENT; i++) { for (i = 0; i < MAXCLIENT; i++) {
if (chat_users[i].pid == atoi(pid)) { if (chat_users[i].pid == atoi(pid)) {
/*
* Remove from IBC network
*/
del_user(CFG.myfqdn, chat_users[i].realname);
Syslog('-', "Closing chat for pid %s, slot %d", pid, i); Syslog('-', "Closing chat for pid %s, slot %d", pid, i);
memset(&chat_users[i], 0, sizeof(_chat_users)); memset(&chat_users[i], 0, sizeof(_chat_users));
chat_users[i].channel = -1; chat_users[i].channel = -1;
@ -562,7 +581,7 @@ char *chat_put(char *data)
count = 0; count = 0;
for (j = 0; j < MAXCLIENT; j++) { for (j = 0; j < MAXCLIENT; j++) {
if ((chat_users[j].channel == chat_users[i].channel) && chat_users[j].pid) { if ((chat_users[j].channel == chat_users[i].channel) && chat_users[j].pid) {
sprintf(buf, "%s %s", chat_users[j].name, sprintf(buf, "%s %s", chat_users[j].nick,
chat_users[j].chanop ?"(chanop)": chat_users[j].sysop ?"(sysop)":""); chat_users[j].chanop ?"(chanop)": chat_users[j].sysop ?"(sysop)":"");
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
count++; count++;
@ -578,10 +597,10 @@ char *chat_put(char *data)
} else if (strncasecmp(msg, "/nick", 5) == 0) { } else if (strncasecmp(msg, "/nick", 5) == 0) {
cmd = strtok(msg, " \0"); cmd = strtok(msg, " \0");
cmd = strtok(NULL, "\0"); cmd = strtok(NULL, "\0");
if ((cmd == NULL) || (strlen(cmd) == 0) || (strlen(cmd) > 36)) { if ((cmd == NULL) || (strlen(cmd) == 0) || (strlen(cmd) > 9)) {
sprintf(buf, "** Nickname must be between 1 and 36 characters"); sprintf(buf, "** Nickname must be between 1 and 9 characters");
} else { } else {
strncpy(chat_users[i].name, cmd, 36); strncpy(chat_users[i].nick, cmd, 9);
sprintf(buf, "Nick set to \"%s\"", cmd); sprintf(buf, "Nick set to \"%s\"", cmd);
} }
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
@ -637,7 +656,7 @@ char *chat_put(char *data)
chat_dump(); chat_dump();
goto ack; goto ack;
} else { } else {
chat_msg(chat_users[i].channel, chat_users[i].name, msg); chat_msg(chat_users[i].channel, chat_users[i].nick, msg);
chat_dump(); chat_dump();
} }
goto ack; goto ack;

View File

@ -322,7 +322,7 @@ char *exe_cmd(char *in)
/* /*
* Connect to chatserver * Connect to chatserver
* *
* CCON:3,pid,username,n; Connect to chatserver with username, n=1 user is the sysop * CCON:4,pid,username,unixname,n; Connect to chatserver with username, n=1 user is the sysop
* 100:1,error; If error * 100:1,error; If error
* 100:0; Ok * 100:0; Ok
*/ */

View File

@ -45,6 +45,7 @@ time_t scfg_time = (time_t)0; /* Servers config time */
time_t now; /* Current time */ time_t now; /* Current time */
ncs_list *ncsl = NULL; /* Neighbours list */ ncs_list *ncsl = NULL; /* Neighbours list */
srv_list *servers = NULL; /* Active servers */ srv_list *servers = NULL; /* Active servers */
usr_list *users = NULL; /* Active users */
int ls; /* Listen socket */ int ls; /* Listen socket */
struct sockaddr_in myaddr_in; /* Listen socket address */ struct sockaddr_in myaddr_in; /* Listen socket address */
struct sockaddr_in clientaddr_in; /* Remote socket address */ struct sockaddr_in clientaddr_in; /* Remote socket address */
@ -52,6 +53,8 @@ int changed = FALSE; /* Databases changed */
char crbuf[512]; /* Chat receive buffer */ char crbuf[512]; /* Chat receive buffer */
char csbuf[512]; /* Chat send buffer */ char csbuf[512]; /* Chat send buffer */
int srvchg = FALSE; /* Is serverlist changed */ int srvchg = FALSE; /* Is serverlist changed */
int usrchg = FALSE; /* Is userlist changed */
pthread_mutex_t b_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t b_mutex = PTHREAD_MUTEX_INITIALIZER;
@ -66,12 +69,14 @@ static char *ncsstate[] = {
}; };
/* /*
* Internal prototypes * Internal prototypes
*/ */
void fill_ncslist(ncs_list **, char *, char *, char *); void fill_ncslist(ncs_list **, char *, char *, char *);
void dump_ncslist(void); void dump_ncslist(void);
void tidy_servers(srv_list **); void tidy_servers(srv_list **);
void del_userbyserver(usr_list **, char *);
void add_server(srv_list **, char *, int, char *, char *, char *, char *); void add_server(srv_list **, char *, int, char *, char *, char *, char *);
void del_server(srv_list **, char *); void del_server(srv_list **, char *);
void del_router(srv_list **, char *); void del_router(srv_list **, char *);
@ -132,6 +137,7 @@ void dump_ncslist(void)
{ {
ncs_list *tmp; ncs_list *tmp;
srv_list *srv; srv_list *srv;
usr_list *usrp;
if (!changed && !srvchg) if (!changed && !srvchg)
return; return;
@ -153,7 +159,17 @@ void dump_ncslist(void)
} }
} }
if (usrchg) {
Syslog('+', "IBC: Server User Nick Channel Cop Connect time");
Syslog('+', "IBC: ------------------------- ------------------------- --------- -------------------- --- --------------------");
for (usrp = users; usrp; usrp = usrp->next) {
Syslog('+', "IBC: %-25s %-25s %-9s %-20s %s %s", usrp->server, usrp->realname, usrp->nick, usrp->channel,
usrp->chanop ? "yes":"no ", rfcdate(usrp->connected));
}
}
srvchg = FALSE; srvchg = FALSE;
usrchg = FALSE;
changed = FALSE; changed = FALSE;
} }
@ -172,6 +188,99 @@ void tidy_servers(srv_list ** fdp)
/*
* Add one user to the userlist
*/
void add_user(char *server, char *nick, char *realname)
{
usr_list *tmp, *ta;
srv_list *sl;
int rc;
Syslog('r', "add_user %s %s %s", server, nick, realname);
for (ta = users; ta; ta = ta->next) {
if ((strcmp(ta->server, server) == 0) && (strcmp(ta->realname, realname) == 0)) {
Syslog('r', "duplicate, ignore");
return;
}
}
if ((rc = pthread_mutex_lock(&b_mutex)))
Syslog('!', "add_user() mutex_lock failed rc=%d", rc);
tmp = (usr_list *)malloc(sizeof(usr_list));
memset(tmp, 0, sizeof(tmp));
tmp->next = NULL;
strncpy(tmp->server, server, 63);
strncpy(tmp->nick, nick, 9);
strncpy(tmp->realname, realname, 36);
tmp->connected = now;
if (users == NULL) {
users = tmp;
} else {
for (ta = users; ta; ta = ta->next)
if (ta->next == NULL) {
ta->next = (usr_list *)tmp;
break;
}
}
for (sl = servers; sl; sl = sl->next) {
if (strcmp(sl->server, server) == 0) {
sl->users++;
srvchg = TRUE;
}
}
if ((rc = pthread_mutex_unlock(&b_mutex)))
Syslog('!', "add_user() mutex_unlock failed rc=%d", rc);
usrchg = TRUE;
}
/*
* Delete one user.
*/
void del_user(char *server, char *realname)
{
usr_list *ta, *tan;
srv_list *sl;
int rc;
Syslog('r', "deluser %s %s", server, realname);
if (users == NULL)
return;
if ((rc = pthread_mutex_lock(&b_mutex)))
Syslog('!', "del_user() mutex_lock failed rc=%d", rc);
for (ta = users; ta; ta = ta->next) {
while ((tan = ta->next) && (strcmp(tan->server, server) == 0) && (strcmp(tan->realname, realname) == 0)) {
ta->next = tan->next;
free(tan);
usrchg = TRUE;
}
ta->next = tan;
}
for (sl = servers; sl; sl = sl->next) {
if ((strcmp(sl->server, server) == 0) && sl->users) {
sl->users--;
srvchg = TRUE;
}
}
if ((rc = pthread_mutex_unlock(&b_mutex)))
Syslog('!', "del_user() mutex_unlock failed rc=%d", rc);
}
void add_server(srv_list **fdp, char *name, int hops, char *prod, char *vers, char *fullname, char *router) void add_server(srv_list **fdp, char *name, int hops, char *prod, char *vers, char *fullname, char *router)
{ {
srv_list *tmp, *ta; srv_list *tmp, *ta;
@ -212,7 +321,7 @@ void add_server(srv_list **fdp, char *name, int hops, char *prod, char *vers, ch
} }
if ((rc = pthread_mutex_unlock(&b_mutex))) if ((rc = pthread_mutex_unlock(&b_mutex)))
Syslog('!', "fill_ncslist() mutex_unlock failed rc=%d", rc); Syslog('!', "add_server() mutex_unlock failed rc=%d", rc);
srvchg = TRUE; srvchg = TRUE;
} }
@ -350,6 +459,13 @@ void check_servers(void)
if (file_time(scfgfn) != scfg_time) { if (file_time(scfgfn) != scfg_time) {
Syslog('r', "%s filetime changed, rereading"); Syslog('r', "%s filetime changed, rereading");
if (servers == NULL) {
/*
* First add this server name to the servers database.
*/
add_server(&servers, CFG.myfqdn, 0, (char *)"mbsebbs", (char *)VERSION, CFG.bbs_name, (char *)"none");
}
if ((fp = fopen(scfgfn, "r"))) { if ((fp = fopen(scfgfn, "r"))) {
fread(&ibcsrvhdr, sizeof(ibcsrvhdr), 1, fp); fread(&ibcsrvhdr, sizeof(ibcsrvhdr), 1, fp);
@ -367,13 +483,6 @@ void check_servers(void)
fill_ncslist(&ncsl, ibcsrv.server, ibcsrv.myname, ibcsrv.passwd); fill_ncslist(&ncsl, ibcsrv.server, ibcsrv.myname, ibcsrv.passwd);
changed = TRUE; changed = TRUE;
Syslog('+', "IBC: added Internet BBS Chatserver %s", ibcsrv.server); Syslog('+', "IBC: added Internet BBS Chatserver %s", ibcsrv.server);
if (servers == NULL) {
/*
* First add this server name to the servers database.
*/
add_server(&servers, ibcsrv.myname, 0, (char *)"mbsebbs",
(char *)VERSION, CFG.bbs_name, (char *)"none");
}
} }
} }
} }

View File

@ -40,7 +40,7 @@ typedef struct _srv_list {
time_t connected; /* Connection time */ time_t connected; /* Connection time */
char prod[21]; /* Product name */ char prod[21]; /* Product name */
char vers[21]; /* Version string */ char vers[21]; /* Version string */
char fullname[36]; /* Full BBS name */ char fullname[37]; /* Full BBS name */
int users; /* Users in chat */ int users; /* Users in chat */
} srv_list; } srv_list;
@ -52,8 +52,8 @@ typedef struct _srv_list {
typedef struct _usr_list { typedef struct _usr_list {
struct _usr_list *next; struct _usr_list *next;
char server[64]; /* FQDN of users server */ char server[64]; /* FQDN of users server */
char nick[9]; /* Users nick */ char nick[10]; /* Users nick */
char realname[36]; /* Users real name */ char realname[37]; /* Users real name */
char channel[21]; /* Users channel */ char channel[21]; /* Users channel */
time_t connected; /* Users connect time */ time_t connected; /* Users connect time */
unsigned chanop : 1; /* User is a chanop */ unsigned chanop : 1; /* User is a chanop */
@ -69,13 +69,16 @@ typedef struct _chn_list {
char server[64]; /* Originating server */ char server[64]; /* Originating server */
char name[21]; /* Channel name */ char name[21]; /* Channel name */
char topic[55]; /* Channel topic */ char topic[55]; /* Channel topic */
char owner[9]; /* Channel owner */ char owner[10]; /* Channel owner */
time_t created; /* Channel created */ time_t created; /* Channel created */
int users; /* Users in channel */ int users; /* Users in channel */
} chn_list; } chn_list;
void add_user(char *, char *, char *);
void del_user(char *, char *);
void send_all(char *); void send_all(char *);
void *ibc_thread(void *); void *ibc_thread(void *);