/*
	Schrodinger's Box Haven  code version -0.1 alpha
        Copyright (C) 1994, Gordon Chan

	You can do whatever ya want with this code as long as you leave this
        copyright & disclaimer intact.  You can hack it up all you want, etc...
        No guarantees.

	Send comments, flames, bug reports, etc ... to
		au233@freenet.carleton.ca  <---- (preferred address for now)
		gjc@achilles.net
		gchan@ccs.carleton.ca
*/


/* Here's the copyrights & disclaimers from the Opium Den and unixCB codes */

/* Opium Den */
/*
  val's haven code v -0.85

        Copyright (C) 1994 Joel Ward

        Warranty:
                Don't blame me for anything.

        You can do whatever the fuck you want with this code as long as you
don't remove this copyright/disclaimer notice.
*/

/* unixCB */
/*
  
  cbd.c
  
  "cbd.c" is the main code for the CB simulator.
  
  Copyright (c) 1992, Gary Grossman.  All rights reserved.
  Send comments and questions to: garyg@soda.berkeley.edu
  
  */

#include <string.h>

#include "linked_lists.h"
#include "security.h"


void kick (user, victim)
	struct user *user;
	char *victim;
{
	struct user *u;
	char temp[120];

	toggle_user (user, Fcomm_line);

	victim[NAMEMAX-1] = '\0';
	u = (struct user *) find_user (victim);
	if (u) {
		if (u->sec_level >= user->sec_level) {
			sprintf (temp, ">> You cannot kill %s on line %d.\r\n",
			  u->name, u->desc);
			write_user (user->desc, temp);
			sprintf (temp, ">> %s on line %d has tried to kill you!\r\n", 
			  user->name, user->desc);
			process_output (u, temp);
		} else {
			sprintf (temp, ">> %s on line %d has been killed.  Huh huh huh!!!\r\n",
			  u->name, u->desc);
			write_user (user->desc, temp);
			sprintf (temp, ">> %s on line %d has been kicked off.  Ha ha ha!!!\r\n", 
			  u->name, u->desc);
			delete_user (u, ">> You have been kicked off.  Huh  Huh  Huh!!!\r\n", 0, temp);
		}
	} else {
		sprintf (temp ,">> %s is not logged on.\r\n", victim);
		write_user (user->desc, temp);
	}		
	user->linecharmax = INPUTMAX;
}


void global_yell (user, message)
	struct user *user;
	char *message;
{
	struct user *u;
	char temp[600];

	toggle_user (user, Fcomm_line);

	if (*message) {
		sprintf (temp, ">> System message from %s on line %d:  %s\r\n",
		  user->name, user->desc, message);
		for (u = firstuser; u; u = u->next)
			process_output (u, temp);
	} else
		write_user (user->desc, ">> No system message announced.\r\n");
}
