Commit fcfd16a1 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(get_version_info): New function.

(broadcast): Rewritten in terms of send_message.
(send_message): The recipient is now a Conf_no, not necessarily a Pers_no.
parent 893cefe1
/*
* $Id: admin.c,v 0.15 1994/04/05 07:59:50 ceder Exp $
* $Id: admin.c,v 0.16 1994/12/31 11:49:08 ceder Exp $
* Copyright (C) 1991, 1993, 1994 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Administrative calls.
*/
static char *rcsid = "$Id: admin.c,v 0.15 1994/04/05 07:59:50 ceder Exp $";
static char *rcsid = "$Id: admin.c,v 0.16 1994/12/31 11:49:08 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -53,6 +53,8 @@ USE(rcsid);
#include "send-async.h"
#include "param.h"
#include "string-malloc.h"
#include "services.h"
#include "version-info.h"
/* All of the fields in this structure except the version number
is set from the configuration file at startup (see ramkomd.c).
......@@ -73,7 +75,7 @@ Info kom_info =
/*
* Return info about this server. This can (and should) be done
* before logging in. modt_of_lyskom should be displayed before
* before logging in. motd_of_lyskom should be displayed before
* prompting for username if it isn't 0.
*/
extern Success
......@@ -83,6 +85,16 @@ get_info( Info *result )
return OK;
}
extern Success
get_version_info( Version_info *result )
{
/* Allowed before login. */
result->protocol_version = kom_version_info.protocol_version;
result->server_name = s_fcrea_str(kom_version_info.server_name);
result->server_version = s_fcrea_str(kom_version_info.server_version);
return OK;
}
/* /// */
extern Success
set_motd_of_lyskom (Text_no motd)
......@@ -151,25 +163,21 @@ set_motd_of_lyskom (Text_no motd)
extern Success
broadcast (String message)
{
CHK_LOGIN(FAILURE);
if (s_strlen(message) > param.broadcast_len)
{
kom_errno = KOM_LONG_STR;
return FAILURE;
}
async_broadcast(ACTPERS, message);
return OK;
return send_message(0, message);
}
/*
* Send a message
*/
extern Success
send_message (Pers_no recipient,
send_message (Conf_no recipient,
const String message)
{
Conference *conf_c;
unsigned short end;
unsigned short ix;
Success retval;
CHK_LOGIN(FAILURE);
if (s_strlen(message) > param.broadcast_len)
......@@ -178,9 +186,33 @@ send_message (Pers_no recipient,
return FAILURE;
}
return async_send_message(recipient, ACTPERS, message);
}
if (recipient != 0 && cached_conf_exists(recipient) == FALSE)
{
kom_errno = KOM_UNDEF_CONF;
return FAILURE;
}
if (recipient == 0 || cached_get_conf_type(recipient).letter_box == 1)
return async_send_message(recipient, ACTPERS, message);
else
{
/* The recipient is a conference. Send the message to all
members of that conference. */
GET_C_STAT(conf_c, recipient, FAILURE);
end = conf_c->members.no_of_members;
retval = FAILURE;
for (ix = 0; ix < end; ix++)
{
if (async_send_group_message(conf_c->members.members[ix].member,
recipient, ACTPERS, message) == OK)
{
retval = OK;
}
}
return retval;
}
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment