Finished chatserver, bumped to version 0.37.3

This commit is contained in:
Michiel Broek 2003-04-09 19:38:06 +00:00
parent 03f3cb1c12
commit cad87472f1
4 changed files with 1551 additions and 884 deletions

View File

@ -5,7 +5,10 @@ $Id$
All other users on Intel machines (99,9% I think) can use this version.
v0.37.2 23-Feb-2003.
v0.37.3 09-Apr-2003.
v0.37.2 23-Feb-2003 - 09-Apr-2003
general:
System prepared for setting the official FTSC product code,
@ -14,6 +17,8 @@ v0.37.2 23-Feb-2003.
chat stuff that is of no use anymore. The sysop shows his
presence by running mbmon. The mbchat program is obsolete.
Menu item 22 is added, this is user chat session.
For chat (and sysop/user paging chat) works now using the
mbtask daemon.
common.a:
New function to get the real case of a filename.
@ -83,9 +88,9 @@ v0.37.2 23-Feb-2003.
Added CPAG command to page the sysop.
Added CCAN command to cancel the sysop page.
Added CCKP command to check for a page.
Added CCON, CCLO, CPUT and CGET commands for chatserver. The
chatserver commands will be added and are in development.
Basic chatting now works.
Added CCON, CCLO, CPUT and CGET commands for chatserver.
Implemented a chatserver, this looks like a simple IRC server
to the users.
lang:
Changed language prompts 15, 16 and 152.

2353
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ dnl After changeing the version number, run autoconf!
PACKAGE="mbsebbs"
MAJOR="0"
MINOR="37"
REVISION="2"
REVISION="3"
VERSION="$MAJOR.$MINOR.$REVISION"
COPYRIGHT="Copyright (C) 1997-2003 Michiel Broek, All Rights Reserved"
SHORTRIGHT="Copyright (C) 1997-2003 M. Broek"

View File

@ -183,17 +183,17 @@ void chat_help(pid_t pid)
system_msg(pid, (char *)" Help topics available:");
system_msg(pid, (char *)"");
system_msg(pid, (char *)" /BYE - Exit from chatserver");
// system_msg(pid, (char *)" /ECHO <message> - Echo message to yourself");
system_msg(pid, (char *)" /ECHO <message> - Echo message to yourself");
system_msg(pid, (char *)" /EXIT - Exit from chatserver");
system_msg(pid, (char *)" /JOIN #channel - Join or create a channel");
system_msg(pid, (char *)" /J #channel - Join or create a channel");
// system_msg(pid, (char *)" /KICK <nick> - Kick nick out of the channel");
system_msg(pid, (char *)" /LIST - List active channels");
// system_msg(pid, (char *)" /NAMES - List nicks in current channel");
system_msg(pid, (char *)" /NAMES - List nicks in current channel");
system_msg(pid, (char *)" /NICK <name> - Set new nickname");
system_msg(pid, (char *)" /PART - Leave current channel");
system_msg(pid, (char *)" /QUIT - Exit from chatserver");
// system_msg(pid, (char *)" /TOPIC <topic> - Set topic for current channel");
system_msg(pid, (char *)" /TOPIC <topic> - Set topic for current channel");
system_msg(pid, (char *)"");
system_msg(pid, (char *)" All other input (without a starting /) is sent to the channel.");
}
@ -328,7 +328,11 @@ int part(pid_t pid, char *reason)
void chat_init(void)
{
int i;
memset(&chat_users, 0, sizeof(chat_users));
for (i = 0; i < MAXCLIENT; i++)
chat_users[i].channel = -1;
memset(&chat_messages, 0, sizeof(chat_messages));
memset(&chat_channels, 0, sizeof(chat_channels));
}
@ -453,6 +457,7 @@ char *chat_close(char *data)
if (chat_users[i].pid == atoi(pid)) {
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;
}
@ -468,7 +473,7 @@ char *chat_put(char *data)
{
static char buf[200];
char *pid, *msg, *cmd;
int i, j, first;
int i, j, first, count;
Syslog('-', "CPUT:%s", data);
memset(&buf, 0, sizeof(buf));
@ -497,6 +502,10 @@ char *chat_put(char *data)
if (strncasecmp(msg, "/help", 5) == 0) {
chat_help(atoi(pid));
goto ack;
} else if (strncasecmp(msg, "/echo", 5) == 0) {
sprintf(buf, "%s", msg);
system_msg(chat_users[i].pid, buf);
goto ack;
} else if ((strncasecmp(msg, "/exit", 5) == 0) ||
(strncasecmp(msg, "/quit", 5) == 0) ||
(strncasecmp(msg, "/bye", 4) == 0)) {
@ -511,10 +520,10 @@ char *chat_put(char *data)
cmd = strtok(NULL, "\0");
Syslog('-', "\"%s\"", cmd);
if ((cmd == NULL) || (cmd[0] != '#') || (strcmp(cmd, "#") == 0)) {
sprintf(buf, "Try /join #channel");
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");
sprintf(buf, "** Cannot join while in a channel");
system_msg(chat_users[i].pid, buf);
} else {
Syslog('-', "Trying to join channel %s", cmd);
@ -542,11 +551,31 @@ char *chat_put(char *data)
system_msg(chat_users[i].pid, buf);
}
goto ack;
} else if (strncasecmp(msg, "/names", 6) == 0) {
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].name,
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);
}
goto ack;
} else if (strncasecmp(msg, "/nick", 5) == 0) {
cmd = strtok(msg, " \0");
cmd = strtok(NULL, "\0");
if ((cmd == NULL) || (strlen(cmd) == 0) || (strlen(cmd) > 36)) {
sprintf(buf, "Nickname must be between 1 and 36 characters");
sprintf(buf, "** Nickname must be between 1 and 36 characters");
} else {
strncpy(chat_users[i].name, cmd, 36);
sprintf(buf, "Nick set to \"%s\"", cmd);
@ -560,11 +589,31 @@ char *chat_put(char *data)
cmd = strtok(NULL, "\0");
Syslog('-', "\"%s\"", cmd);
if (part(chat_users[i].pid, cmd) == FALSE) {
sprintf(buf, "Not in a channel");
sprintf(buf, "** Not in a channel");
system_msg(chat_users[i].pid, buf);
}
chat_dump();
goto ack;
} else if (strncasecmp(msg, "/topic", 6) == 0) {
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) > 36)) {
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);
chat_dump();
goto ack;
} else {
/*
* If still here, the command was not recognized.
@ -579,7 +628,7 @@ char *chat_put(char *data)
/*
* Trying messages while not in a channel
*/
sprintf(buf, "No channel joined. Try /join #channel");
sprintf(buf, "** No channel joined. Try /join #channel");
system_msg(chat_users[i].pid, buf);
chat_dump();
goto ack;