/*
 * front/generic.h
 *   Interface of generic frontend (toolkit)
 *
 * $Id: generic.h,v 1.1.1.1 2002/01/24 20:19:48 sembera Exp $
 */
/*
 * IIRC - IIRC Is a Real Client (Modular IRC Client)
 * Copyright (C) 2001  Jan Sembera <fis@ji.cz>
 * Copyright (C) 2001  Petr Baudis <pasky@ji.cz>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __IIRC_FRONT_GENERIC
#define __IIRC_FRONT_GENERIC

#include "../front/iface.h"

typedef struct {
  char *command;
  unsigned int argc;
  char **argv;
} parsed_t;

typedef int (*hook_funct)(parsed_t *, message_t *);

typedef struct {
  char *name;
  hook_funct handler;
} hook_t;

extern int generic_front_split(char *, parsed_t *); /* split string to parsed_t (ret 0 if not cmd) */
extern int generic_front_join(char **, parsed_t *); /* join parsed_t to string (ret 0 if bad struct) */
extern int generic_front_parjoin(char **, int, int, parsed_t *); /* join some params from parsed_t
								    (int from, int count, ret 0 if
								    bad struct or invalid ints) count==0 == all to end */
extern int generic_front_lookup_in(hook_t *, parsed_t *); /* lookup for command's string's hook in a table */
extern int generic_front_destroy(parsed_t *);

#endif
