Made Internet BBS Chat final

This commit is contained in:
Michiel Broek 2005-08-11 10:46:08 +00:00
parent 809187e81a
commit abf46ab1d2
13 changed files with 17 additions and 521 deletions

View File

@ -6,10 +6,13 @@ v0.71.3 13-Jun-2005
upgrade: upgrade:
Check mbsetup 7.n.3.14 and 7.n.3.15 settings. Check mbsetup 7.n.3.14 and 7.n.3.15 settings.
You may limit the mailhistory.html by setting 1.15.8 You may limit the mailhistory.html by setting 1.15.8
See also the procedure for version 0.71.2 since now the chat
code is made final!
mbselib.a: mbselib.a:
Added a function to clean subject lines from garbage, trailing Added a function to clean subject lines from garbage, trailing
spaces etc. to improve message linking. spaces etc. to improve message linking.
Made Internet BBS Chat final.
mbcico: mbcico:
Added support for binkp GZ and BZ2 compression. Can be turned Added support for binkp GZ and BZ2 compression. Can be turned
@ -31,11 +34,18 @@ v0.71.3 13-Jun-2005
recreated for the external editors. recreated for the external editors.
The web stats can now limit the size of mailhistory.html The web stats can now limit the size of mailhistory.html
mbmon:
Made Internet BBS Chat final.
mbtask:
Made Internet BBS Chat final.
mbsetup: mbsetup:
Added setup switches per node to disable PLZ or GZ and BZ2 Added setup switches per node to disable PLZ or GZ and BZ2
compression protocols with binkp. compression protocols with binkp.
Added setup entry 1.15.8 to set a limit on the size of the Added setup entry 1.15.8 to set a limit on the size of the
mailer history html page. mailer history html page.
Made Internet BBS Chat final.
v0.71.2 16-Jan-2005 - 13-Jun-2005 v0.71.2 16-Jan-2005 - 13-Jun-2005

View File

