Added myname field

This commit is contained in:
Michiel Broek 2005-04-17 12:08:59 +00:00
parent 2abb002c3c
commit 3b0c70dadc
3 changed files with 29 additions and 20 deletions

View File

@ -232,21 +232,23 @@ int EditIBCRec(int Area)
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
mbse_mvprintw( 7, 2, "1. Comment"); mbse_mvprintw( 7, 2, "1. Comment");
mbse_mvprintw( 8, 2, "2. Server"); mbse_mvprintw( 8, 2, "2. Server");
mbse_mvprintw( 9, 2, "3. Password"); mbse_mvprintw( 9, 2, "3. Myname");
mbse_mvprintw(10, 2, "4. Active"); mbse_mvprintw(10, 2, "4. Password");
mbse_mvprintw(11, 2, "5. Deleted"); mbse_mvprintw(11, 2, "5. Active");
mbse_mvprintw(12, 2, "6. Compress"); mbse_mvprintw(12, 2, "6. Deleted");
mbse_mvprintw(13, 2, "7. Compress");
for (;;) { for (;;) {
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
show_str( 7,16,40, ibcsrv.comment); show_str( 7,16,40, ibcsrv.comment);
show_str( 8,16,63, ibcsrv.server); show_str( 8,16,63, ibcsrv.server);
show_str( 9,16,15, ibcsrv.passwd); show_str( 9,16,63, ibcsrv.myname);
show_bool(10,16, ibcsrv.Active); show_str( 10,16,15, ibcsrv.passwd);
show_bool(11,16, ibcsrv.Deleted); show_bool(11,16, ibcsrv.Active);
show_bool(12,16, ibcsrv.Compress); show_bool(12,16, ibcsrv.Deleted);
show_bool(13,16, ibcsrv.Compress);
j = select_menu(6); j = select_menu(7);
switch(j) { switch(j) {
case 0: crc1 = 0xffffffff; case 0: crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&ibcsrv, crc1, sizeof(ibcsrv)); crc1 = upd_crc32((char *)&ibcsrv, crc1, sizeof(ibcsrv));
@ -267,11 +269,12 @@ int EditIBCRec(int Area)
IsDoing("Browsing Menu"); IsDoing("Browsing Menu");
return 0; return 0;
case 1: E_STR( 7,16,40,ibcsrv.comment, "The ^Comment^ for this record") case 1: E_STR( 7,16,40,ibcsrv.comment, "The ^Comment^ for this record")
case 2: E_STR( 8,16,64,ibcsrv.server, "The internet ^name^ or ^IP^ address of the server") case 2: E_STR( 8,16,63,ibcsrv.server, "The known internet ^name^ or ^IP^ address of the remote server")
case 3: E_STR( 9,16,64,ibcsrv.passwd, "The ^password^ for this server") case 3: E_STR( 9,16,63,ibcsrv.myname, "The known internet ^name^ or ^IP^ address of this server")
case 4: E_BOOL(10,16, ibcsrv.Active, "Switch if this server is ^Active^ for chat") case 4: E_STR( 10,16,64,ibcsrv.passwd, "The ^password^ for this server")
case 5: E_BOOL(11,16, ibcsrv.Deleted, "Is this server to be ^Deleted^") case 5: E_BOOL(11,16, ibcsrv.Active, "Switch if this server is ^Active^ for chat")
case 6: E_BOOL(12,16, ibcsrv.Compress, "Use ^zlib compression^ with this server") case 6: E_BOOL(12,16, ibcsrv.Deleted, "Is this server to be ^Deleted^")
case 7: E_BOOL(13,16, ibcsrv.Compress, "Use ^zlib compression^ with this server")
} }
} }
@ -327,11 +330,13 @@ void EditIBC(void)
x = 42; x = 42;
y = 7; y = 7;
} }
if (ibcsrv.Active) if (ibcsrv.Deleted)
set_color(LIGHTRED, BLACK);
else if (ibcsrv.Active)
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
else else
set_color(LIGHTBLUE, BLACK); set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-32s", i, ibcsrv.comment); sprintf(temp, "%3d. %s (%s)", i, ibcsrv.server, ibcsrv.comment);
temp[37] = 0; temp[37] = 0;
mbse_mvprintw(y, x, temp); mbse_mvprintw(y, x, temp);
y++; y++;
@ -410,6 +415,7 @@ int ibc_doc(FILE *fp, FILE *toc, int page)
fprintf(wp, "<TBODY>\n"); fprintf(wp, "<TBODY>\n");
add_webtable(wp, (char *)"Server comment", ibcsrv.comment); add_webtable(wp, (char *)"Server comment", ibcsrv.comment);
add_webtable(wp, (char *)"Server address", ibcsrv.server); add_webtable(wp, (char *)"Server address", ibcsrv.server);
add_webtable(wp, (char *)"My address", ibcsrv.myname);
add_webtable(wp, (char *)"Active", getboolean(ibcsrv.Active)); add_webtable(wp, (char *)"Active", getboolean(ibcsrv.Active));
add_webtable(wp, (char *)"Compresion", getboolean(ibcsrv.Compress)); add_webtable(wp, (char *)"Compresion", getboolean(ibcsrv.Compress));
fprintf(wp, "</TBODY>\n"); fprintf(wp, "</TBODY>\n");
@ -419,6 +425,7 @@ int ibc_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Comment %s\n", ibcsrv.comment); fprintf(fp, " Comment %s\n", ibcsrv.comment);
fprintf(fp, " Server %s\n", ibcsrv.server); fprintf(fp, " Server %s\n", ibcsrv.server);
fprintf(fp, " My name %s\n", ibcsrv.myname);
fprintf(fp, " Active %s\n", getboolean(ibcsrv.Active)); fprintf(fp, " Active %s\n", getboolean(ibcsrv.Active));
fprintf(fp, " Compression %s\n", getboolean(ibcsrv.Compress)); fprintf(fp, " Compression %s\n", getboolean(ibcsrv.Compress));
fprintf(fp, "\n\n\n"); fprintf(fp, "\n\n\n");

