diff --git a/.gitattributes b/.gitattributes index 2f58bce..1eba97d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -44,14 +44,10 @@ contrib/README.disable_identd -text contrib/disable_identd.diff -text contrib/example_module.c -text contrib/lmh.diff -text -contrib/m_clearchan.c -text contrib/m_flags.c -text -contrib/m_force.c -text contrib/m_jupe.c -text contrib/m_ltrace.c -text contrib/m_mkpasswd.c -text -contrib/m_ojoin.c -text -contrib/m_opme.c -text contrib/m_tburst.c -text contrib/spy_admin_notice.c -text contrib/spy_info_notice.c -text @@ -330,6 +326,7 @@ modules/m_away.c -text modules/m_capab.c -text modules/m_cburst.c -text modules/m_challenge.c -text +modules/m_clearchan.c -text modules/m_close.c -text modules/m_connect.c -text modules/m_cryptlink.c -text @@ -354,8 +351,10 @@ modules/m_map.c -text modules/m_motd.c -text modules/m_names.c -text modules/m_nburst.c -text +modules/m_ojoin.c -text modules/m_oper.c -text modules/m_operwall.c -text +modules/m_opme.c -text modules/m_pass.c -text modules/m_ping.c -text modules/m_pong.c -text diff --git a/ChangeLog b/ChangeLog index b49c79a..7fbfbd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,7 +10,8 @@ Symbols are: (F) - Fixed a problem with sethost I think (wasn't setting on other servers correctly) (F) - OperAutoJoin is now a new option when you /oper up, you will be autojoined to a channel. (F) - ./configure updated with --enable-debug and compile flags updated. - +(F) - Moved m_opme m_ojoin and m_clearchan to standard modules (and fixed them up) +(F) - added svsjoin and svspart (based on m_force.c contrib module) * NeoIRCd Version 0.9.1 - 12th August, 2002 - Fish (F) - Added +S UserMode. For Services. Allow them to override anything diff --git a/contrib/m_flags.c b/contrib/m_flags.c index 4dc2e52..e8a9c34 100644 --- a/contrib/m_flags.c +++ b/contrib/m_flags.c @@ -27,7 +27,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $Id: m_flags.c,v 1.2 2002/08/13 14:45:00 fishwaldo Exp $ + * $Id: m_flags.c,v 1.3 2002/09/17 11:03:21 fishwaldo Exp $ */ /* List of ircd includes from ../include/ */ @@ -77,7 +77,7 @@ _moddeinit(void) mod_del_cmd(&test_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* FLAGS requires it's own mini parser, since the last parameter in it can @@ -97,50 +97,41 @@ struct FlagTable static struct FlagTable flag_table[] = { /* name mode it represents oper only? */ - { "OWALLOPS", FLAGS_OPERWALL, 1 }, - { "SWALLOPS", FLAGS_WALLOP, 0 }, + { "OPERWALLOPS", FLAGS_OPERWALL, 1 }, + { "SERVERWALLOPS", FLAGS_WALLOP, 0 }, { "STATSNOTICES", FLAGS_SPY, 1 }, - /* We don't have a separate OKILL and SKILL modes */ - { "OKILLS", FLAGS_SKILL, 0 }, - { "SKILLS", FLAGS_SKILL, 0 }, - { "SNOTICES", FLAGS_SERVNOTICE, 0 }, - /* We don't have separate client connect and disconnect modes */ - { "CLICONNECTS", FLAGS_CCONN, 1 }, - { "CLIDISCONNECTS", FLAGS_CCONN, 1 }, - /* I'm taking a wild guess here... */ + { "OPERKILLS", FLAGS_SKILL, 0 }, + { "SERVERKILLS", FLAGS_SKILL, 0 }, + { "SERVERNOTICES", FLAGS_SERVNOTICE, 0 }, + { "CLIENTCONNECTS", FLAGS_CCONN, 1 }, + { "CLIIENTDISCONNECTS", FLAGS_CCONN, 1 }, { "THROTTLES", FLAGS_REJ, 1 }, -#if 0 - /* This one is special...controlled via an oper block option */ - { "NICKCHANGES", FLAGS_NCHANGE, 1 }, - /* NICKCHANGES must be checked for separately */ -#endif - /* I'm assuming this is correct... */ { "IPMISMATCHES", FLAGS_UNAUTH, 1 }, - { "LWALLOPS", FLAGS_LOCOPS, 1 }, - /* These aren't separate on Hybrid */ + { "LOCOPS", FLAGS_LOCOPS, 1 }, { "CONNECTS", FLAGS_EXTERNAL, 1 }, { "SQUITS", FLAGS_EXTERNAL, 1 }, - /* Now we have our Hybrid specific flags */ { "FULL", FLAGS_FULL, 1 }, - /* Not in CS, but we might as well put it here */ { "INVISIBLE", FLAGS_INVISIBLE, 0 }, { "BOTS", FLAGS_BOTS, 1 }, { "CALLERID", FLAGS_CALLERID, 0 }, { "UNAUTH", FLAGS_UNAUTH, 1 }, { "DEBUG", FLAGS_DEBUG, 1 }, + { "REGNICK", FLAGS_REGNICK, 0 }, + { "SERVICES", FLAGS_SERVICES, 1 }, + { "VHOST", FLAGS_HIDDEN, 0 }, { NULL, 0, 0 } }; /* We won't control CALLERID or INVISIBLE in here */ -#define FL_ALL_USER_FLAGS (FLAGS_WALLOP | FLAGS_SKILL | FLAGS_SERVNOTICE ) +#define FL_ALL_USER_FLAGS (FLAGS_WALLOP | FLAGS_SKILL | FLAGS_SERVNOTICE | FLAGS_HIDDEN) /* and we don't control NCHANGES here either */ #define FL_ALL_OPER_FLAGS (FL_ALL_USER_FLAGS | FLAGS_CCONN | FLAGS_REJ |\ FLAGS_FULL | FLAGS_SPY | FLAGS_DEBUG |\ FLAGS_OPERWALL | FLAGS_BOTS | FLAGS_EXTERNAL |\ - FLAGS_UNAUTH | FLAGS_LOCOPS ) + FLAGS_UNAUTH | FLAGS_LOCOPS) /* ** m_flags diff --git a/contrib/m_force.c b/contrib/m_force.c deleted file mode 100644 index 06c0d58..0000000 --- a/contrib/m_force.c +++ /dev/null @@ -1,314 +0,0 @@ -/* contrib/m_force.c - * Copyright (C) 2002 Hybrid Development Team - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1.Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2.Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3.The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: m_force.c,v 1.2 2002/08/13 14:45:00 fishwaldo Exp $ - */ - -#include "stdinc.h" -#include "handlers.h" -#include "client.h" -#include "common.h" /* FALSE bleah */ -#include "ircd.h" -#include "irc_string.h" -#include "numeric.h" -#include "fdlist.h" -#include "hash.h" -#include "s_bsd.h" -#include "s_conf.h" -#include "s_log.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "channel.h" -#include "channel_mode.h" - - -static void mo_forcejoin(struct Client *client_p, struct Client *source_p, - int parc, char *parv[]); -static void mo_forcepart(struct Client *client_p, struct Client *source_p, - int parc, char *parv[]); - -struct Message forcejoin_msgtab = { - "FORCEJOIN", 0, 0, 3, 0, MFLG_SLOW, 0, - {m_ignore, m_not_oper, mo_forcejoin, mo_forcejoin} -}; -struct Message forcepart_msgtab = { - "FORCEPART", 0, 0, 3, 0, MFLG_SLOW, 0, - {m_ignore, m_not_oper, mo_forcepart, mo_forcepart} -}; - -#ifndef STATIC_MODULES -void -_modinit(void) -{ - mod_add_cmd(&forcejoin_msgtab); - mod_add_cmd(&forcepart_msgtab); -} - -void -_moddeinit(void) -{ - mod_del_cmd(&forcejoin_msgtab); - mod_del_cmd(&forcepart_msgtab); -} - -char *_version = "$Revision: 1.2 $"; -#endif - -/* - * m_forcejoin - * parv[0] = sender prefix - * parv[1] = user to force - * parv[2] = channel to force them into - */ -static void mo_forcejoin(struct Client *client_p, struct Client *source_p, - int parc, char *parv[]) -{ - struct Client *target_p; - struct Channel *chptr; - int type; - char mode; - char sjmode; - char *newch; - - if(!IsAdmin(source_p)) - { - sendto_one(source_p, ":%s NOTICE %s :You have no A flag", me.name, parv[0]); - return; - } - - if((hunt_server(client_p, source_p, ":%s FORCEJOIN %s %s", 1, parc, parv)) != HUNTED_ISME) - return; - - /* if target_p is not existant, print message - * to source_p and bail - scuzzy - */ - if ((target_p = find_client(parv[1])) == NULL) - { - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, - source_p->name, parv[1]); - return; - } - - if(!IsClient(target_p)) - return; - - /* select our modes from parv[2] if they exist... (chanop)*/ - if(*parv[2] == '@') - { - type = CHFL_CHANOP; - mode = 'o'; - sjmode = '@'; - } -#ifdef HALFOPS - else if(*parv[2] == '%') - { - type = CHFL_HALFOP; - mode = 'h'; - sjmode = '%'; - } -#endif - else if(*parv[2] == '+') - { - type = CHFL_VOICE; - mode = 'v'; - sjmode = '+'; - } - else - { - type = CHFL_PEON; - mode = sjmode = '\0'; - } - - if(mode != '\0') - parv[2]++; - - if((chptr = hash_find_channel(parv[2])) != NULL) - { - if(IsMember(target_p, chptr)) - { - /* debugging is fun... */ - sendto_one(source_p, ":%s NOTICE %s :*** Notice -- %s is already in %s", me.name, - source_p->name, target_p->name, chptr->chname); - return; - } - - add_user_to_channel(chptr, target_p, type); - - if (chptr->chname[0] != '&') - sendto_server(target_p, target_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, - ":%s SJOIN %lu %s + :%c%s", - me.name, (unsigned long) chptr->channelts, - chptr->chname, type ? sjmode : ' ', target_p->name); - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s", - target_p->name, target_p->username, - target_p->host, chptr->chname); - - if(type) - sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s", - me.name, chptr->chname, mode, target_p->name); - - if(chptr->topic != NULL) - { - sendto_one(target_p, form_str(RPL_TOPIC), me.name, - target_p->name, chptr->chname, chptr->topic); - sendto_one(target_p, form_str(RPL_TOPICWHOTIME), - me.name, source_p->name, chptr->chname, - chptr->topic_info, chptr->topic_time); - } - - channel_member_names(target_p, chptr, chptr->chname, 1); - } - else - { - newch = parv[2]; - if (!check_channel_name(newch)) - { - sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, - source_p->name, (unsigned char*)newch); - return; - } - - /* channel name must begin with & or # */ - if (!IsChannelName(newch)) - { - sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, - source_p->name, (unsigned char*)newch); - return; - } - - /* it would be interesting here to allow an oper - * to force target_p into a channel that doesn't exist - * even more so, into a local channel when we disable - * local channels... but... - * I don't want to break anything - scuzzy - */ - if (ConfigServerHide.disable_local_channels && - (*newch == '&')) - { - sendto_one(source_p, ":%s NOTICE %s :No such channel (%s)", me.name, - source_p->name, newch); - return; - } - - /* newch can't be longer than CHANNELLEN */ - if (strlen(newch) > CHANNELLEN) - { - sendto_one(source_p, ":%s NOTICE %s :Channel name is too long", me.name, - source_p->name); - return; - } - - chptr = get_or_create_channel(target_p, newch, NULL); - add_user_to_channel(chptr, target_p, CHFL_CHANOP); - - /* send out a join, make target_p join chptr */ - if (chptr->chname[0] != '&') - sendto_server(target_p, target_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, - ":%s SJOIN %lu %s +nt :@%s", me.name, - (unsigned long) chptr->channelts, chptr->chname, - target_p->name); - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s", - target_p->name, target_p->username, - target_p->host, chptr->chname); - - chptr->mode.mode |= MODE_TOPICLIMIT; - chptr->mode.mode |= MODE_NOPRIVMSGS; - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt", me.name, - chptr->chname); - - target_p->localClient->last_join_time = CurrentTime; - channel_member_names(target_p, chptr, chptr->chname, 1); - - /* we do this to let the oper know that a channel was created, this will be - * seen from the server handling the command instead of the server that - * the oper is on. - */ - sendto_one(source_p, ":%s NOTICE %s :*** Notice -- Creating channel %s", me.name, - source_p->name, chptr->chname); - } -} - - -static void mo_forcepart(struct Client *client_p, struct Client *source_p, - int parc, char *parv[]) -{ - struct Client *target_p; - struct Channel *chptr; - - if(!IsAdmin(source_p)) - { - sendto_one(source_p, ":%s NOTICE %s :You have no A flag", me.name, parv[0]); - return; - } - - if((hunt_server(client_p, source_p, ":%s FORCEPART %s %s", 1, parc, parv)) != HUNTED_ISME) - return; - - /* if target_p == NULL then let the oper know */ - if ((target_p = find_client(parv[1])) == NULL) - { - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, - source_p->name, parv[1]); - return; - } - - if(!IsClient(target_p)) - return; - - if((chptr = hash_find_channel(parv[2])) == NULL) - { - sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), - me.name, parv[0], parv[1]); - return; - } - - if (!IsMember(target_p, chptr)) - { - sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL), - me.name, parv[0], parv[2], parv[1]); - return; - } - - if (chptr->chname[0] != '&') - sendto_server(target_p, target_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, - ":%s PART %s :%s", - target_p->name, chptr->chname, - target_p->name); - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s", - target_p->name, target_p->username, - target_p->host,chptr->chname, - target_p->name); - remove_user_from_channel(chptr, target_p); -} - diff --git a/modules/Makefile.in b/modules/Makefile.in index bbc02fd..8296ee7 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -1,7 +1,7 @@ # # Makefile.in for ircd/modules # -# $Id: Makefile.in,v 1.9 2002/09/13 16:30:03 fishwaldo Exp $ +# $Id: Makefile.in,v 1.10 2002/09/17 11:03:21 fishwaldo Exp $ # CC = @CC@ AR = @AR@ @@ -56,6 +56,7 @@ SRCS = \ m_capab.c \ m_cburst.c \ m_challenge.c \ + m_clearchan.c \ m_close.c \ m_connect.c \ m_cryptlink.c \ @@ -82,6 +83,8 @@ SRCS = \ m_nburst.c \ m_oper.c \ m_operwall.c \ + m_opme.c \ + m_ojoin.c \ m_pass.c \ m_ping.c \ m_pong.c \ diff --git a/contrib/m_clearchan.c b/modules/m_clearchan.c similarity index 79% rename from contrib/m_clearchan.c rename to modules/m_clearchan.c index 6cb2ed1..9401ae5 100644 --- a/contrib/m_clearchan.c +++ b/modules/m_clearchan.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: m_clearchan.c,v 1.2 2002/08/13 14:45:00 fishwaldo Exp $ + * $Id: m_clearchan.c,v 1.1 2002/09/17 11:03:21 fishwaldo Exp $ */ #include "stdinc.h" #include "tools.h" @@ -35,7 +35,6 @@ #include "msg.h" #include "parse.h" #include "modules.h" -#include "vchannel.h" #include "list.h" @@ -77,7 +76,7 @@ _moddeinit(void) mod_del_cmd(&clearchan_msgtab); } -char *_version = "$Revision: 1.2 $"; +char *_version = "$Revision: 1.1 $"; /* ** mo_clearchan @@ -88,7 +87,6 @@ static void mo_clearchan(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { struct Channel *chptr, *root_chptr; - int on_vchan = 0; /* admins only */ if (!IsOperAdmin(source_p)) @@ -102,14 +100,6 @@ static void mo_clearchan(struct Client *client_p, struct Client *source_p, chptr= hash_find_channel(parv[1]); root_chptr = chptr; -#ifdef VCHANS - if (chptr && parc > 2 && parv[2][0] == '!') - { - chptr = find_vchan(chptr, parv[2]); - if (root_chptr != chptr) - on_vchan++; - } -#endif if( chptr == NULL ) { @@ -125,31 +115,15 @@ static void mo_clearchan(struct Client *client_p, struct Client *source_p, return; } - if (!on_vchan) - { - sendto_wallops_flags(FLAGS_WALLOP, &me, - "CLEARCHAN called for [%s] by %s!%s@%s", - parv[1], source_p->name, source_p->username, source_p->host); - sendto_server(NULL, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, - ":%s WALLOPS :CLEARCHAN called for [%s] by %s!%s@%s", - me.name, parv[1], source_p->name, source_p->username, - source_p->host); - ilog(L_NOTICE, "CLEARCHAN called for [%s] by %s!%s@%s", - parv[1], source_p->name, source_p->username, source_p->host); - } - else - { - sendto_wallops_flags(FLAGS_WALLOP, &me, - "CLEARCHAN called for [%s %s] by %s!%s@%s", - parv[1], parv[2], source_p->name, source_p->username, - source_p->host); - sendto_server(NULL, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, - ":%s WALLOPS :CLEARCHAN called for [%s %s] by %s!%s@%s", - me.name, parv[1], parv[2], source_p->name, - source_p->username, source_p->host); - ilog(L_NOTICE, "CLEARCHAN called for [%s %s] by %s!%s@%s", - parv[1], parv[2], source_p->name, source_p->username, source_p->host); - } + sendto_wallops_flags(FLAGS_WALLOP, &me, + "CLEARCHAN called for [%s] by %s!%s@%s", + parv[1], source_p->name, source_p->username, source_p->host); + sendto_server(NULL, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, + ":%s WALLOPS :CLEARCHAN called for [%s] by %s!%s@%s", + me.name, parv[1], source_p->name, source_p->username, + source_p->host); + ilog(L_NOTICE, "CLEARCHAN called for [%s] by %s!%s@%s", + parv[1], source_p->name, source_p->username, source_p->host); /* Kill all the modes we have about the channel.. making everyone a peon */ remove_our_modes(0, chptr, root_chptr, source_p); @@ -157,7 +131,7 @@ static void mo_clearchan(struct Client *client_p, struct Client *source_p, /* SJOIN the user to give them ops, and lock the channel */ sendto_server(client_p, source_p, chptr, NOCAPS, NOCAPS, - LL_ICLIENT, ":%s SJOIN %lu %s +ntsi :@%s", + LL_ICLIENT, ":%s SJOIN %lu %s +ntsi :¤%s", me.name, (unsigned long) (chptr->channelts - 1), chptr->chname, source_p->name); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s", @@ -165,20 +139,16 @@ static void mo_clearchan(struct Client *client_p, struct Client *source_p, source_p->username, source_p->host, root_chptr->chname); - sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s", + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s", me.name, chptr->chname, source_p->name); - add_user_to_channel(chptr, source_p, CHFL_CHANOP); + add_user_to_channel(chptr, source_p, CHFL_ADMIN); /* Take the TS down by 1, so we don't see the channel taken over * again. */ if (chptr->channelts) chptr->channelts--; -#ifdef VCHANS - if (on_vchan) - add_vchan_to_client_cache(source_p,root_chptr,chptr); -#endif chptr->mode.mode = MODE_SECRET | MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS; @@ -238,35 +208,20 @@ static void remove_our_modes( int hide_or_not, struct Channel *chptr, struct Channel *top_chptr, struct Client *source_p) { + remove_a_mode(hide_or_not, chptr, top_chptr, source_p, &chptr->chanadmins, 'a'); remove_a_mode(hide_or_not, chptr, top_chptr, source_p, &chptr->chanops, 'o'); -#ifdef REQUIRE_OANDV - remove_a_mode(hide_or_not, chptr, top_chptr, source_p, &chptr->chanops_voiced, 'o'); -#endif -#ifdef HALFOPS remove_a_mode(hide_or_not, chptr, top_chptr, source_p, &chptr->halfops, 'h'); -#endif remove_a_mode(hide_or_not, chptr, top_chptr, source_p, &chptr->voiced, 'v'); -#ifdef REQUIRE_OANDV - remove_a_mode(hide_or_not, chptr, top_chptr, source_p, &chptr->chanops_voiced, 'v'); -#endif /* Move all voice/ops etc. to non opped list */ + dlinkMoveList(&chptr->chanadmins, &chptr->peons); dlinkMoveList(&chptr->chanops, &chptr->peons); -#ifdef HALFOPS dlinkMoveList(&chptr->halfops, &chptr->peons); -#endif dlinkMoveList(&chptr->voiced, &chptr->peons); -#ifdef REQUIRE_OANDV - dlinkMoveList(&chptr->chanops_voiced, &chptr->peons); -#endif + dlinkMoveList(&chptr->locchanadmins, &chptr->locchanadmins); dlinkMoveList(&chptr->locchanops, &chptr->locpeons); -#ifdef HALFOPS dlinkMoveList(&chptr->lochalfops, &chptr->locpeons); -#endif dlinkMoveList(&chptr->locvoiced, &chptr->locpeons); -#ifdef REQUIRE_OANDV - dlinkMoveList(&chptr->locchanops_voiced, &chptr->locpeons); -#endif /* Clear all +beI modes */ free_channel_list(&chptr->banlist); diff --git a/contrib/m_ojoin.c b/modules/m_ojoin.c similarity index 86% rename from contrib/m_ojoin.c rename to modules/m_ojoin.c index 16b95c2..f5327ea 100644 --- a/contrib/m_ojoin.c +++ b/modules/m_ojoin.c @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: m_ojoin.c,v 1.2 2002/08/13 14:45:00 fishwaldo Exp $ + * $Id: m_ojoin.c,v 1.1 2002/09/17 11:03:21 fishwaldo Exp $ */ #include "stdinc.h" @@ -34,7 +34,6 @@ #include "msg.h" #include "parse.h" #include "modules.h" -#include "vchannel.h" #include "list.h" #include "channel_mode.h" @@ -58,7 +57,7 @@ _moddeinit(void) mod_del_cmd(&ojoin_msgtab); } -char *_version = "$Revision: 1.2 $"; +char *_version = "$Revision: 1.1 $"; /* ** mo_ojoin @@ -70,9 +69,6 @@ static void mo_ojoin(struct Client *client_p, struct Client *source_p, { struct Channel *chptr, *root_chptr; int move_me = 0; -#ifdef VCHANS - int on_vchan = 0; -#endif /* admins only */ if (!IsOperAdmin(source_p)) @@ -83,7 +79,7 @@ static void mo_ojoin(struct Client *client_p, struct Client *source_p, /* XXX - we might not have CBURSTed this channel if we are a lazylink * yet. */ - if (*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+') + if (*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '¤') { parv[1]++; move_me = 1; @@ -92,14 +88,6 @@ static void mo_ojoin(struct Client *client_p, struct Client *source_p, chptr= hash_find_channel(parv[1]); root_chptr = chptr; -#ifdef VCHANS - if (chptr && parc > 2 && parv[2][0] == '!') - { - chptr = find_vchan(chptr, parv[2]); - if (root_chptr != chptr) - on_vchan++; - } -#endif if( chptr == NULL ) { @@ -118,7 +106,23 @@ static void mo_ojoin(struct Client *client_p, struct Client *source_p, if (move_me == 1) parv[1]--; - if (*parv[1] == '@') + if (*parv[1] == '¤') + { + add_user_to_channel(chptr, source_p, CHFL_ADMIN); + if (chptr->chname[0] != '&') + sendto_server(client_p, source_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, + ":%s SJOIN %lu %s + :¤%s", me.name, chptr->channelts, + chptr->chname, source_p->name); + sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s", + source_p->name, + source_p->username, + source_p->host, + root_chptr->chname); + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s", + me.name, chptr->chname, source_p->name); + + } + else if (*parv[1] == '@') { add_user_to_channel(chptr, source_p, CHFL_CHANOP); if (chptr->chname[0] != '&') @@ -134,7 +138,6 @@ static void mo_ojoin(struct Client *client_p, struct Client *source_p, me.name, chptr->chname, source_p->name); } -#ifdef HALFOPS else if (*parv[1] == '%') { add_user_to_channel(chptr, source_p, CHFL_HALFOP); @@ -150,7 +153,6 @@ static void mo_ojoin(struct Client *client_p, struct Client *source_p, sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s", me.name, chptr->chname, source_p->name); } -#endif else if (*parv[1] == '+') { add_user_to_channel(chptr, source_p, CHFL_VOICE); @@ -191,11 +193,6 @@ static void mo_ojoin(struct Client *client_p, struct Client *source_p, chptr->topic_time); } - /* XXX - check this isn't too big above... */ -#ifdef VCHANS - if (on_vchan) - add_vchan_to_client_cache(source_p,root_chptr,chptr); -#endif source_p->localClient->last_join_time = CurrentTime; channel_member_names(source_p, chptr, chptr->chname, 1); diff --git a/contrib/m_opme.c b/modules/m_opme.c similarity index 65% rename from contrib/m_opme.c rename to modules/m_opme.c index 1be47a3..42f9a5e 100644 --- a/contrib/m_opme.c +++ b/modules/m_opme.c @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: m_opme.c,v 1.2 2002/08/13 14:45:00 fishwaldo Exp $ + * $Id: m_opme.c,v 1.1 2002/09/17 11:03:21 fishwaldo Exp $ */ #include "stdinc.h" #include "tools.h" @@ -33,7 +33,6 @@ #include "msg.h" #include "parse.h" #include "modules.h" -#include "vchannel.h" static void mo_opme(struct Client *client_p, struct Client *source_p, @@ -57,7 +56,7 @@ _moddeinit(void) mod_del_cmd(&opme_msgtab); } -char *_version = "$Revision: 1.2 $"; +char *_version = "$Revision: 1.1 $"; static int chan_is_opless(struct Channel *chptr) { @@ -76,7 +75,6 @@ static void mo_opme(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { struct Channel *chptr, *root_chptr; - int on_vchan = 0; dlink_node *ptr; dlink_node *locptr; @@ -93,15 +91,6 @@ static void mo_opme(struct Client *client_p, struct Client *source_p, chptr= hash_find_channel(parv[1]); root_chptr = chptr; -#ifdef VCHANS - if (chptr && parc > 2 && parv[2][0] == '!') - { - chptr = find_vchan(chptr, parv[2]); - if (root_chptr != chptr) - on_vchan++; - } -#endif - if( chptr == NULL ) { sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), @@ -118,18 +107,14 @@ static void mo_opme(struct Client *client_p, struct Client *source_p, if ((ptr = find_user_link(&chptr->peons, source_p))) dlinkDelete(ptr, &chptr->peons); + else if ((ptr = find_user_link(&chptr->chanadmins, source_p))) + dlinkDelete(ptr, &chptr->chanadmins); else if ((ptr = find_user_link(&chptr->voiced, source_p))) dlinkDelete(ptr, &chptr->voiced); -#ifdef HALFOPS else if ((ptr = find_user_link(&chptr->halfops, source_p))) dlinkDelete(ptr, &chptr->halfops); -#endif else if ((ptr = find_user_link(&chptr->chanops, source_p))) dlinkDelete(ptr, &chptr->chanops); -#ifdef REQUIRE_OANDV - else if((ptr = find_user_link(&chptr->chanops_voiced, source_p))) - dlinkDelete(ptr, &chptr->chanops_voiced); -#endif else { /* Theyre not even on the channel, bail. */ @@ -138,69 +123,47 @@ static void mo_opme(struct Client *client_p, struct Client *source_p, if((locptr = find_user_link(&chptr->locpeons, source_p))) dlinkDelete(locptr, &chptr->locpeons); + else if((locptr = find_user_link(&chptr->locchanadmins, source_p))) + dlinkDelete(locptr, &chptr->locchanadmins); else if((locptr = find_user_link(&chptr->locvoiced, source_p))) dlinkDelete(locptr, &chptr->locvoiced); -#ifdef HALFOPS else if((locptr = find_user_link(&chptr->lochalfops, source_p))) dlinkDelete(locptr, &chptr->lochalfops); -#endif else if((locptr = find_user_link(&chptr->locchanops, source_p))) dlinkDelete(locptr, &chptr->locchanops); -#ifdef REQUIRE_OANDV - else if((locptr = find_user_link(&chptr->locchanops_voiced, source_p))) - dlinkDelete(locptr, &chptr->locchanops_voiced); -#endif - else return; - dlinkAdd(source_p, ptr, &chptr->chanops); - dlinkAdd(source_p, locptr, &chptr->locchanops); + dlinkAdd(source_p, ptr, &chptr->chanadmins); + dlinkAdd(source_p, locptr, &chptr->locchanadmins); - if (!on_vchan) - { - sendto_wallops_flags(FLAGS_WALLOP, &me, - "OPME called for [%s] by %s!%s@%s", - parv[1], source_p->name, source_p->username, - source_p->host); - sendto_server(NULL, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, - ":%s WALLOPS :OPME called for [%s] by %s!%s@%s", - me.name, parv[1], source_p->name, source_p->username, - source_p->host); - ilog(L_NOTICE, "OPME called for [%s] by %s!%s@%s", - parv[1], source_p->name, source_p->username, - source_p->host); - } - else - { - sendto_wallops_flags(FLAGS_WALLOP, &me, - "OPME called for [%s %s] by %s!%s@%s", - parv[1], parv[2], source_p->name, - source_p->username, source_p->host); - sendto_server(NULL, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, - ":%s WALLOPS :OPME called for [%s %s] by %s!%s@%s", - me.name, parv[1], parv[2], source_p->name, - source_p->username, source_p->host); - ilog(L_NOTICE, "OPME called for [%s %s] by %s!%s@%s", - parv[1], parv[2], source_p->name, source_p->username, - source_p->host); - } + sendto_wallops_flags(FLAGS_WALLOP, &me, + "OPME called for [%s] by %s!%s@%s", + parv[1], source_p->name, source_p->username, + source_p->host); + sendto_server(NULL, source_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, + ":%s WALLOPS :OPME called for [%s] by %s!%s@%s", + me.name, parv[1], source_p->name, source_p->username, + source_p->host); + ilog(L_NOTICE, "OPME called for [%s] by %s!%s@%s", + parv[1], source_p->name, source_p->username, + source_p->host); sendto_server(NULL, source_p, chptr, CAP_UID, NOCAPS, NOFLAGS, ":%s PART %s", ID(source_p), parv[1]); sendto_server(NULL, source_p, chptr, NOCAPS, CAP_UID, NOFLAGS, ":%s PART %s", source_p->name, parv[1]); sendto_server(NULL, source_p, chptr, CAP_UID, NOCAPS, NOFLAGS, - ":%s SJOIN %ld %s + :@%s", + ":%s SJOIN %ld %s + :¤%s", me.name, (signed long) chptr->channelts, parv[1], source_p->name /* XXX ID(source_p) */ ); sendto_server(NULL, source_p, chptr, NOCAPS, CAP_UID, NOFLAGS, - ":%s SJOIN %ld %s + :@%s", + ":%s SJOIN %ld %s + :¤%s", me.name, (signed long) chptr->channelts, parv[1], source_p->name); sendto_channel_local(ALL_MEMBERS, chptr, - ":%s MODE %s +o %s", + ":%s MODE %s +a %s", me.name, parv[1], source_p->name); } diff --git a/modules/m_svscmds.c b/modules/m_svscmds.c index 51c46e6..b65f625 100644 --- a/modules/m_svscmds.c +++ b/modules/m_svscmds.c @@ -16,13 +16,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: m_svscmds.c,v 1.4 2002/09/13 16:30:03 fishwaldo Exp $ + * $Id: m_svscmds.c,v 1.5 2002/09/17 11:03:21 fishwaldo Exp $ */ /* List of ircd includes from ../include/ */ #include "stdinc.h" #include "handlers.h" #include "client.h" +#include "channel.h" +#include "channel_mode.h" #include "common.h" /* FALSE bleah */ #include "ircd.h" #include "irc_string.h" @@ -57,6 +59,13 @@ static void ms_svsnick(struct Client *client_p, struct Client *source_p, static void ms_svsid(struct Client *client_p, struct Client *source_p, int parc, char *parv[]); +static void ms_svsjoin(struct Client *client_p, struct Client *source_p, + int parc, char *parv[]); +static void ms_svspart(struct Client *client_p, struct Client *source_p, + int parc, char *parv[]); + + + static int clean_nick_name(char *); @@ -73,12 +82,21 @@ struct Message svsnick_msgtab = { {m_ignore, m_ignore, ms_svsnick, m_ignore} }; - struct Message svsid_msgtab = { "SVSID", 0, 0, 3, 3, MFLG_SLOW, 0, {m_ignore, m_ignore, ms_svsid, m_ignore} }; +struct Message svsjoin_msgtab = { + "SVSJOIN", 0, 0, 3, 0, MFLG_SLOW, 0, + {m_ignore, m_ignore, ms_svsjoin, m_ignore} +}; +struct Message svspart_msgtab = { + "SVSPART", 0, 0, 3, 0, MFLG_SLOW, 0, + {m_ignore, m_ignore, ms_svspart, m_ignore} +}; + + /* Thats the msgtab finished */ #ifndef STATIC_MODULES @@ -90,6 +108,8 @@ _modinit(void) mod_add_cmd(&svshost_msgtab); mod_add_cmd(&svsnick_msgtab); mod_add_cmd(&svsid_msgtab); + mod_add_cmd(&svsjoin_msgtab); + mod_add_cmd(&svspart_msgtab); } /* here we tell it what to do when the module is unloaded */ @@ -100,11 +120,13 @@ _moddeinit(void) mod_del_cmd(&svshost_msgtab); mod_del_cmd(&svsnick_msgtab); mod_del_cmd(&svsid_msgtab); + mod_del_cmd(&svsjoin_msgtab); + mod_del_cmd(&svspart_msgtab); } /* When we last modified the file (shown in /modlist), this is usually: */ -const char *_version = "$Revision: 1.4 $"; +const char *_version = "$Revision: 1.5 $"; #endif /* @@ -265,3 +287,241 @@ static void ms_svsid(struct Client *client_p, struct Client *source_p, return; } + +/* + * m_svsjoin + * parv[0] = sender prefix + * parv[1] = user to force + * parv[2] = channel to force them into + */ +static void ms_svsjoin(struct Client *client_p, struct Client *source_p, + int parc, char *parv[]) +{ + struct Client *target_p; + struct Channel *chptr; + int type; + char mode; + char sjmode; + char *newch; + + /* if its from a client, and its not services, ignore it */ + if(!IsServices(source_p) && IsClient(source_p)) + { + sendto_one(source_p, ":%s NOTICE %s :Restricted to Services", me.name, parv[0]); + return; + } + /* if its from a server, and its not ulined, ignore it */ + if (!IsUlined(source_p) && IsServer(source_p)) + return; + + if((hunt_server(client_p, source_p, ":%s FORCEJOIN %s %s", 1, parc, parv)) != HUNTED_ISME) + return; + + /* if target_p is not existant, print message + * to source_p and bail - scuzzy + */ + if ((target_p = find_client(parv[1])) == NULL) + { + if (IsClient(source_p)) sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, + source_p->name, parv[1]); + return; + } + + if(!IsClient(target_p)) + return; + + /* select our modes from parv[2] if they exist... (chanop)*/ + if(*parv[2] == '¤') + { + type = CHFL_ADMIN; + mode = 'a'; + sjmode = '¤'; + } + if(*parv[2] == '@') + { + type = CHFL_CHANOP; + mode = 'o'; + sjmode = '@'; + } + else if(*parv[2] == '%') + { + type = CHFL_HALFOP; + mode = 'h'; + sjmode = '%'; + } + else if(*parv[2] == '+') + { + type = CHFL_VOICE; + mode = 'v'; + sjmode = '+'; + } + else + { + type = CHFL_PEON; + mode = sjmode = '\0'; + } + + if(mode != '\0') + parv[2]++; + + if((chptr = hash_find_channel(parv[2])) != NULL) + { + if(IsMember(target_p, chptr)) + { + /* debugging is fun... */ + if (IsClient(source_p)) sendto_one(source_p, ":%s NOTICE %s :*** Notice -- %s is already in %s", me.name, + source_p->name, target_p->name, chptr->chname); + return; + } + + add_user_to_channel(chptr, target_p, type); + + if (chptr->chname[0] != '&') + sendto_server(target_p, target_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, + ":%s SJOIN %lu %s + :%c%s", + me.name, (unsigned long) chptr->channelts, + chptr->chname, type ? sjmode : ' ', target_p->name); + + sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s", + target_p->name, target_p->username, + target_p->host, chptr->chname); + + if(type) + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s", + me.name, chptr->chname, mode, target_p->name); + + if(chptr->topic != NULL) + { + sendto_one(target_p, form_str(RPL_TOPIC), me.name, + target_p->name, chptr->chname, chptr->topic); + sendto_one(target_p, form_str(RPL_TOPICWHOTIME), + me.name, source_p->name, chptr->chname, + chptr->topic_info, chptr->topic_time); + } + + channel_member_names(target_p, chptr, chptr->chname, 1); + } + else + { + newch = parv[2]; + if (!check_channel_name(newch)) + { + if (IsClient(source_p)) sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, + source_p->name, (unsigned char*)newch); + return; + } + + /* channel name must begin with & or # */ + if (!IsChannelName(newch)) + { + if (IsClient(source_p)) sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, + source_p->name, (unsigned char*)newch); + return; + } + + /* it would be interesting here to allow an oper + * to force target_p into a channel that doesn't exist + * even more so, into a local channel when we disable + * local channels... but... + * I don't want to break anything - scuzzy + */ + if (ConfigServerHide.disable_local_channels && + (*newch == '&')) + { + if (IsClient(source_p)) sendto_one(source_p, ":%s NOTICE %s :No such channel (%s)", me.name, + source_p->name, newch); + return; + } + + /* newch can't be longer than CHANNELLEN */ + if (strlen(newch) > CHANNELLEN) + { + if (IsClient(source_p)) sendto_one(source_p, ":%s NOTICE %s :Channel name is too long", me.name, + source_p->name); + return; + } + + chptr = get_or_create_channel(target_p, newch, NULL); + add_user_to_channel(chptr, target_p, CHFL_CHANOP); + + /* send out a join, make target_p join chptr */ + if (chptr->chname[0] != '&') + sendto_server(target_p, target_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, + ":%s SJOIN %lu %s +nt :¤%s", me.name, + (unsigned long) chptr->channelts, chptr->chname, + target_p->name); + + sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s", + target_p->name, target_p->username, + target_p->host, chptr->chname); + + chptr->mode.mode |= MODE_TOPICLIMIT; + chptr->mode.mode |= MODE_NOPRIVMSGS; + + sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt", me.name, + chptr->chname); + + target_p->localClient->last_join_time = CurrentTime; + channel_member_names(target_p, chptr, chptr->chname, 1); + + } +} + + +static void ms_svspart(struct Client *client_p, struct Client *source_p, + int parc, char *parv[]) +{ + struct Client *target_p; + struct Channel *chptr; + + /* if its from a client, and its not services, ignore it */ + if(!IsServices(source_p) && IsClient(source_p)) + { + sendto_one(source_p, ":%s NOTICE %s :Restricted to Services", me.name, parv[0]); + return; + } + /* if its from a server, and its not ulined, ignore it */ + if (!IsUlined(source_p) && IsServer(source_p)) + return; + + if((hunt_server(client_p, source_p, ":%s FORCEPART %s %s", 1, parc, parv)) != HUNTED_ISME) + return; + + /* if target_p == NULL then let the oper know */ + if ((target_p = find_client(parv[1])) == NULL) + { + if (IsClient(source_p)) sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, + source_p->name, parv[1]); + return; + } + + if(!IsClient(target_p)) + return; + + if((chptr = hash_find_channel(parv[2])) == NULL) + { + if (IsClient(source_p)) sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), + me.name, parv[0], parv[1]); + return; + } + + if (!IsMember(target_p, chptr)) + { + if (IsClient(source_p)) sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL), + me.name, parv[0], parv[2], parv[1]); + return; + } + + if (chptr->chname[0] != '&') + sendto_server(target_p, target_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, + ":%s PART %s :%s", + target_p->name, chptr->chname, + target_p->name); + + sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s", + target_p->name, target_p->username, + target_p->host,chptr->chname, + target_p->name); + remove_user_from_channel(chptr, target_p); +} +