@ -14,14 +14,15 @@
</HEAD> </HEAD>
<BODY> <BODY>
<BLOCKQUOTE> <BLOCKQUOTE>
<div align='right'><h5>Last update 08-May-2005</h5></div> <div align='right'><h5>Last update 11-Aug-2005</h5></div>
<div align='center'><H1>MBSE BBS Setup - Internet BBS Chat</H1></div> <div align='center'><H1>MBSE BBS Setup - Internet BBS Chat</H1></div>
<H3>Introduction.</H3> <H3>Introduction.</H3>
<P> <P>
MBSE BBS has the chat system that can be linked via internet, Internet BBS MBSE BBS has the chat system that can be linked via internet, Internet BBS
Chat using the protocol described in FSP-9999.999. With this setup you can Chat (IBC) using the protocol described in FSP-9999.999. With this setup you can
define other BBS systems to link with. define other BBS systems to link with. To use IBC with other systems you need to
make sure that UDP port 60179 is open on your firewall.
<P>&nbsp;<P> <P>&nbsp;<P>
<H3>Edit systems</H3> <H3>Edit systems</H3>

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS main library header * Purpose ...............: MBSE BBS main library header
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -2038,7 +2038,6 @@ struct _route {
/* /*
* IBC servers to connect to. * IBC servers to connect to.
*/ */
#ifdef USE_EXPERIMENT
struct _ibcsrvhdr { struct _ibcsrvhdr {
long hdrsize; /* Size of header */ long hdrsize; /* Size of header */
long recsize; /* Size of record */ long recsize; /* Size of record */
@ -2054,7 +2053,6 @@ struct _ibcsrv {
unsigned Deleted : 1; /* Must server be deleted */ unsigned Deleted : 1; /* Must server be deleted */
unsigned Compress : 1; /* Use compresssion */ unsigned Compress : 1; /* Use compresssion */
}; };
#endif
@ -2672,10 +2670,8 @@ struct _scanmgr scanmgr;
struct _routehdr routehdr; /* Routing file */ struct _routehdr routehdr; /* Routing file */
struct _route route; struct _route route;
#ifdef USE_EXPERIMENT
struct _ibcsrvhdr ibcsrvhdr; /* IBC servers */ struct _ibcsrvhdr ibcsrvhdr; /* IBC servers */
struct _ibcsrv ibcsrv; struct _ibcsrv ibcsrv;
#endif
#endif #endif

View File

@ -270,17 +270,11 @@ void system_stat(void)
hor_lin(13,45,8); hor_lin(13,45,8);
mbse_mvprintw(13,59, "Diskspace"); mbse_mvprintw(13,59, "Diskspace");
mbse_mvprintw(14, 6, "Client connects"); mbse_mvprintw(14, 6, "Client connects");
#ifdef USE_EXPERIMENT
mbse_mvprintw(14,59, "IBC servers"); mbse_mvprintw(14,59, "IBC servers");
#endif
mbse_mvprintw(15, 6, "Peak connections"); mbse_mvprintw(15, 6, "Peak connections");
#ifdef USE_EXPERIMENT
mbse_mvprintw(15,59, "IBC channels"); mbse_mvprintw(15,59, "IBC channels");
#endif
mbse_mvprintw(16, 6, "Protocol syntax errors"); mbse_mvprintw(16, 6, "Protocol syntax errors");
#ifdef USE_EXPERIMENT
mbse_mvprintw(16,59, "IBC users"); mbse_mvprintw(16,59, "IBC users");
#endif
mbse_mvprintw(17, 6, "Communication errors"); mbse_mvprintw(17, 6, "Communication errors");
mbse_mvprintw(19, 6, "Next sequence number"); mbse_mvprintw(19, 6, "Next sequence number");
mbse_mvprintw(lines -3,59, "Press any key"); mbse_mvprintw(lines -3,59, "Press any key");
@ -315,14 +309,10 @@ void system_stat(void)
mbse_mvprintw(10,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); mbse_mvprintw(10,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No ");
mbse_mvprintw(11,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); mbse_mvprintw(11,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No ");
mbse_mvprintw(12,72, "%s ", strtok(NULL, ",")); mbse_mvprintw(12,72, "%s ", strtok(NULL, ","));
#ifdef USE_EXPERIMENT
mbse_mvprintw(19,30, (char *)"%s", strtok(NULL, ",")); mbse_mvprintw(19,30, (char *)"%s", strtok(NULL, ","));
mbse_mvprintw(14,72, (char *)"%s ", strtok(NULL, ",")); mbse_mvprintw(14,72, (char *)"%s ", strtok(NULL, ","));
mbse_mvprintw(15,72, (char *)"%s ", strtok(NULL, ",")); mbse_mvprintw(15,72, (char *)"%s ", strtok(NULL, ","));
mbse_mvprintw(16,72, (char *)"%s ", strtok(NULL, ";")); mbse_mvprintw(16,72, (char *)"%s ", strtok(NULL, ";"));
#else
mbse_mvprintw(19,30, (char *)"%s", strtok(NULL, ";"));
#endif
} }
switch (enoughspace(CFG.freespace)) { switch (enoughspace(CFG.freespace)) {

View File

@ -38,7 +38,6 @@
#include "m_global.h" #include "m_global.h"
#include "m_ibc.h" #include "m_ibc.h"
#ifdef USE_EXPERIMENT
int IBCUpdated = 0; int IBCUpdated = 0;
@ -440,5 +439,4 @@ int ibc_doc(FILE *fp, FILE *toc, int page)
return page; return page;
} }
#endif

View File

@ -3,13 +3,11 @@
#ifndef _M_IBC_H #ifndef _M_IBC_H
#define _M_IBC_H #define _M_IBC_H
#ifdef USE_EXPERIMENT
int CountIBC(void); int CountIBC(void);
void EditIBC(void); void EditIBC(void);
void InitIBC(void); void InitIBC(void);
int ibc_doc(FILE *, FILE *, int); int ibc_doc(FILE *, FILE *, int);
#endif
#endif #endif

View File

@ -252,9 +252,7 @@ void site_docs(void)
fprintf(hp, " <LI><A HREF=\"domain.html\">Domain translation</A></LI>\n"); fprintf(hp, " <LI><A HREF=\"domain.html\">Domain translation</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"task.html\">Task Manager</A></LI>\n"); fprintf(hp, " <LI><A HREF=\"task.html\">Task Manager</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"route.html\">Network Routing</A></LI>\n"); fprintf(hp, " <LI><A HREF=\"route.html\">Network Routing</A></LI>\n");
#ifdef USE_EXPERIMENT
fprintf(hp, " <LI><A HREF=\"ibcsrv.html\">Internet BBS Chat</A></LI>\n"); fprintf(hp, " <LI><A HREF=\"ibcsrv.html\">Internet BBS Chat</A></LI>\n");
#endif
fprintf(hp, "</UL>\n"); fprintf(hp, "</UL>\n");
close_webdoc(hp); close_webdoc(hp);
} else { } else {
@ -298,10 +296,8 @@ void site_docs(void)
dotter(); dotter();
page = route_doc(fp, toc, page); page = route_doc(fp, toc, page);
dotter(); dotter();
#ifdef USE_EXPERIMENT
page = ibc_doc(fp, toc, page); page = ibc_doc(fp, toc, page);
dotter(); dotter();
#endif
users_doc(); users_doc();
dotter(); dotter();
ol_doc(); ol_doc();
@ -387,9 +383,7 @@ void initdatabases(void)
InitVirus(); InitVirus();
InitRoute(); InitRoute();
InitFDB(); InitFDB();
#ifdef USE_EXPERIMENT
InitIBC(); InitIBC();
#endif
if (!init) { if (!init) {
clr_index(); clr_index();
@ -478,9 +472,7 @@ int main(int argc, char *argv[])
mbse_mvprintw(12,46, "17. Edit Domains"); mbse_mvprintw(12,46, "17. Edit Domains");
mbse_mvprintw(13,46, "18. Edit Task Manager"); mbse_mvprintw(13,46, "18. Edit Task Manager");
mbse_mvprintw(14,46, "19. Edit Routing Table"); mbse_mvprintw(14,46, "19. Edit Routing Table");
#ifdef USE_EXPERIMENT
mbse_mvprintw(15,46, "20. Edit Internet BBS Chat"); mbse_mvprintw(15,46, "20. Edit Internet BBS Chat");
#endif
mbse_mvprintw(16,46, "21. Show software information"); mbse_mvprintw(16,46, "21. Show software information");
mbse_mvprintw(17,46, "22. Create site documents"); mbse_mvprintw(17,46, "22. Create site documents");
@ -545,11 +537,9 @@ int main(int argc, char *argv[])
case 19: case 19:
EditRoute(); EditRoute();
break; break;
#ifdef USE_EXPERIMENT
case 20: case 20:
EditIBC(); EditIBC();
break; break;
#endif
case 21: case 21:
soft_info(); soft_info();
break; break;

View File

@ -115,9 +115,7 @@ extern int cmd_run; /* Cmd running */
extern int ping_run; /* Ping running */ extern int ping_run; /* Ping running */
int sched_run = FALSE; /* Scheduler running */ int sched_run = FALSE; /* Scheduler running */
extern int disk_run; /* Disk watch running */ extern int disk_run; /* Disk watch running */
#ifdef USE_EXPERIMENT
extern int ibc_run; /* IBC thread running */ extern int ibc_run; /* IBC thread running */
#endif
/* /*
@ -127,9 +125,7 @@ pthread_t pt_ping;
pthread_t pt_command; pthread_t pt_command;
pthread_t pt_disk; pthread_t pt_disk;
pthread_t pt_scheduler; pthread_t pt_scheduler;
#ifdef USE_EXPERIMENT
pthread_t pt_ibc; pthread_t pt_ibc;
#endif
@ -745,18 +741,10 @@ void die(int onsig)
* build to stop within a second. * build to stop within a second.
*/ */
now = time(NULL) + 2; now = time(NULL) + 2;
#ifdef USE_EXPERIMENT
while ((cmd_run || ping_run || sched_run || disk_run || ibc_run) && (time(NULL) < now)) { while ((cmd_run || ping_run || sched_run || disk_run || ibc_run) && (time(NULL) < now)) {
#else
while ((cmd_run || ping_run || sched_run || disk_run) && (time(NULL) < now)) {
#endif
sleep(1); sleep(1);
} }
#ifdef USE_EXPERIMENT
if (cmd_run || ping_run || sched_run || disk_run || ibc_run) if (cmd_run || ping_run || sched_run || disk_run || ibc_run)
#else
if (cmd_run || ping_run || sched_run || disk_run)
#endif
Syslog('+', "Not all threads stopped! Forced shutdown"); Syslog('+', "Not all threads stopped! Forced shutdown");
else else
Syslog('+', "All threads stopped"); Syslog('+', "All threads stopped");
@ -1047,11 +1035,9 @@ void start_scheduler(void)
} else if ((rc = pthread_create(&pt_scheduler, NULL, (void (*))scheduler, NULL))) { } else if ((rc = pthread_create(&pt_scheduler, NULL, (void (*))scheduler, NULL))) {
WriteError("$pthread_create scheduler rc=%d", rc); WriteError("$pthread_create scheduler rc=%d", rc);
die(SIGTERM); die(SIGTERM);
#ifdef USE_EXPERIMENT
} else if ((rc = pthread_create(&pt_ibc, NULL, (void (*))ibc_thread, NULL))) { } else if ((rc = pthread_create(&pt_ibc, NULL, (void (*))ibc_thread, NULL))) {
WriteError("$pthread_create ibc rc=%d", rc); WriteError("$pthread_create ibc rc=%d", rc);
die(SIGTERM); die(SIGTERM);
#endif
} else { } else {
Syslog('+', "All threads installed"); Syslog('+', "All threads installed");
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: mbtask - chat server * Purpose ...............: mbtask - chat server
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -36,33 +36,10 @@
#include "taskibc.h" #include "taskibc.h"
#ifndef USE_EXPERIMENT
#define MAXCHANNELS 10 /* Maximum chat channels */
#endif
#define MAXMESSAGES 100 /* Maximum ringbuffer for messages */ #define MAXMESSAGES 100 /* Maximum ringbuffer for messages */
/*
* Users connected to the chatserver.
*/
#ifndef USE_EXPERIMENT
typedef struct _ch_user_rec {
pid_t pid; /* User's pid */
char realname[36]; /* Real name */
char name[10]; /* Unix name */
char nick[10]; /* Nickname */
time_t connected; /* Time connected */
int channel; /* Connected channel or -1 */
int pointer; /* Message pointer */
unsigned chatting : 1; /* Is chatting in a channel */
unsigned chanop : 1; /* Is a chanop */
unsigned sysop : 1; /* User is sysop in channel #sysop */
} _chat_users;
#endif
/* /*
* Buffer for messages, this is the structure of a ringbuffer which will * Buffer for messages, this is the structure of a ringbuffer which will
* hold all messages, private public etc. There is one global input pointer * hold all messages, private public etc. There is one global input pointer
@ -79,36 +56,15 @@ typedef struct _chatmsg {
/*
* List of channels
*/
#ifndef USE_EXPERIMENT
typedef struct _channel_rec {
char name[21]; /* Channel name */
char topic[55]; /* Channel topic */
pid_t owner; /* Channel owner */
int users; /* Users in channel */
time_t created; /* Creation time */
unsigned active : 1; /* Channel active */
} _channel;
#endif
/* /*
* The buffers * The buffers
*/ */
_chat_messages chat_messages[MAXMESSAGES]; _chat_messages chat_messages[MAXMESSAGES];
#ifndef USE_EXPERIMENT
_chat_users chat_users[MAXCLIENT];
_channel chat_channels[MAXCHANNELS];
#endif
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 */
#ifdef USE_EXPERIMENT
extern srv_list *servers; /* Connected servers */ extern srv_list *servers; /* Connected servers */
extern usr_list *users; /* Connected users */ extern usr_list *users; /* Connected users */
extern chn_list *channels; /* Connected channels */ extern chn_list *channels; /* Connected channels */
@ -116,7 +72,6 @@ extern int usrchg;
extern int chnchg; extern int chnchg;
extern int srvchg; extern int srvchg;
extern pthread_mutex_t b_mutex; extern pthread_mutex_t b_mutex;
#endif
/* /*
@ -133,15 +88,9 @@ int part(pid_t, char*);
void chat_dump(void) void chat_dump(void)
{ {
int first; int first;
#ifdef USE_EXPERIMENT
usr_list *tmpu; usr_list *tmpu;
#else
int i;
#endif
first = TRUE; first = TRUE;
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) { for (tmpu = users; tmpu; tmpu = tmpu->next) {
if (tmpu->pid) { if (tmpu->pid) {
if (first) { if (first) {
@ -153,31 +102,6 @@ void chat_dump(void)
tmpu->channel, tmpu->sysop?"True ":"False"); tmpu->channel, tmpu->sysop?"True ":"False");
} }
} }
#else
for (i = 0; i < MAXCLIENT; i++) {
if (chat_users[i].pid) {
if (first) {
Syslog('u', " pid username nick ch chats sysop");
Syslog('u', "----- ------------------------------------ --------- -- ----- -----");
first = FALSE;
}
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");
}
}
first = TRUE;
for (i = 0; i < MAXCHANNELS; i++) {
if (chat_channels[i].owner) {
if (first) {
Syslog('c', "channel name owner cnt activ");
Syslog('c', "-------------------- ----- --- -----");
first = FALSE;
}
Syslog('c', "%-20s %5d %3d %s", chat_channels[i].name, chat_channels[i].owner, chat_channels[i].users,
chat_channels[i].active?"True":"False");
}
}
#endif
} }
@ -209,27 +133,16 @@ void system_shout(const char *format, ...)
{ {
char buf[512]; char buf[512];
va_list va_ptr; va_list va_ptr;
#ifdef USE_EXPERIMENT
usr_list *tmpu; usr_list *tmpu;
#else
int i;
#endif
va_start(va_ptr, format); va_start(va_ptr, format);
vsprintf(buf, format, va_ptr); vsprintf(buf, format, va_ptr);
va_end(va_ptr); va_end(va_ptr);
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) for (tmpu = users; tmpu; tmpu = tmpu->next)
if (tmpu->pid) { if (tmpu->pid) {
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
} }
#else
for (i = 0; i < MAXCLIENT; i++)
if (chat_users[i].pid) {
system_msg(chat_users[i].pid, buf);
}
#endif
} }
@ -265,16 +178,11 @@ void chat_help(pid_t pid)
int join(pid_t pid, char *channel, int sysop) int join(pid_t pid, char *channel, int sysop)
{ {
char buf[81]; char buf[81];
#ifdef USE_EXPERIMENT
chn_list *tmp; chn_list *tmp;
usr_list *tmpu; usr_list *tmpu;
#else
int i, j;
#endif
Syslog('-', "Join pid %d to channel %s", pid, channel); Syslog('-', "Join pid %d to channel %s", pid, channel);
#ifdef USE_EXPERIMENT
if (channels) { if (channels) {
for (tmp = channels; tmp; tmp = tmp->next) { for (tmp = channels; tmp; tmp = tmp->next) {
if (strcmp(tmp->name, channel) == 0) { if (strcmp(tmp->name, channel) == 0) {
@ -305,36 +213,11 @@ int join(pid_t pid, char *channel, int sysop)
} }
} }
} }
#else
for (i = 0; i < MAXCHANNELS; i++) {
if (strcasecmp(chat_channels[i].name, channel) == 0) {
/*
* Existing channel, add user to channel.
*/
chat_channels[i].users++;
for (j = 0; j < MAXCLIENT; j++) {
if (chat_users[j].pid == pid) {
chat_users[j].channel = i;
chat_users[j].chatting = TRUE;
Syslog('-', "Added user %d to channel %d", j, i);
chat_dump();
sprintf(buf, "%s has joined channel #%s, now %d users", chat_users[j].nick, channel, chat_channels[i].users);
chat_msg(i, NULL, buf);
return TRUE;
}
}
}
}
#endif
/* /*
* A new channel must be created, but only the sysop may create the "sysop" channel * A new channel must be created, but only the sysop may create the "sysop" channel
*/ */
#ifdef USE_EXPERIMENT
if (!sysop && (strcasecmp(channel, "#sysop") == 0)) { if (!sysop && (strcasecmp(channel, "#sysop") == 0)) {
#else
if (!sysop && (strcasecmp(channel, "sysop") == 0)) {
#endif
sprintf(buf, "*** Only the sysop may create channel \"%s\"", channel); sprintf(buf, "*** Only the sysop may create channel \"%s\"", channel);
system_msg(pid, buf); system_msg(pid, buf);
return FALSE; return FALSE;
@ -343,7 +226,6 @@ int join(pid_t pid, char *channel, int sysop)
/* /*
* No matching channel found, add a new channel. * No matching channel found, add a new channel.
*/ */
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) { for (tmpu = users; tmpu; tmpu = tmpu->next) {
if (tmpu->pid == pid) { if (tmpu->pid == pid) {
if (add_channel(&channels, channel, tmpu->nick, CFG.myfqdn) == 0) { if (add_channel(&channels, channel, tmpu->nick, CFG.myfqdn) == 0) {
@ -366,35 +248,6 @@ int join(pid_t pid, char *channel, int sysop)
} }
} }
} }
#else
for (i = 0; i < MAXCHANNELS; i++) {
if (chat_channels[i].active == FALSE) {
/*
* Got one, register channel.
*/
strncpy(chat_channels[i].name, channel, 20);
chat_channels[i].owner = pid;
chat_channels[i].users = 1;
chat_channels[i].created = time(NULL);
chat_channels[i].active = TRUE;
Syslog('-', "Created channel %d", i);
/*
* Register user to channel
*/
for (j = 0; j < MAXCLIENT; j++) {
if (chat_users[j].pid == pid) {
chat_users[j].channel = i;
chat_users[j].chatting = TRUE;
Syslog('-', "Added user %d to channel %d", j, i);
sprintf(buf, "Created channel #%s", channel);
chat_msg(i, NULL, buf);
}
}
chat_dump();
return TRUE;
}
}
#endif
/* /*
* No matching or free channels * No matching or free channels
@ -413,19 +266,14 @@ int join(pid_t pid, char *channel, int sysop)
int part(pid_t pid, char *reason) int part(pid_t pid, char *reason)
{ {
char buf[81]; char buf[81];
#ifdef USE_EXPERIMENT
chn_list *tmp; chn_list *tmp;
usr_list *tmpu; usr_list *tmpu;
#else
int i;
#endif
if (strlen(reason) > 54) if (strlen(reason) > 54)
reason[54] = '\0'; reason[54] = '\0';
Syslog('-', "Part pid %d from channel, reason %s", pid, reason); Syslog('-', "Part pid %d from channel, reason %s", pid, reason);
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) { for (tmpu = users; tmpu; tmpu = tmpu->next) {
if ((tmpu->pid == pid) && strlen(tmpu->channel)) { if ((tmpu->pid == pid) && strlen(tmpu->channel)) {
for (tmp = channels; tmp; tmp = tmp->next) { for (tmp = channels; tmp; tmp = tmp->next) {
@ -477,38 +325,6 @@ int part(pid_t pid, char *reason)
} }
} }
} }
#else
for (i = 0; i < MAXCLIENT; i++) {
if ((chat_users[i].pid == pid) && chat_users[i].chatting) {
chat_channels[chat_users[i].channel].users--;
/*
* Inform other users
*/
if (reason != NULL)
chat_msg(chat_users[i].channel, chat_users[i].nick, reason);
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_msg(chat_users[i].channel, NULL, buf);
/*
* First clean channel
*/
Syslog('-', "User leaves channel %s", chat_channels[chat_users[i].channel].name);
if (chat_channels[chat_users[i].channel].users == 0) {
/*
* Last user from channel, clear channel
*/
Syslog('-', "Remove channel %s, no more users left", chat_channels[chat_users[i].channel].name);
memset(&chat_channels[chat_users[i].channel], 0, sizeof(_channel));
}
chat_users[i].channel = -1;
chat_users[i].chatting = FALSE;
chat_dump();
return TRUE;
}
}
#endif
return FALSE; return FALSE;
} }
@ -517,14 +333,6 @@ int part(pid_t pid, char *reason)
void chat_init(void) void chat_init(void)
{ {
#ifndef USE_EXPERIMENT
int i;
for (i = 0; i < MAXCLIENT; i++)
chat_users[i].channel = -1;
memset(&chat_channels, 0, sizeof(chat_channels));
memset(&chat_users, 0, sizeof(chat_users));
#endif
memset(&chat_messages, 0, sizeof(chat_messages)); memset(&chat_messages, 0, sizeof(chat_messages));
} }
@ -540,7 +348,6 @@ void chat_cleanuser(pid_t pid)
/* /*
* Send message into channel * Send message into channel
*/ */
#ifdef USE_EXPERIMENT
void chat_msg(char *channel, char *nick, char *msg) void chat_msg(char *channel, char *nick, char *msg)
{ {
char buf[128], *logm; char buf[128], *logm;
@ -565,32 +372,6 @@ void chat_msg(char *channel, char *nick, char *msg)
} }
} }
} }
#else
void chat_msg(int channel, char *nick, char *msg)
{
int i;
char buf[128], *logm;
if (nick == NULL)
sprintf(buf, "%s", msg);
else
sprintf(buf, "<%s> %s", nick, msg);
if (CFG.iAutoLog && strlen(CFG.chat_log)) {
logm = calloc(PATH_MAX, sizeof(char));
sprintf(logm, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
ulog(logm, (char *)"+", chat_channels[channel].name, (char *)"-1", buf);
free(logm);
}
buf[79] = '\0';
for (i = 0; i < MAXCLIENT; i++) {
if ((chat_users[i].channel == channel) && chat_users[i].chatting) {
system_msg(chat_users[i].pid, buf);
}
}
}
#endif
@ -602,12 +383,8 @@ char *chat_connect(char *data)
char *pid, *realname, *nick; char *pid, *realname, *nick;
static char buf[200]; static char buf[200];
int count = 0, sys = FALSE; int count = 0, sys = FALSE;
#ifdef USE_EXPERIMENT
srv_list *sl; srv_list *sl;
usr_list *tmpu; usr_list *tmpu;
#else
int i;
#endif
Syslog('-', "CCON:%s", data); Syslog('-', "CCON:%s", data);
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
@ -622,7 +399,6 @@ char *chat_connect(char *data)
return buf; return buf;
} }
#ifdef USE_EXPERIMENT
/* /*
* Register with IBC * Register with IBC
*/ */
@ -673,46 +449,6 @@ char *chat_connect(char *data)
} }
} }
#else
/*
* Search free userslot
*/
for (i = 0; i < MAXCLIENT; i++) {
if (chat_users[i].pid == 0) {
/*
* Oke, found
*/
pid = strtok(data, ","); /* Should be 3 */
pid = strtok(NULL, ","); /* The pid */
realname = strtok(NULL, ","); /* Username */
nick = strtok(NULL, ","); /* Mickname */
sys = atoi(strtok(NULL, ";")); /* Sysop flag */
chat_users[i].pid = atoi(pid);
strncpy(chat_users[i].realname, realname, 36);
strncpy(chat_users[i].nick, nick, 9);
strncpy(chat_users[i].name, nick, 9);
chat_users[i].connected = time(NULL);
chat_users[i].pointer = buffer_head;
chat_users[i].channel = -1;
chat_users[i].sysop = sys;
Syslog('-', "Connected user %s (%s) with chatserver, slot %d, sysop %s", realname, pid, i, sys ? "True":"False");
/*
* Now put welcome message into the ringbuffer and report success.
*/
sprintf(buf, "MBSE BBS v%s chat server; type /help for help", VERSION);
system_msg(chat_users[i].pid, buf);
sprintf(buf, "Welcome to the Internet BBS Chat Network");
system_msg(chat_users[i].pid, buf);
sprintf(buf, "There %s %d user%s connected", (count != 1)?"are":"is", count, (count != 1)?"s":"");
system_msg(chat_users[i].pid, buf);
sprintf(buf, "100:0;");
return buf;
}
}
#endif
sprintf(buf, "100:1,Too many users connected;"); sprintf(buf, "100:1,Too many users connected;");
return buf; return buf;
} }
@ -723,18 +459,13 @@ char *chat_close(char *data)
{ {
static char buf[200]; static char buf[200];
char *pid; char *pid;
#ifdef USE_EXPERIMENT
usr_list *tmpu; usr_list *tmpu;
#else
int i;
#endif
Syslog('-', "CCLO:%s", data); Syslog('-', "CCLO:%s", data);
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
pid = strtok(data, ","); pid = strtok(data, ",");
pid = strtok(NULL, ";"); pid = strtok(NULL, ";");
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) { for (tmpu = users; tmpu; tmpu = tmpu->next) {
if (tmpu->pid == atoi(pid)) { if (tmpu->pid == atoi(pid)) {
/* /*
@ -747,20 +478,6 @@ char *chat_close(char *data)
return buf; return buf;
} }
} }
#else
for (i = 0; i < MAXCLIENT; i++) {
if (chat_users[i].pid == atoi(pid)) {
/*
* Remove from IBC network
*/
Syslog('-', "Closing chat for pid %s, slot %d", pid, i);
memset(&chat_users[i], 0, sizeof(_chat_users));
chat_users[i].channel = -1;
sprintf(buf, "100:0;");
return buf;
}
}
#endif
Syslog('-', "Pid %s was not connected to chatserver"); Syslog('-', "Pid %s was not connected to chatserver");
sprintf(buf, "100:1,*** ERROR - Not connected to server;"); sprintf(buf, "100:1,*** ERROR - Not connected to server;");
return buf; return buf;
@ -773,14 +490,10 @@ char *chat_put(char *data)
static char buf[200]; static char buf[200];
char *pid, *msg, *cmd; char *pid, *msg, *cmd;
int first, count; int first, count;
#ifdef USE_EXPERIMENT
int found; int found;
usr_list *tmpu, *tmp; usr_list *tmpu, *tmp;
chn_list *tmpc; chn_list *tmpc;
char temp[81]; char temp[81];
#else
int i, j;
#endif
Syslog('-', "CPUT:%s", data); Syslog('-', "CPUT:%s", data);
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
@ -800,13 +513,8 @@ char *chat_put(char *data)
msg = strtok(NULL, "\0"); msg = strtok(NULL, "\0");
msg[strlen(msg)-1] = '\0'; msg[strlen(msg)-1] = '\0';
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) { for (tmpu = users; tmpu; tmpu = tmpu->next) {
if (tmpu->pid == atoi(pid)) { if (tmpu->pid == atoi(pid)) {
#else
for (i = 0; i < MAXCLIENT; i++) {
if (chat_users[i].pid == atoi(pid)) {
#endif
if (msg[0] == '/') { if (msg[0] == '/') {
/* /*
* A command, process this * A command, process this
@ -816,24 +524,14 @@ char *chat_put(char *data)
goto ack; goto ack;
} else if (strncasecmp(msg, "/echo", 5) == 0) { } else if (strncasecmp(msg, "/echo", 5) == 0) {
sprintf(buf, "%s", msg); sprintf(buf, "%s", msg);
#ifdef USE_EXPERIMENT
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
system_msg(chat_users[i].pid, buf);
#endif
goto ack; goto ack;
} else if ((strncasecmp(msg, "/exit", 5) == 0) || } else if ((strncasecmp(msg, "/exit", 5) == 0) ||
(strncasecmp(msg, "/quit", 5) == 0) || (strncasecmp(msg, "/quit", 5) == 0) ||
(strncasecmp(msg, "/bye", 4) == 0)) { (strncasecmp(msg, "/bye", 4) == 0)) {
#ifdef USE_EXPERIMENT
part(tmpu->pid, (char *)"Quitting"); part(tmpu->pid, (char *)"Quitting");
sprintf(buf, "Goodbye"); sprintf(buf, "Goodbye");
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
part(chat_users[i].pid, (char *)"Quitting");
sprintf(buf, "Goodbye");
system_msg(chat_users[i].pid, buf);
#endif
goto hangup; goto hangup;
} else if ((strncasecmp(msg, "/join", 5) == 0) || } else if ((strncasecmp(msg, "/join", 5) == 0) ||
(strncasecmp(msg, "/j ", 3) == 0)) { (strncasecmp(msg, "/j ", 3) == 0)) {
@ -841,7 +539,6 @@ char *chat_put(char *data)
Syslog('-', "\"%s\"", cmd); Syslog('-', "\"%s\"", cmd);
cmd = strtok(NULL, "\0"); cmd = strtok(NULL, "\0");
Syslog('-', "\"%s\"", cmd); Syslog('-', "\"%s\"", cmd);
#ifdef USE_EXPERIMENT
if ((cmd == NULL) || (cmd[0] != '#') || (strcmp(cmd, "#") == 0)) { if ((cmd == NULL) || (cmd[0] != '#') || (strcmp(cmd, "#") == 0)) {
sprintf(buf, "** Try /join #channel"); sprintf(buf, "** Try /join #channel");
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
@ -852,23 +549,10 @@ char *chat_put(char *data)
Syslog('-', "Trying to join channel %s", cmd); Syslog('-', "Trying to join channel %s", cmd);
join(tmpu->pid, cmd, tmpu->sysop); join(tmpu->pid, cmd, tmpu->sysop);
} }
#else
if ((cmd == NULL) || (cmd[0] != '#') || (strcmp(cmd, "#") == 0)) {
sprintf(buf, "** Try /join #channel");
system_msg(chat_users[i].pid, buf);
} else if (chat_users[i].channel != -1) {
sprintf(buf, "** Cannot join while in a channel");
system_msg(chat_users[i].pid, buf);
} else {
Syslog('-', "Trying to join channel %s", cmd);
join(chat_users[i].pid, cmd+1, chat_users[i].sysop);
}
#endif
chat_dump(); chat_dump();
goto ack; goto ack;
} else if (strncasecmp(msg, "/list", 5) == 0) { } else if (strncasecmp(msg, "/list", 5) == 0) {
first = TRUE; first = TRUE;
#ifdef USE_EXPERIMENT
for (tmpc = channels; tmpc; tmpc = tmpc->next) { for (tmpc = channels; tmpc; tmpc = tmpc->next) {
if (first) { if (first) {
sprintf(buf, "Cnt Channel name Channel topic"); sprintf(buf, "Cnt Channel name Channel topic");
@ -879,32 +563,13 @@ char *chat_put(char *data)
first = FALSE; first = FALSE;
sprintf(buf, "%3d %-20s %-54s", tmpc->users, tmpc->name, tmpc->topic); sprintf(buf, "%3d %-20s %-54s", tmpc->users, tmpc->name, tmpc->topic);
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
for (j = 0; j < MAXCHANNELS; j++) {
if (chat_channels[j].owner && chat_channels[j].active) {
if (first) {
sprintf(buf, "Cnt Channel name Channel topic");
system_msg(chat_users[i].pid, buf);
sprintf(buf, "--- -------------------- ------------------------------------------------------");
system_msg(chat_users[i].pid, buf);
}
first = FALSE;
sprintf(buf, "%3d %-20s %-54s", chat_channels[j].users, chat_channels[j].name, chat_channels[j].topic);
system_msg(chat_users[i].pid, buf);
}
#endif
} }
if (first) { if (first) {
sprintf(buf, "No active channels to list"); sprintf(buf, "No active channels to list");
#ifdef USE_EXPERIMENT
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
system_msg(chat_users[i].pid, buf);
#endif
} }
goto ack; goto ack;
} else if (strncasecmp(msg, "/names", 6) == 0) { } else if (strncasecmp(msg, "/names", 6) == 0) {
#ifdef USE_EXPERIMENT
if (strlen(tmpu->channel)) { if (strlen(tmpu->channel)) {
sprintf(buf, "Present in channel %s:", tmpu->channel); sprintf(buf, "Present in channel %s:", tmpu->channel);
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
@ -928,26 +593,6 @@ char *chat_put(char *data)
sprintf(buf, "** Not in a channel"); sprintf(buf, "** Not in a channel");
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
} }
#else
if (chat_users[i].channel != -1) {
sprintf(buf, "Present in this channel:");
system_msg(chat_users[i].pid, buf);
count = 0;
for (j = 0; j < MAXCLIENT; j++) {
if ((chat_users[j].channel == chat_users[i].channel) && chat_users[j].pid) {
sprintf(buf, "%s %s", chat_users[j].nick,
chat_users[j].chanop ?"(chanop)": chat_users[j].sysop ?"(sysop)":"");
system_msg(chat_users[i].pid, buf);
count++;
}
}
sprintf(buf, "%d user%s in this channel", count, (count == 1) ?"":"s");
system_msg(chat_users[i].pid, buf);
} else {
sprintf(buf, "** Not in a channel");
system_msg(chat_users[i].pid, buf);
}
#endif
goto ack; goto ack;
} else if (strncasecmp(msg, "/nick", 5) == 0) { } else if (strncasecmp(msg, "/nick", 5) == 0) {
cmd = strtok(msg, " \0"); cmd = strtok(msg, " \0");
@ -955,7 +600,6 @@ char *chat_put(char *data)
if ((cmd == NULL) || (strlen(cmd) == 0) || (strlen(cmd) > 9)) { if ((cmd == NULL) || (strlen(cmd) == 0) || (strlen(cmd) > 9)) {
sprintf(buf, "** Nickname must be between 1 and 9 characters"); sprintf(buf, "** Nickname must be between 1 and 9 characters");
} else { } else {
#ifdef USE_EXPERIMENT
found = FALSE; found = FALSE;
for (tmp = users; tmp; tmp = tmp->next) { for (tmp = users; tmp; tmp = tmp->next) {
if ((strcmp(tmp->name, cmd) == 0) || (strcmp(tmp->nick, cmd) == 0)) { if ((strcmp(tmp->name, cmd) == 0) || (strcmp(tmp->nick, cmd) == 0)) {
@ -975,12 +619,6 @@ char *chat_put(char *data)
sprintf(buf, "Can't set nick"); sprintf(buf, "Can't set nick");
} }
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
strncpy(chat_users[i].nick, cmd, 9);
sprintf(buf, "Nick set to \"%s\"", cmd);
}
system_msg(chat_users[i].pid, buf);
#endif
chat_dump(); chat_dump();
goto ack; goto ack;
} else if (strncasecmp(msg, "/part", 5) == 0) { } else if (strncasecmp(msg, "/part", 5) == 0) {
@ -988,21 +626,13 @@ char *chat_put(char *data)
Syslog('-', "\"%s\"", cmd); Syslog('-', "\"%s\"", cmd);
cmd = strtok(NULL, "\0"); cmd = strtok(NULL, "\0");
Syslog('-', "\"%s\"", printable(cmd, 0)); Syslog('-', "\"%s\"", printable(cmd, 0));
#ifdef USE_EXPERIMENT
if (part(tmpu->pid, cmd ? cmd : (char *)"Quitting") == FALSE) { if (part(tmpu->pid, cmd ? cmd : (char *)"Quitting") == FALSE) {
sprintf(buf, "** Not in a channel"); sprintf(buf, "** Not in a channel");
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
} }
#else
if (part(chat_users[i].pid, cmd ? cmd : (char *)"Quitting") == FALSE) {
sprintf(buf, "** Not in a channel");
system_msg(chat_users[i].pid, buf);
}
#endif
chat_dump(); chat_dump();
goto ack; goto ack;
} else if (strncasecmp(msg, "/topic", 6) == 0) { } else if (strncasecmp(msg, "/topic", 6) == 0) {
#ifdef USE_EXPERIMENT
if (strlen(tmpu->channel)) { if (strlen(tmpu->channel)) {
sprintf(buf, "** Internal system error"); sprintf(buf, "** Internal system error");
for (tmpc = channels; tmpc; tmpc = tmpc->next) { for (tmpc = channels; tmpc; tmpc = tmpc->next) {
@ -1027,25 +657,6 @@ char *chat_put(char *data)
sprintf(buf, "** Not in a channel"); sprintf(buf, "** Not in a channel");
} }
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
if (chat_users[i].channel != -1) {
if (chat_channels[chat_users[i].channel].owner == chat_users[i].pid) {
cmd = strtok(msg, " \0");
cmd = strtok(NULL, "\0");
if ((cmd == NULL) || (strlen(cmd) == 0) || (strlen(cmd) > 54)) {
sprintf(buf, "** Topic must be between 1 and 54 characters");
} else {
strncpy(chat_channels[chat_users[i].channel].topic, cmd, 54);
sprintf(buf, "Topic set to \"%s\"", cmd);
}
} else {
sprintf(buf, "** You are not the channel owner");
}
} else {
sprintf(buf, "** Not in a channel");
}
system_msg(chat_users[i].pid, buf);
#endif
chat_dump(); chat_dump();
goto ack; goto ack;
} else { } else {
@ -1054,37 +665,21 @@ char *chat_put(char *data)
*/ */
cmd = strtok(msg, " \t\r\n\0"); cmd = strtok(msg, " \t\r\n\0");
sprintf(buf, "*** \"%s\" :Unknown command", cmd+1); sprintf(buf, "*** \"%s\" :Unknown command", cmd+1);
#ifdef USE_EXPERIMENT
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
system_msg(chat_users[i].pid, buf);
#endif
goto ack; goto ack;
} }
} }
#ifdef USE_EXPERIMENT
if (strlen(tmpu->channel) == 0) { if (strlen(tmpu->channel) == 0) {
#else
if (chat_users[i].channel == -1) {
#endif
/* /*
* Trying messages while not in a channel * Trying messages while not in a channel
*/ */
sprintf(buf, "** No channel joined. Try /join #channel"); sprintf(buf, "** No channel joined. Try /join #channel");
#ifdef USE_EXPERIMENT
system_msg(tmpu->pid, buf); system_msg(tmpu->pid, buf);
#else
system_msg(chat_users[i].pid, buf);
#endif
chat_dump(); chat_dump();
goto ack; goto ack;
} else { } else {
#ifdef USE_EXPERIMENT
chat_msg(tmpu->channel, tmpu->nick, msg); chat_msg(tmpu->channel, tmpu->nick, msg);
send_all("PRIVMSG %s <%s> %s\r\n", tmpu->channel, tmpu->nick, msg); send_all("PRIVMSG %s <%s> %s\r\n", tmpu->channel, tmpu->nick, msg);
#else
chat_msg(chat_users[i].channel, chat_users[i].nick, msg);
#endif
chat_dump(); chat_dump();
} }
goto ack; goto ack;
@ -1113,11 +708,7 @@ char *chat_get(char *data)
{ {
static char buf[200]; static char buf[200];
char *pid; char *pid;
#ifdef USE_EXPERIMENT
usr_list *tmpu; usr_list *tmpu;
#else
int i;
#endif
if (IsSema((char *)"upsalarm")) { if (IsSema((char *)"upsalarm")) {
sprintf(buf, "100:2,1,*** Power failure, running on UPS;"); sprintf(buf, "100:2,1,*** Power failure, running on UPS;");
@ -1133,7 +724,6 @@ char *chat_get(char *data)
pid = strtok(data, ","); pid = strtok(data, ",");
pid = strtok(NULL, ";"); pid = strtok(NULL, ";");
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) { for (tmpu = users; tmpu; tmpu = tmpu->next) {
if (atoi(pid) == tmpu->pid) { if (atoi(pid) == tmpu->pid) {
while (tmpu->pointer != buffer_head) { while (tmpu->pointer != buffer_head) {
@ -1154,28 +744,6 @@ char *chat_get(char *data)
return buf; return buf;
} }
} }
#else
for (i = 0; i < MAXCLIENT; i++) {
if (atoi(pid) == chat_users[i].pid) {
while (chat_users[i].pointer != buffer_head) {
if (chat_users[i].pointer < MAXMESSAGES)
chat_users[i].pointer++;
else
chat_users[i].pointer = 0;
if (chat_users[i].pid == chat_messages[chat_users[i].pointer].topid) {
/*
* Message is for us.
*/
sprintf(buf, "100:2,0,%s;", chat_messages[chat_users[i].pointer].message);
Syslog('-', "%s", buf);
return buf;
}
}
sprintf(buf, "100:0;");
return buf;
}
}
#endif
sprintf(buf, "100:2,1,*** ERROR - Not connected to server;"); sprintf(buf, "100:2,1,*** ERROR - Not connected to server;");
return buf; return buf;
} }
@ -1189,11 +757,7 @@ char *chat_checksysop(char *data)
{ {
static char buf[20]; static char buf[20];
char *pid; char *pid;
#ifdef USE_EXPERIMENT
usr_list *tmpu; usr_list *tmpu;
#else
int i;
#endif
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
pid = strtok(data, ","); pid = strtok(data, ",");
@ -1205,7 +769,6 @@ char *chat_checksysop(char *data)
/* /*
* Now check if sysop is present in the sysop channel * Now check if sysop is present in the sysop channel
*/ */
#ifdef USE_EXPERIMENT
for (tmpu = users; tmpu; tmpu = tmpu->next) { for (tmpu = users; tmpu; tmpu = tmpu->next) {
if (atoi(pid) != tmpu->pid) { if (atoi(pid) != tmpu->pid) {
if (strlen(tmpu->channel) && (strcasecmp(tmpu->channel, "#sysop") == 0) && tmpu->sysop) { if (strlen(tmpu->channel) && (strcasecmp(tmpu->channel, "#sysop") == 0) && tmpu->sysop) {
@ -1216,18 +779,6 @@ char *chat_checksysop(char *data)
} }
} }
} }
#else
for (i = 0; i < MAXCLIENT; i++) {
if (atoi(pid) != chat_users[i].pid) {
if (chat_users[i].chatting && chat_users[i].sysop) {
Syslog('-', "Sending ACK on check");
sprintf(buf, "100:1,1;");
reg_sysoptalk(pid);
return buf;
}
}
}
#endif
} }
sprintf(buf, "100:1,0;"); sprintf(buf, "100:1,0;");

View File

@ -3,11 +3,7 @@
/* $Id$ */ /* $Id$ */
#ifdef USE_EXPERIMENT
void chat_msg(char *, char *, char *); void chat_msg(char *, char *, char *);
#else
void chat_msg(int, char *, char *);
#endif
void system_shout(const char *, ...); void system_shout(const char *, ...);
void chat_init(void); void chat_init(void);
void chat_cleanuser(pid_t); void chat_cleanuser(pid_t);

View File

@ -37,7 +37,6 @@
#ifdef USE_EXPERIMENT
int ibc_run = FALSE; /* Thread running */ int ibc_run = FALSE; /* Thread running */
extern int T_Shutdown; /* Program shutdown */ extern int T_Shutdown; /* Program shutdown */
@ -1611,4 +1610,3 @@ exit:
} }
#endif

View File

@ -3,8 +3,6 @@
/* $Id$ */ /* $Id$ */
#ifdef USE_EXPERIMENT
/* /*
* Linked list of neighbour chatservers * Linked list of neighbour chatservers
@ -114,6 +112,5 @@ int do_command(char *, char *, char *);
void send_all(const char *, ...); void send_all(const char *, ...);
void *ibc_thread(void *); void *ibc_thread(void *);
#endif
#endif #endif

View File

@ -4,7 +4,7 @@
* Purpose ...............: Keep track of server status * Purpose ...............: Keep track of server status
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -88,11 +88,9 @@ static status_r status; /* Status data */
extern double Load; /* System Load */ extern double Load; /* System Load */
extern int Processing; /* Is system running */ extern int Processing; /* Is system running */
#ifdef USE_EXPERIMENT
extern srv_list *servers; /* Connected servers */ extern srv_list *servers; /* Connected servers */
extern usr_list *users; /* Connected users */ extern usr_list *users; /* Connected users */
extern chn_list *channels; /* Connected channels */ extern chn_list *channels; /* Connected channels */
#endif
/************************************************************************ /************************************************************************
@ -308,16 +306,13 @@ void stat_inc_cerr()
char *stat_status() char *stat_status()
{ {
static char buf[160]; static char buf[160];
#ifdef USE_EXPERIMENT
int srvcnt = 0, chncnt = 0, usrcnt = 0; int srvcnt = 0, chncnt = 0, usrcnt = 0;
srv_list *tmps; srv_list *tmps;
chn_list *tmpc; chn_list *tmpc;
usr_list *tmpu; usr_list *tmpu;
#endif
buf[0] = '\0'; buf[0] = '\0';
#ifdef USE_EXPERIMENT
for (tmps = servers; tmps; tmps = tmps->next) for (tmps = servers; tmps; tmps = tmps->next)
srvcnt++; srvcnt++;
for (tmpc = channels; tmpc; tmpc = tmpc->next) for (tmpc = channels; tmpc; tmpc = tmpc->next)
@ -333,16 +328,6 @@ char *stat_status()
status.today.s_error, status.today.c_error, status.today.s_error, status.today.c_error,
status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence, status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence,
srvcnt, chncnt, usrcnt); srvcnt, chncnt, usrcnt);
#else
sprintf(buf, "100:20,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu;",
(long)status.start, (long)status.laststart, (long)status.daily,
status.startups, status.clients,
status.total.tot_clt, status.total.peak_clt,
status.total.s_error, status.total.c_error,
status.today.tot_clt, status.today.peak_clt,
status.today.s_error, status.today.c_error,
status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence);
#endif
return buf; return buf;
} }