/******************************************************************************
 * This file is part of a software distribution, which is furnished under the *
 * terms of a license.  Use of this software  by any means is subject to this *
 * license  and  signifies  the  acceptance of  the  licensing  terms  stated *
 * therein. Please see  the file LICENSE in the  top-level directory  of this *
 * software  distribution  for detailed copyright  disclaimers  and licensing *
 * terms.                                                                     *
 ******************************************************************************
 * Copryight (c) by Andreas S. Wetzel - All rights reserved.                  *
 ******************************************************************************/

/* $Id: vd_commands.c,v 1.3 2002/06/23 23:29:38 mickey Exp $ */

#include <vchat.h>
#include <proto_vchatd.h>

/*** Externals ***/

extern ED	*ed;

/*** Code ***/

void handle_cmd(char *cmd)
{
	char	*arg = &(cmd[3]);

	switch(cmd[1])
	{
		case 'a':	action(arg);
				break;
		case 'A':	aclcmd(arg);
				break;
		case 'B':	broadcast(arg);
				break;
		case 'c':	chchan(arg);
				BZERO(&ed->buffer, EDBUFSIZE+1);
				ed->endpos = ed->curpos = ed->margin = (char *) &ed->buffer;
				ed->prompt = NULL;
				ed->offset = 0;
				ed->maxlen = EDBUFSIZE;
				vsleep(0, 650000);
				break;
		case 'C':	addnick(arg);
				break;
		case 'D':	delnick(arg);
				break;
		case 'F':	fixchan(arg);
				break;
		case 'h':	help();
				break;
		case 'H':	ext_help();
				break;
		case 'i':	invite(arg);
				break;
		case 'I':	clientinfo(arg);
				break;
		case 'K':	killclient(arg);
				break;
		case 'l':	lastlog(arg);
				break;
		case 'm':	prv_msg(arg);
				break;
		case 'M':	modify_permissions(arg);
				break;
		case 'n':	chnick(arg);
				break;
		case 'N':	svdnsopt(arg);
				break;
		case 'o':	clientopts(arg);
				break;
		case 'O':	serveropts(arg);
				break;
		case 'p':	snd_serv(CMD_PAGE, arg, strlen(arg));
				break;
		case 'P':	chpasswd(arg);
				break;
		case 'Q':	querynick(arg);
				break;
		case 'r':	screen_init();
				break;
		case 'R':	rtcmp(arg);
				break;
		case 's':	ulist(arg);
				break;
		case 'S':	serverstatus(arg);
				break;
		case 't':	snd_serv(CMD_CHANLIST, 0, 0);
				break;
		case 'T':	chtopic(arg);
				break;
		case 'v':	version_info();
				break;
		case 'W':	wakeup(arg);
				break;
		case 'X':	exclude(arg);
				break;
		default:	cprintf(chat, "* No such command - type \"%s.h%s\" to get help.",
					S_FG_GRN, S_OFF);
				break;
	}
}


syntax highlighted by Code2HTML, v. 0.9.1