View File

@ -59,8 +59,8 @@ static char *ncsstate[] = {
/* /*
* Add a port to the portlist * Add a port to the portlist
*/ */
void fill_ncslist(ncs_list **, char *, char *); void fill_ncslist(ncs_list **, char *, char *, char *);
void fill_ncslist(ncs_list **fdp, char *server, char *passwd) void fill_ncslist(ncs_list **fdp, char *server, char *myname, char *passwd)
{ {
ncs_list *tmp, *ta; ncs_list *tmp, *ta;
@ -68,6 +68,7 @@ void fill_ncslist(ncs_list **fdp, char *server, char *passwd)
memset(tmp, 0, sizeof(tmp)); memset(tmp, 0, sizeof(tmp));
tmp->next = NULL; tmp->next = NULL;
strncpy(tmp->server, server, 63); strncpy(tmp->server, server, 63);
strncpy(tmp->server, myname, 63);
strncpy(tmp->passwd, passwd, 15); strncpy(tmp->passwd, passwd, 15);
tmp->state = NCS_INIT; tmp->state = NCS_INIT;
tmp->action = time(NULL); tmp->action = time(NULL);
@ -166,7 +167,7 @@ void check_servers(void)
} }
if (!inlist ) { if (!inlist ) {
Syslog('r', " not in neighbour list, add"); Syslog('r', " not in neighbour list, add");
fill_ncslist(&ncsl, ibcsrv.server, ibcsrv.passwd); fill_ncslist(&ncsl, ibcsrv.server, ibcsrv.myname, ibcsrv.passwd);
changed = TRUE; changed = TRUE;
Syslog('+', "Added Internet BBS Chatserver %s", ibcsrv.server); Syslog('+', "Added Internet BBS Chatserver %s", ibcsrv.server);
} }
@ -262,7 +263,7 @@ void check_servers(void)
case NCS_CALL: Syslog('r', "%s call", tnsl->server); case NCS_CALL: Syslog('r', "%s call", tnsl->server);
sprintf(buf, "PASS %s 0000 IBC| %s\r", tnsl->passwd, tnsl->compress ? "Z":""); sprintf(buf, "PASS %s 0000 IBC| %s\r", tnsl->passwd, tnsl->compress ? "Z":"");
send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, buf); send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, buf);
sprintf(buf, "SERVER seaport 0 %ld mbsebbs v%s\r", tnsl->token, VERSION); sprintf(buf, "SERVER %s 0 %ld mbsebbs v%s\r", tnsl->myname, tnsl->token, VERSION);
send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, buf); send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, buf);
tnsl->action = now + (time_t)50; tnsl->action = now + (time_t)50;
tnsl->state = NCS_WAITPWD; tnsl->state = NCS_WAITPWD;

View File

@ -12,6 +12,7 @@
typedef struct _ncs_list { typedef struct _ncs_list {
struct _ncs_list *next; struct _ncs_list *next;
char server[64]; /* Server address */ char server[64]; /* Server address */
char myname[64]; /* My server address */
char passwd[16]; /* Server password */ char passwd[16]; /* Server password */
int state; /* Connection state */ int state; /* Connection state */
time_t action; /* Time for next action */ time_t action; /* Time for next action */