/************************************************************************ * IRC - Internet Relay Chat, modules/m_capab.c * * Copyright (C) 2000-2003 TR-IRCD Development * * Copyright (C) 1990 Jarkko Oikarinen and * University of Oulu, Co Center * * See file AUTHORS in IRC package for additional names of * the programmers. * * This program is free softwmare; 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "struct.h" #include "common.h" #include "sys.h" #include "h.h" #include "msg.h" static struct Message c_msgtab[] = { {MSG_CAPAB, 0, MAXPARA, M_SLOW, 0L, m_capab, m_ignore, m_ignore, m_capab, m_capab} }; static struct Message e_msgtab[] = { {MSG_EXCAP, 0, 1, M_SLOW, 0L, m_excap, m_ignore, m_ignore, m_excap, m_excap} }; #ifndef STATIC_MODULES char *_version = "$Revision: 1.4 $"; void _modinit(void) { mod_add_cmd(c_msgtab); mod_add_cmd(e_msgtab); } void _moddeinit(void) { mod_del_cmd(c_msgtab); mod_del_cmd(e_msgtab); } #else void m_capab_init(void) { mod_add_cmd(c_msgtab); mod_add_cmd(e_msgtab); } #endif /* * m_capab * Communicate what I can do to another server * This has to be able to be sent and understood while * the client is UNREGISTERED. Therefore, we * absolutely positively must not check to see if * this is a server or a client. It's probably an unknown! */ int m_capab(aClient *cptr, aClient *sptr, int parc, char *parv[]) { int i, j; if (cptr != sptr) return 0; for (i = 1; i < parc; i++) { for (j = 0; my_capabs[j].name; j++) { if (strcmp(parv[i], my_capabs[j].name) == 0) cptr->capabilities |= my_capabs[j].flag; } } if (!(cptr->capabilities & CAPAB_IDENT)) cptr->capabilities |= CAPAB_NICKIP; if (cptr->capabilities & CAPAB_HIDENAME) cptr->protoflags |= PFLAGS_DOHIDENAME; return 0; } int m_excap(aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *p = NULL; char *m; int i; for ((m = strtoken(&p, parv[1], " ")); m; (m = strtoken(&p, NULL, " "))) { for (i = 0; my_excapabs[i].name; i++) { if (strcmp(m, my_excapabs[i].name) == 0) cptr->capabilities |= my_excapabs[i].flag; } } return 0; }