Removed all vchan code, and finished hyrbid rc2 merge

This commit is contained in:
fishwaldo 2002-09-02 04:11:00 +00:00
parent 88ac1e100c
commit 9a6d4b61fd
54 changed files with 337 additions and 2006 deletions

3
.gitattributes vendored
View file

@ -300,7 +300,6 @@ include/sprintf_irc.h -text
include/stdinc.h -text
include/supported.h -text
include/tools.h -text
include/vchannel.h -text
include/whowas.h -text
/make.com -text
messages/.cvsignore -text
@ -341,7 +340,6 @@ modules/m_away.c -text
modules/m_capab.c -text
modules/m_cburst.c -text
modules/m_challenge.c -text
modules/m_cjoin.c -text
modules/m_close.c -text
modules/m_connect.c -text
modules/m_cryptlink.c -text
@ -466,7 +464,6 @@ src/send.c -text
src/snprintf.c -text
src/sprintf_irc.c -text
src/tools.c -text
src/vchannel.c -text
src/version.c.SH -text
src/version.com -text
src/whowas.c -text

View file

@ -27,3 +27,4 @@ Symbols are:
(HP) - Big arse rc2 patch for Hybrid. Sigh. Found a cute bug in hybrid that would allow it to accept any password for /oper though!
(F) - Removed all ifdef HALFOP ANONOP VCHAN defines, as these will be standard in NeoIRCd
(F) - Removed all OANDVcode as its not going to be used at all
(F) - Removed all Vchan Code and finished rc2 patch from hybrid merge

5
TODO
View file

@ -1,4 +1,7 @@
$Id: TODO,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $
$Id: TODO,v 1.4 2002/09/02 04:10:59 fishwaldo Exp $
invites and exception list (and invite exception lists) should
override a oper only channel :)
server<->server channel modes... Do they work?

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: channel.h,v 1.4 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: channel.h,v 1.5 2002/09/02 04:10:59 fishwaldo Exp $
*/
#ifndef INCLUDED_channel_h
@ -54,18 +54,11 @@ struct Channel
char *topic;
char *topic_info;
time_t topic_time;
#ifdef VCHANS
char vchan_id[NICKLEN*2]; /* use this for empty vchans */
#endif
int users; /* user count */
int locusers; /* local user count */
unsigned long lazyLinkChannelExists;
time_t users_last; /* when last user was in channel */
time_t last_knock; /* don't allow knock to flood */
#ifdef VCHANS
struct Channel *root_chptr; /* pointer back to root if vchan */
dlink_list vchan_list; /* vchan sublist */
#endif
dlink_list chanadmins; /* list of Channel Admins */
dlink_list chanops; /* lists of chanops etc. */
dlink_list halfops;
@ -158,7 +151,7 @@ struct Ban /* also used for exceptions -orabidoo */
};
#define CLEANUP_CHANNELS_TIME (30*60)
#define MAX_VCHAN_TIME (60*60)
//#undef MAX_VCHAN_TIME (60*60)
/* Number of chanops, peon, voiced, halfops sublists */
#ifdef REQUIRE_OANDV
#define NUMLISTS 6

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: client.h,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $
* $Id: client.h,v 1.4 2002/09/02 04:10:59 fishwaldo Exp $
*/
#ifndef INCLUDED_client_h
@ -112,14 +112,6 @@ struct ZipStats
double out_ratio;
};
/* entry for base_chan pointer and the corresponding vchan
* client is actually on
*/
struct Vchan_map
{
struct Channel *base_chan;
struct Channel *vchan;
};
struct Client
{
@ -192,11 +184,6 @@ struct Client
*/
char vhost[HOSTLEN +1];
/* cache table of mappings between top level chan and sub vchan client
* is on.
*/
dlink_list vchan_map;
/* caller ID allow list */
/* This has to be here, since a client on an on_allow_list could

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: config.h,v 1.2 2002/08/13 14:45:10 fishwaldo Exp $
* $Id: config.h,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#ifndef INCLUDED_config_h
@ -296,7 +296,6 @@
* If you have enabled efnet specific code these will be disabled automatically
* else they are here for anyone else.
*/
#define VCHANS
#define ANONOPS
#define HALFOPS

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: config.h.dist,v 1.2 2002/08/13 14:45:10 fishwaldo Exp $
* $Id: config.h.dist,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#ifndef INCLUDED_config_h
@ -296,7 +296,6 @@
* If you have enabled efnet specific code these will be disabled automatically
* else they are here for anyone else.
*/
#define VCHANS
#define ANONOPS
#define HALFOPS

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: numeric.h,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: numeric.h,v 1.4 2002/09/02 04:10:59 fishwaldo Exp $
*/
#ifndef INCLUDED_numeric_h
@ -402,7 +402,7 @@ extern const char* form_str(int);
/* ERR_RESTRICTED 484 IRCnet extension */
/* ERR_UNIQOPRIVSNEEDED 485 IRCnet extension */
/* ERR_KILLDENY 485 unreal */
/* ERR_CANTKICKADMIN 485 PTlink */
#define ERR_CHANAPRIVSNEEDED 499
/* ERR_HTMDISABLED 486 unreal */
/* ERR_CHANTOORECENT 487 IRCnet extension (?) */
/* ERR_TSLESSCHAN 488 IRCnet extension (?) */

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_conf.h,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: s_conf.h,v 1.4 2002/09/02 04:10:59 fishwaldo Exp $
*/
#ifndef INCLUDED_s_conf_h
@ -242,7 +242,6 @@ struct config_channel_entry
{
int knock_delay;
int knock_delay_channel;
int vchans_oper_only;
int max_bans;
int max_chans_per_user;
int no_create_on_split;

View file

@ -1,95 +0,0 @@
/*
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
* vchannel.h: Header for the virtual channels.
*
* Copyright (C) 2002 by the past and present ircd coders, and others.
*
* 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
*
* $Id: vchannel.h,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
*/
#ifndef INCLUDED_vchannel_h
#define INCLUDED_vchannel_h
#include "channel.h"
#include "ircd_defs.h"
struct Client;
struct Channel;
#ifdef VCHANS
extern void add_vchan_to_client_cache(struct Client *source_p,
struct Channel *base_chan,
struct Channel *vchan);
extern void del_vchan_from_client_cache(struct Client *source_p,
struct Channel *vchan);
extern struct Channel* map_vchan(struct Channel *chptr, struct Client *source_p);
extern struct Channel* find_bchan(struct Channel *chptr);
extern void show_vchans(struct Client *source_p,
struct Channel *chptr,
char *command);
/* pick a nickname from the channel, to show as an ID */
extern char* pick_vchan_id(struct Channel *chptr);
/* find a matching vchan with a !key (nick) */
extern struct Channel* find_vchan(struct Channel *, char *);
/* See if this client is on a sub chan already */
extern int on_sub_vchan(struct Channel *chptr, struct Client *source_p);
/* Check for an invite to any of the vchans */
extern struct Channel* vchan_invites(struct Channel *chptr,
struct Client *source_p);
/* Select which vchan to use for JOIN */
extern struct Channel* select_vchan(struct Channel *root,
struct Client *source_p,
char *vkey,
char *name);
/* Create a new vchan for cjoin */
extern struct Channel* cjoin_channel(struct Channel *root,
struct Client *source_p,
char *name);
/* Valid to verify a channel is a subchan */
#define IsVchan(chan) ((chan)->root_chptr != 0)
/* Only valid for top chan, i.e. only valid to determine if there are vchans
* under hash table lookup of top level channel
*/
#define HasVchans(chan) ((chan)->vchan_list.head)
/* Valid to determine if this is the top of a set of vchans */
#define IsVchanTop(chan) \
(((chan)->root_chptr == 0) && ((chan)->vchan_list.head))
#define RootChan(chan) \
(((chan)->root_chptr == 0) ? (chan) : ((chan)->root_chptr))
#else
#define RootChan(chan) (chan)
#endif /* VCHANS */
#endif /* INCLUDED_vchannel_h */

View file

@ -1,7 +1,7 @@
#
# Makefile.in for ircd/modules
#
# $Id: Makefile.in,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
# $Id: Makefile.in,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
#
CC = @CC@
AR = @AR@
@ -55,7 +55,6 @@ SRCS = \
m_capab.c \
m_cburst.c \
m_challenge.c \
m_cjoin.c \
m_close.c \
m_connect.c \
m_cryptlink.c \

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_kick.c,v 1.4 2002/08/20 15:06:30 fishwaldo Exp $
* $Id: m_kick.c,v 1.5 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -27,7 +27,6 @@
#include "handlers.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "irc_string.h"
#include "ircd.h"
@ -60,7 +59,7 @@ _moddeinit(void)
mod_del_cmd(&kick_msgtab);
}
const char *_version = "$Revision: 1.4 $";
const char *_version = "$Revision: 1.5 $";
#endif
/*
** m_kick
@ -76,9 +75,6 @@ static void m_kick(struct Client *client_p,
{
struct Client *who;
struct Channel *chptr;
#ifdef VCHANS
struct Channel *vchan;
#endif
int chasing = 0;
char *comment;
char *name;
@ -117,16 +113,6 @@ static void m_kick(struct Client *client_p,
return;
}
#ifdef VCHANS
if (HasVchans(chptr))
{
vchan = map_vchan(chptr,source_p);
if(vchan != 0)
{
chptr = vchan;
}
}
#endif
if (!IsServer(source_p) && !is_any_op(chptr, source_p) )
{

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_message.c,v 1.2 2002/08/14 06:01:55 fishwaldo Exp $
* $Id: m_message.c,v 1.3 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -37,7 +37,6 @@
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "irc_string.h"
#include "hash.h"
#include "class.h"
@ -123,7 +122,7 @@ _moddeinit(void)
mod_del_cmd(&notice_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
@ -455,12 +454,8 @@ msg_channel(int p_or_n, char *command,
char *chname = NULL;
int result;
chname = RootChan(chptr)->chname;
chname = chptr->chname;
#ifdef VCHANS
if (HasVchans(chptr))
vchan = map_vchan(chptr, source_p);
#endif
if (!vchan)
vchan = chptr;
@ -529,12 +524,8 @@ msg_channel_flags(int p_or_n, char *command, struct Client *client_p,
c = '@';
}
chname = RootChan(chptr)->chname;
chname = chptr->chname;
#ifdef VCHANS
if (HasVchans(chptr))
vchan = map_vchan(chptr, source_p);
#endif
if (!vchan)
vchan = chptr;

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_mode.c,v 1.2 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: m_mode.c,v 1.3 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -27,7 +27,6 @@
#include "handlers.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "hash.h"
#include "irc_string.h"
@ -63,7 +62,7 @@ _moddeinit(void)
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* m_mode - MODE command handler
@ -79,9 +78,6 @@ static void m_mode(struct Client *client_p, struct Client *source_p,
static char parabuf[MODEBUFLEN];
dlink_node *ptr;
int n = 2;
#ifdef VCHANS
struct Channel* vchan;
#endif
/* Now, try to find the channel in question */
if (!IsChanPrefix(parv[1][0]))
@ -143,49 +139,6 @@ static void m_mode(struct Client *client_p, struct Client *source_p,
root = chptr;
#ifdef VCHANS
if ((parc > 2) && parv[2][0] == '!')
{
struct Client *target_p;
if (!(target_p = find_client(++parv[2])))
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), me.name,
parv[0], root->chname);
return;
}
if ((chptr = map_vchan(root, target_p)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), me.name,
parv[0], root->chname);
return;
}
n++;
}
else
{
if (HasVchans(chptr))
{
if ((vchan = map_vchan(chptr,source_p)) != NULL)
chptr = vchan; /* root = chptr, chptr = vchan */
/* XXX - else? the user isn't on any vchan, so we
* end up giving them the mode of the root
* channel. MODE #vchan !nick ? (ugh)
*/
}
else if (IsVchan(chptr))
{
vchan = find_bchan(chptr);
root = vchan; /* root = vchan, chptr = chptr */
/* XXX - else? the user isn't on any vchan,
* but they asked for MODE ##vchan_12345
* we send MODE #vchan
*/
}
}
#endif
if (parc < n+1)
{

View file

@ -19,14 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_part.c,v 1.2 2002/08/14 06:01:55 fishwaldo Exp $
* $Id: m_part.c,v 1.3 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
#include "tools.h"
#include "handlers.h"
#include "channel.h"
#include "vchannel.h"
#include "client.h"
#include "common.h"
#include "hash.h"
@ -62,7 +61,7 @@ _moddeinit(void)
{
mod_del_cmd(&part_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
static void part_one_client(struct Client *client_p,
@ -134,23 +133,6 @@ static void part_one_client(struct Client *client_p,
return;
}
#ifdef VCHANS
if (IsVchan(chptr) || HasVchans(chptr))
{
if(HasVchans(chptr))
{
/* Set chptr to actual channel, bchan to the base channel */
bchan = chptr;
chptr = map_vchan(bchan,source_p);
}
else
{
/* chptr = chptr; */
bchan = find_bchan(chptr);
}
}
else
#endif
bchan = chptr; /* not a vchan */
if (!chptr || !bchan || !IsMember(source_p, chptr))

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_sjoin.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: m_sjoin.c,v 1.4 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -27,7 +27,6 @@
#include "handlers.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "hash.h"
#include "irc_string.h"
@ -63,7 +62,7 @@ _moddeinit(void)
mod_del_cmd(&sjoin_msgtab);
}
const char *_version = "$Revision: 1.3 $";
const char *_version = "$Revision: 1.4 $";
#endif
/*
* ms_sjoin
@ -124,9 +123,6 @@ static void ms_sjoin(struct Client *client_p,
dlink_node *m;
static char sjbuf_hops[BUFSIZE]; /* buffer with halfops as % */
register char *hops;
#ifdef VCHANS
int vc_ts = 0;
#endif
*buf = '\0';
*sjbuf_hops = '\0';
@ -196,63 +192,7 @@ static void ms_sjoin(struct Client *client_p,
if ((chptr = get_or_create_channel(source_p, parv[2], &isnew)) == NULL)
return; /* channel name too long? */
/* XXX vchan cruft */
/* vchans are encoded as "##mainchanname_timestamp" */
#ifdef VCHANS
if (parv[2][1] == '#')
{
char *subp;
/* possible sub vchan being sent along ? */
if ((subp = strrchr(parv[2],'_')))
{
vc_ts = atol(subp+1);
/*
* XXX - Could be a vchan, but we can't be _sure_
*
* We now test the timestamp matches below,
* but that can still be faked.
*
* If there was some way to pass an extra bit of
* information over non-hybrid-7 servers, through SJOIN,
* we could tell other servers that it's a vchan.
* That's probably not possible, unfortunately :(
*/
*subp = '\0'; /* fugly hack for now ... */
/* + 1 skip the extra '#' in the name */
if ((top_chptr = hash_find_channel(parv[2] + 1)) != NULL)
{
/* If the vchan is already in the vchan_list for this
* root, don't re-add it.
*/
/* Compare timestamps too */
if (dlinkFind(&top_chptr->vchan_list,chptr) == NULL &&
newts == vc_ts)
{
m = make_dlink_node();
dlinkAdd(chptr, m, &top_chptr->vchan_list);
chptr->root_chptr=top_chptr;
}
}
/* check TS before creating a root channel */
else if (newts == vc_ts)
{
top_chptr = get_or_create_channel(source_p, (parv[2] + 1), NULL);
m = make_dlink_node();
dlinkAdd(chptr, m, &top_chptr->vchan_list);
chptr->root_chptr=top_chptr;
/* let users access it somehow... */
chptr->vchan_id[0] = '!';
chptr->vchan_id[1] = '\0';
}
*subp = '_'; /* fugly hack, restore '_' */
}
}
#endif
oldts = chptr->channelts;
@ -524,7 +464,7 @@ static void ms_sjoin(struct Client *client_p,
continue;
/* Ignore servers we won't tell anyway */
if (!(RootChan(chptr)->lazyLinkChannelExists &
if (!(chptr->lazyLinkChannelExists &
lclient_p->localClient->serverMask) )
continue;
@ -545,18 +485,6 @@ static void ms_sjoin(struct Client *client_p,
add_user_to_channel(chptr, target_p, fl);
/* XXX vchan stuff */
#ifdef VCHANS
if (top_chptr)
{
add_vchan_to_client_cache(target_p,top_chptr, chptr);
sendto_channel_local(ALL_MEMBERS,chptr, ":%s!%s@%s JOIN :%s",
target_p->name,
target_p->username,
target_p->vhost,
top_chptr->chname);
}
else
#endif
{
sendto_channel_local(ALL_MEMBERS,chptr, ":%s!%s@%s JOIN :%s",
target_p->name,
@ -570,32 +498,6 @@ static void ms_sjoin(struct Client *client_p,
{
*mbuf++ = 'o';
para[pargs++] = s;
#ifdef REQUIRE_OANDV
/* a +ov user.. bleh */
if(fl & MODE_VOICE)
{
/* its possible the +o has filled up MAXMODEPARAMS, if so, start
* a new buffer
*/
if(pargs >= MAXMODEPARAMS)
{
*mbuf = '\0';
sendto_channel_local(hide_or_not, chptr,
":%s MODE %s %s %s %s %s %s",
me.name, RootChan(chptr)->chname,
modebuf,
para[0], para[1], para[2], para[3]);
mbuf = modebuf;
*mbuf++ = '+';
para[0] = para[1] = para[2] = para[3] = "";
pargs = 0;
}
*mbuf++ = 'v';
para[pargs++] = s;
}
#endif
}
else if (fl & MODE_VOICE)
{
@ -614,7 +516,7 @@ static void ms_sjoin(struct Client *client_p,
sendto_channel_local(hide_or_not, chptr,
":%s MODE %s %s %s %s %s %s",
me.name,
RootChan(chptr)->chname,
chptr->chname,
modebuf,
para[0],para[1],para[2],para[3]);
mbuf = modebuf;
@ -650,7 +552,7 @@ nextnick:
sendto_channel_local(hide_or_not, chptr,
":%s MODE %s %s %s %s %s %s",
me.name,
RootChan(chptr)->chname,
chptr->chname,
modebuf,
para[0], para[1], para[2], para[3]);
}
@ -669,7 +571,7 @@ nextnick:
/* skip lazylinks that don't know about this server */
if (ServerInfo.hub && IsCapable(target_p,CAP_LL))
{
if (!(RootChan(chptr)->lazyLinkChannelExists &
if (!(chptr->lazyLinkChannelExists &
target_p->localClient->serverMask) )
continue;
}
@ -846,10 +748,6 @@ static void remove_a_mode( int hide_or_not,
chname = chptr->chname;
#ifdef VCHANS
if (IsVchan(chptr) && top_chptr)
chname = top_chptr->chname;
#endif
ircsprintf(buf,":%s MODE %s ", me.name, chname);

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_admin.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_admin.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -60,7 +60,7 @@ _moddeinit(void)
hook_del_event("doing_admin");
mod_del_cmd(&admin_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* mr_admin - ADMIN command handler
@ -123,7 +123,8 @@ static void ms_admin(struct Client *client_p, struct Client *source_p,
if (hunt_server(client_p,source_p,":%s ADMIN :%s",1,parc,parv) != HUNTED_ISME)
return;
do_admin( source_p );
if(IsClient(source_p))
do_admin(source_p);
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_away.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_away.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -55,7 +55,7 @@ _moddeinit(void)
{
mod_del_cmd(&away_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/***********************************************************************
* m_away() - Added 14 Dec 1988 by jto.
@ -83,14 +83,9 @@ static void m_away(struct Client *client_p,
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
/* make sure the user exists */
if (!(source_p->user))
{
sendto_realops_flags(FLAGS_DEBUG, L_ALL,
"Got AWAY from nil user, from %s (%s)",
client_p->name, source_p->name);
return;
}
if(!IsClient(source_p))
return;
away = source_p->user->away;
if (parc < 2 || !*awy2)

View file

@ -1,215 +0,0 @@
/*
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
* m_cjoin.c: Creates a vchan.
*
* Copyright (C) 2002 by the past and present ircd coders, and others.
*
* 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
*
* $Id: m_cjoin.c,v 1.4 2002/08/20 15:06:29 fishwaldo Exp $
*/
#include "stdinc.h"
#include "tools.h"
#include "handlers.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "common.h" /* bleah */
#include "hash.h"
#include "irc_string.h"
#include "ircd.h"
#include "list.h"
#include "numeric.h"
#include "send.h"
#include "s_serv.h"
#include "s_conf.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
#ifdef VCHANS
static void m_cjoin(struct Client*, struct Client*, int, char**);
struct Message cjoin_msgtab = {
"CJOIN", 0, 0, 2, 0, MFLG_SLOW, 0,
{m_unregistered, m_cjoin, m_ignore, m_cjoin}
};
#endif
#ifndef STATIC_MODULES
void
_modinit(void)
{
#ifdef VCHANS
mod_add_cmd(&cjoin_msgtab);
#endif
}
void
_moddeinit(void)
{
#ifdef VCHANS
mod_del_cmd(&cjoin_msgtab);
#endif
}
const char *_version = "$Revision: 1.4 $";
#endif /* STATIC_MODULES */
#ifdef VCHANS
/*
** m_cjoin
** parv[0] = sender prefix
** parv[1] = channel
** parv[2] = channel password (key)
*/
static void m_cjoin(struct Client *client_p,
struct Client *source_p,
int parc,
char *parv[])
{
static char jbuf[BUFSIZE];
struct Channel *chptr = NULL;
struct Channel *vchan_chptr = NULL;
struct Channel *root_vchan = NULL;
char *name;
char *p = NULL;
if (!(source_p->user))
{
/* something is *fucked* - bail */
return;
}
if (ConfigChannel.vchans_oper_only && !IsOper(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
me.name, parv[0]);
return;
}
if (*parv[1] == '\0')
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, parv[0], "CJOIN");
return;
}
/* Ok, only allowed to CJOIN already existing channels
* so first part simply verifies the "root" channel exists first
*/
*jbuf = '\0';
name = parv[1];
if ( (p = strchr(name,',')) )
*p = '\0';
if (!check_channel_name(name))
{
sendto_one(source_p, form_str(ERR_BADCHANNAME),
me.name, parv[0], (unsigned char*) name);
return;
}
if (*name == '&')
{
sendto_one(source_p, form_str(ERR_BADCHANNAME),
me.name, parv[0], (unsigned char*) name);
return;
}
if (!IsChannelName(name))
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
me.name, parv[0], name);
return;
}
strlcpy(jbuf, name, sizeof(jbuf));
if ((chptr = hash_find_channel(name)) == NULL)
{
/* if chptr isn't found locally, it =could= exist
* on the uplink. So ask.
*/
if ( !ServerInfo.hub && uplink &&
IsCapable(uplink, CAP_LL))
{
/* cache the channel if it exists on uplink
* If the channel as seen by the uplink, has vchans,
* the uplink will have to SJOIN all of those.
*/
sendto_one(uplink, ":%s CBURST %s !%s",
me.name, parv[1], source_p->name);
return;
}
else
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
me.name, source_p->name, name);
}
return;
}
if (! (vchan_chptr = cjoin_channel(chptr, source_p, name)) )
return;
root_vchan = chptr;
chptr = vchan_chptr;
/*
** Complete user entry to the new channel
*/
add_user_to_channel(chptr, source_p, CHFL_ADMIN);
sendto_channel_local(ALL_MEMBERS, chptr,
":%s!%s@%s JOIN :%s",
source_p->name,
source_p->username,
source_p->vhost,
root_vchan->chname);
sendto_server(client_p, NULL, chptr, NOCAPS, NOCAPS, NOFLAGS,
":%s SJOIN %lu %s + :@%s",
me.name,
(unsigned long) chptr->channelts,
chptr->chname,
source_p->name);
vchan_chptr->mode.mode |= MODE_TOPICLIMIT;
vchan_chptr->mode.mode |= MODE_NOPRIVMSGS;
sendto_channel_local(ALL_MEMBERS,chptr,
":%s MODE %s +nt",
me.name,
root_vchan->chname);
sendto_server(source_p, NULL, vchan_chptr, NOCAPS, NOCAPS, NOFLAGS,
":%s MODE %s +nt",
me.name,
vchan_chptr->chname);
del_invite(vchan_chptr, source_p);
channel_member_names(source_p, vchan_chptr, root_vchan->chname, 1);
}
#endif /* VCHANS */

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_cryptlink.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_cryptlink.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
/*
@ -68,7 +68,7 @@
void _modinit(void) {}
void _moddeinit(void) {}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
#else
@ -114,7 +114,7 @@ _moddeinit(void)
mod_del_cmd(&cryptlink_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
@ -412,9 +412,9 @@ static void cryptlink_serv(struct Client *client_p, struct Client *source_p,
/*
* if we are connecting (Handshake), we already have the name from the
* C:line in client_p->name
* connect {} block in client_p->name
*/
strlcpy(client_p->name, name, HOSTLEN);
strlcpy(client_p->name, name, HOSTLEN + 1);
p = info;

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_gline.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_gline.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -32,7 +32,6 @@
#include "config.h"
#include "irc_string.h"
#include "ircd.h"
#include "m_kline.h"
#include "hostmask.h"
#include "numeric.h"
#include "fdlist.h"
@ -114,7 +113,7 @@ _moddeinit(void)
mod_del_cmd(&gline_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* mo_gline()
@ -131,10 +130,9 @@ const char *_version = "$Revision: 1.2 $";
*
*/
static void mo_gline(struct Client *client_p,
struct Client *source_p,
int parc,
char *parv[])
static void
mo_gline(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
char *user = NULL;
char *host = NULL; /* user and host of GLINE "victim" */
@ -146,7 +144,8 @@ static void mo_gline(struct Client *client_p,
{
if (!IsOperGline(source_p))
{
sendto_one(source_p,":%s NOTICE %s :You need gline = yes;",me.name,parv[0]);
sendto_one(source_p,
":%s NOTICE %s :You need gline = yes;",me.name,parv[0]);
return;
}
@ -154,10 +153,14 @@ static void mo_gline(struct Client *client_p,
{
/* Explicit user@host mask given */
if(host) /* Found user@host */
if(host != NULL) /* Found user@host */
{
user = parv[1]; /* here is user part */
*(host++) = '\0'; /* and now here is host */
/* gline for "@host", use *@host */
if(*user == '\0')
user = "*";
}
else
{
@ -168,23 +171,26 @@ static void mo_gline(struct Client *client_p,
if (!*host) /* duh. no host found, assume its '*' host */
host = "*";
strlcpy(tempuser, user, USERLEN); /* allow for '*' */
strlcpy(temphost, host, HOSTLEN);
strlcpy(tempuser, user, USERLEN + 1); /* allow for '*' */
strlcpy(temphost, host, HOSTLEN + 1);
user = tempuser;
host = temphost;
}
else
{
sendto_one(source_p, ":%s NOTICE %s :Can't G-Line a nick use user@host",
me.name,
parv[0]);
sendto_one(source_p,
":%s NOTICE %s :Can't G-Line a nick use user@host",
me.name, parv[0]);
return;
}
if(invalid_gline(source_p, user, host, parv[2]))
return;
/* Not enough non-wild characters were found, assume they are trying to gline *@*. */
/* Not enough non-wild characters were found,
* assume they are trying to gline *@*.
*/
if (check_wild_gline(user, host))
{
if (MyClient(source_p))
@ -196,32 +202,32 @@ static void mo_gline(struct Client *client_p,
reason = parv[2];
/* If at least 3 opers agree this user should be G lined then do it */
/* inform users about the gline before we call check_majority_gline()
* so already voted comes below gline request --fl
*/
sendto_realops_flags(FLAGS_ALL, L_ALL,
"%s!%s@%s on %s is requesting gline for [%s@%s] [%s]",
source_p->name, source_p->username, source_p->host,
me.name, user, host, reason);
log_gline_request(source_p->name,
(const char *)source_p->username,
source_p->host,me.name, user, host, reason);
/* If at least 3 opers agree this user should be G lined then do it */
check_majority_gline(source_p,
source_p->name,
(const char *)source_p->username,
source_p->host,
me.name,
user,
host,
reason);
source_p->host, me.name, user, host, reason);
/* 4 param version for hyb-7 servers */
sendto_server(NULL, source_p, NULL, CAP_GLN|CAP_UID, NOCAPS,
LL_ICLIENT,
":%s GLINE %s %s :%s",
ID(source_p),
user,
host,
reason);
ID(source_p), user, host, reason);
sendto_server(NULL, source_p, NULL, CAP_GLN, CAP_UID,
LL_ICLIENT,
":%s GLINE %s %s :%s",
source_p->name,
user,
host,
reason);
source_p->name, user, host, reason);
/* 8 param for hyb-6 */
sendto_server(NULL, NULL, NULL, CAP_UID, CAP_GLN, NOFLAGS,
@ -234,21 +240,6 @@ static void mo_gline(struct Client *client_p,
me.name, source_p->name, source_p->username,
source_p->host, source_p->user->server, user, host,
reason);
sendto_realops_flags(FLAGS_ALL, L_ALL,
"%s!%s@%s on %s is requesting gline for [%s@%s] [%s]",
source_p->name,
source_p->username,
source_p->host,
me.name,
user,
host,
reason);
log_gline_request(source_p->name,
(const char *)source_p->username,
source_p->host,me.name,
user,host,reason);
}
else
{
@ -331,10 +322,7 @@ static void ms_gline(struct Client *client_p,
/* send in hyb-7 to compatable servers */
sendto_server(client_p, acptr, NULL, CAP_GLN, NOCAPS, LL_ICLIENT,
":%s GLINE %s %s :%s",
oper_nick,
user,
host,
reason);
oper_nick, user, host, reason);
/* hyb-6 version to the rest */
sendto_server(client_p, NULL, NULL, NOCAPS, CAP_GLN, NOFLAGS,
":%s GLINE %s %s %s %s %s %s :%s",
@ -345,7 +333,9 @@ static void ms_gline(struct Client *client_p,
{
/* I dont like the idea of checking for x non-wildcard chars in a
* gline.. it could lead to a desync... but we have to stop people
* glining *@*.. -- fl */
* glining *@*.. -- fl
*/
if (check_wild_gline(user, host))
{
sendto_realops_flags(FLAGS_ALL, L_ALL,
@ -360,23 +350,12 @@ static void ms_gline(struct Client *client_p,
sendto_realops_flags(FLAGS_ALL, L_ALL,
"%s!%s@%s on %s is requesting gline for [%s@%s] [%s]",
oper_nick,
oper_user,
oper_host,
oper_server,
user,
host,
reason);
oper_nick, oper_user, oper_host, oper_server,
user, host, reason);
/* If at least 3 opers agree this user should be G lined then do it */
check_majority_gline(source_p,
oper_nick,
oper_user,
oper_host,
oper_server,
user,
host,
reason);
check_majority_gline(source_p, oper_nick, oper_user, oper_host,
oper_server, user, host, reason);
}
}
@ -440,7 +419,8 @@ check_wild_gline(char *user, char *host)
* - pointer to reason
* outputs - 1 if invalid, 0 if valid
*/
static int invalid_gline(struct Client *source_p, char *luser, char *lhost,
static int
invalid_gline(struct Client *source_p, char *luser, char *lhost,
char *lreason)
{
if(strchr(luser, '!'))
@ -476,19 +456,17 @@ static int invalid_gline(struct Client *source_p, char *luser, char *lhost,
*/
static void
check_majority_gline(struct Client *source_p,
const char *oper_nick,
const char *oper_user,
const char *oper_host,
const char *oper_server,
const char *user,
const char *host,
const char *oper_nick, const char *oper_user,
const char *oper_host, const char *oper_server,
const char *user, const char *host,
const char *reason)
{
/* set the actual gline in majority_gline() so we can pull the
* initial reason and use that as the trigger reason. --fl
*/
if(majority_gline(source_p,oper_nick,oper_user, oper_host,
oper_server, user, host, reason))
{
set_local_gline(oper_nick,oper_user,oper_host,oper_server,
user,host,reason);
cleanup_glines();
}
}
@ -506,7 +484,8 @@ check_majority_gline(struct Client *source_p,
* output - NONE
* side effects -
*/
static void set_local_gline(const char *oper_nick,
static void
set_local_gline(const char *oper_nick,
const char *oper_user,
const char *oper_host,
const char *oper_server,
@ -534,13 +513,8 @@ static void set_local_gline(const char *oper_nick,
sendto_realops_flags(FLAGS_ALL, L_ALL,
"%s!%s@%s on %s has triggered gline for [%s@%s] [%s]",
oper_nick,
oper_user,
oper_host,
oper_server,
user,
host,
reason);
oper_nick, oper_user, oper_host, oper_server,
user, host, reason);
check_klines();
}
@ -551,13 +525,9 @@ static void set_local_gline(const char *oper_nick,
*/
static void
log_gline_request(
const char *oper_nick,
const char *oper_user,
const char *oper_host,
const char* oper_server,
const char *user,
const char *host,
const char *reason)
const char *oper_nick, const char *oper_user,
const char *oper_host, const char* oper_server,
const char *user, const char *host, const char *reason)
{
char buffer[2*BUFSIZE];
char filenamebuf[PATH_MAX + 1];
@ -604,12 +574,8 @@ log_gline_request(
static void
log_gline(struct Client *source_p,
struct gline_pending *gline_pending_ptr,
const char *oper_nick,
const char *oper_user,
const char *oper_host,
const char *oper_server,
const char *user,
const char *host,
const char *oper_nick, const char *oper_user, const char *oper_host,
const char *oper_server, const char *user, const char *host,
const char *reason)
{
char buffer[2*BUFSIZE];
@ -629,7 +595,8 @@ log_gline(struct Client *source_p,
if ((out = fbopen(filenamebuf, "a")) == NULL)
{
sendto_realops_flags(FLAGS_ALL, L_ALL,"*** Problem opening %s",filenamebuf);
sendto_realops_flags(FLAGS_ALL, L_ALL,
"*** Problem opening %s",filenamebuf);
return;
}
@ -641,7 +608,8 @@ log_gline(struct Client *source_p,
if (fbputs(buffer,out) == -1)
{
sendto_realops_flags(FLAGS_ALL, L_ALL,"*** Problem writing to %s",filenamebuf);
sendto_realops_flags(FLAGS_ALL, L_ALL,
"*** Problem writing to %s",filenamebuf);
fbclose(out);
return;
}
@ -728,12 +696,9 @@ log_gline(struct Client *source_p,
* for more information.
*/
static void
add_new_majority_gline(const char* oper_nick,
const char* oper_user,
const char* oper_host,
const char* oper_server,
const char* user,
const char* host,
add_new_majority_gline(const char* oper_nick, const char* oper_user,
const char* oper_host, const char* oper_server,
const char* user, const char* host,
const char* reason)
{
dlink_node *pending_node;
@ -741,14 +706,14 @@ add_new_majority_gline(const char* oper_nick,
struct gline_pending *pending = (struct gline_pending*)
MyMalloc(sizeof(struct gline_pending));
strlcpy(pending->oper_nick1, oper_nick, NICKLEN);
strlcpy(pending->oper_user1, oper_user, USERLEN);
strlcpy(pending->oper_host1, oper_host, HOSTLEN);
strlcpy(pending->oper_nick1, oper_nick, NICKLEN + 1);
strlcpy(pending->oper_user1, oper_user, USERLEN + 1);
strlcpy(pending->oper_host1, oper_host, HOSTLEN + 1);
pending->oper_server1 = find_or_add(oper_server);
strlcpy(pending->user, user, USERLEN);
strlcpy(pending->host, host, HOSTLEN);
strlcpy(pending->user, user, USERLEN + 1);
strlcpy(pending->host, host, HOSTLEN + 1);
DupString(pending->reason1, reason);
pending->reason2 = NULL;
@ -773,21 +738,17 @@ add_new_majority_gline(const char* oper_nick,
*
*/
static int
majority_gline(struct Client *source_p,
const char *oper_nick,
const char *oper_user,
const char *oper_host,
const char* oper_server,
const char *user,
const char *host,
const char *reason)
majority_gline(struct Client *source_p, const char *oper_nick,
const char *oper_user, const char *oper_host,
const char* oper_server, const char *user,
const char *host, const char *reason)
{
dlink_node *pending_node;
struct gline_pending *gline_pending_ptr;
/* if its already glined, why bother? :) -- fl_ */
if(find_is_glined(host, user))
return NO;
return (NO);
/* special case condition where there are no pending glines */
@ -795,7 +756,7 @@ majority_gline(struct Client *source_p,
{
add_new_majority_gline(oper_nick, oper_user, oper_host, oper_server,
user, host, reason);
return NO;
return (NO);
}
for (pending_node = pending_glines.head;
@ -813,7 +774,7 @@ majority_gline(struct Client *source_p,
/* This oper or server has already "voted" */
sendto_realops_flags(FLAGS_ALL, L_ALL,
"oper or server has already voted");
return NO;
return (NO);
}
if (gline_pending_ptr->oper_user2[0] != '\0')
@ -827,24 +788,28 @@ majority_gline(struct Client *source_p,
/* This oper or server has already "voted" */
sendto_realops_flags(FLAGS_ALL, L_ALL,
"oper or server has already voted");
return NO;
return (NO);
}
log_gline(source_p,gline_pending_ptr,
oper_nick,oper_user,oper_host,oper_server,
user,host,reason);
return YES;
/* trigger the gline using the original reason --fl */
set_local_gline(oper_nick, oper_user, oper_host, oper_server,
user, host, gline_pending_ptr->reason1);
return (YES);
}
else
{
strlcpy(gline_pending_ptr->oper_nick2, oper_nick, NICKLEN);
strlcpy(gline_pending_ptr->oper_user2, oper_user, USERLEN);
strlcpy(gline_pending_ptr->oper_host2, oper_host, HOSTLEN);
strlcpy(gline_pending_ptr->oper_nick2, oper_nick, NICKLEN + 1);
strlcpy(gline_pending_ptr->oper_user2, oper_user, USERLEN + 1);
strlcpy(gline_pending_ptr->oper_host2, oper_host, HOSTLEN + 1);
DupString(gline_pending_ptr->reason2, reason);
gline_pending_ptr->oper_server2 = find_or_add(oper_server);
gline_pending_ptr->last_gline_time = CurrentTime;
gline_pending_ptr->time_request2 = CurrentTime;
return NO;
return (NO);
}
}
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_help.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_help.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -32,6 +32,7 @@
#include "numeric.h"
#include "send.h"
#include "s_conf.h"
#include "s_log.h"
#include "parse.h"
#include "modules.h"
@ -66,13 +67,14 @@ _moddeinit(void)
mod_del_cmd(&uhelp_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* m_help - HELP message handler
* parv[0] = sender prefix
*/
static void m_help(struct Client *client_p, struct Client *source_p,
static void
m_help(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
static time_t last_used = 0;
@ -106,7 +108,8 @@ static void m_help(struct Client *client_p, struct Client *source_p,
* mo_help - HELP message handler
* parv[0] = sender prefix
*/
static void mo_help(struct Client *client_p, struct Client *source_p,
static void
mo_help(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
if(parc > 1)
@ -121,8 +124,9 @@ static void mo_help(struct Client *client_p, struct Client *source_p,
* parv[0] = sender prefix
*/
static void mo_uhelp(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
static void
mo_uhelp(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
if(parc > 1)
dohelp(source_p, UHPATH, parv[1], parv[0]);
@ -130,14 +134,15 @@ static void mo_uhelp(struct Client *client_p, struct Client *source_p,
dohelp(source_p, UHPATH, NULL, parv[0]);
}
static void dohelp(struct Client *source_p, char *hpath,
static void
dohelp(struct Client *source_p, char *hpath,
char *topic, char *nick)
{
char path[MAXPATHLEN + 1];
struct stat sb;
int i;
if (topic)
if (topic != NULL)
{
/* convert to lower case */
for (i = 0; topic[i] != '\0'; i++)
@ -164,12 +169,14 @@ static void dohelp(struct Client *source_p, char *hpath,
if (stat(path, &sb) < 0)
{
ilog(L_NOTICE, "help file %s not found", path);
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), me.name, nick, topic);
return;
}
if (!S_ISREG(sb.st_mode))
{
ilog(L_NOTICE, "help file %s not found", path);
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), me.name, nick, topic);
return;
}
@ -178,19 +185,20 @@ static void dohelp(struct Client *source_p, char *hpath,
return;
}
static void sendhelpfile(struct Client *source_p, char *path,
static void
sendhelpfile(struct Client *source_p, char *path,
char *topic, char *nick)
{
FILE *file;
FBFILE *file;
char line[HELPLEN];
if ((file = fopen(path, "r")) == NULL)
if ((file = fbopen(path, "r")) == NULL)
{
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), me.name, nick, topic);
return;
}
if (fgets(line, sizeof(line), file) == NULL)
if (fbgets(line, sizeof(line), file) == NULL)
{
sendto_one(source_p, form_str(ERR_HELPNOTFOUND), me.name, nick, topic);
return;
@ -198,7 +206,7 @@ static void sendhelpfile(struct Client *source_p, char *path,
sendto_one(source_p, form_str(RPL_HELPSTART), me.name, nick, topic, line);
while (fgets(line, sizeof(line), file))
while (fbgets(line, sizeof(line), file))
{
sendto_one(source_p, form_str(RPL_HELPTXT), me.name, nick, topic, line);
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_info.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: m_info.c,v 1.4 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -69,7 +69,7 @@ _moddeinit(void)
hook_del_event("doing_info");
mod_del_cmd(&info_msgtab);
}
const char *_version = "$Revision: 1.3 $";
const char *_version = "$Revision: 1.4 $";
#endif
/*
@ -396,12 +396,6 @@ static struct InfoStruct info_table[] =
&ConfigChannel.quiet_on_ban,
"Banned users may not send text to a channel"
},
{
"vchans_oper_only",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.vchans_oper_only,
"Restrict use of /CJOIN to opers"
},
{
"disable_hidden",
OUTPUT_BOOLEAN_YN,
@ -532,13 +526,8 @@ static void ms_info(struct Client *client_p, struct Client *source_p,
if (hunt_server(client_p,source_p,":%s INFO :%s",1,parc,parv) == HUNTED_ISME)
{
info_spy(source_p);
/* I dont see sending Hybrid-team as anything but a waste of bandwidth..
* so its disabled for now. --fl_
*/
/* send_info_text(source_p); */
send_info_text(source_p);
/* I dont see why remote opers need this, but.. */
if(IsOper(source_p))
send_conf_options(source_p);
@ -741,6 +730,7 @@ static void send_conf_options(struct Client *source_p)
** in order for it to show up properly to opers who issue INFO
*/
#ifndef EFNET
/* jdc -- Only send compile information to admins. */
if (IsOperAdmin(source_p))
{
@ -751,6 +741,7 @@ static void send_conf_options(struct Client *source_p)
source_p->name,
platform);
}
#endif
sendto_one(source_p, form_str(RPL_INFO), me.name, source_p->name, "");
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_invite.c,v 1.4 2002/08/20 15:06:29 fishwaldo Exp $
* $Id: m_invite.c,v 1.5 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -29,7 +29,6 @@
#include "channel.h"
#include "channel_mode.h"
#include "list.h"
#include "vchannel.h"
#include "client.h"
#include "hash.h"
#include "irc_string.h"
@ -62,7 +61,7 @@ _moddeinit(void)
mod_del_cmd(&invite_msgtab);
}
const char *_version = "$Revision: 1.4 $";
const char *_version = "$Revision: 1.5 $";
#endif
/*
@ -78,9 +77,6 @@ m_invite(struct Client *client_p,
struct Client *target_p;
struct Channel *chptr, *vchan;
int chop; /* Is channel op */
#ifdef VCHANS
struct Channel *vchan2;
#endif
if (*parv[2] == '\0')
{
@ -140,14 +136,7 @@ m_invite(struct Client *client_p,
/* By this point, chptr is non NULL */
#ifdef VCHANS
if (!(HasVchans(chptr) && (vchan = map_vchan(chptr, source_p))))
vchan = chptr;
if (IsVchan(chptr))
chptr = chptr->root_chptr;
#else
vchan = chptr;
#endif
if (MyClient(source_p) && !IsMember(source_p, vchan))
{
@ -156,15 +145,6 @@ m_invite(struct Client *client_p,
return;
}
#ifdef VCHANS
if ((vchan2 = map_vchan(chptr, target_p)))
{
if (MyClient(source_p) && ((vchan2->mode.mode & MODE_SECRET) == 0))
sendto_one(source_p, form_str(ERR_USERONCHANNEL), me.name, parv[0],
parv[1], parv[2]);
return;
}
#endif
if (IsMember(target_p, vchan))
{

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_join.c,v 1.4 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: m_join.c,v 1.5 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -27,7 +27,6 @@
#include "handlers.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "common.h" /* bleah */
#include "resv.h"
@ -65,7 +64,7 @@ _moddeinit(void)
{
mod_del_cmd(&join_msgtab);
}
const char *_version = "$Revision: 1.4 $";
const char *_version = "$Revision: 1.5 $";
#endif
static void do_join_0(struct Client *client_p, struct Client *source_p);
@ -93,11 +92,6 @@ m_join(struct Client *client_p,
int i, flags = 0;
char *p = NULL, *p2 = NULL, *p3 = NULL;
int successful_join_count = 0; /* Number of channels successfully joined */
#ifdef VCHANS
struct Channel *vchan_chptr = NULL;
char *pvc = NULL;
int vc_ts;
#endif
if (*parv[1] == '\0')
{
@ -106,14 +100,6 @@ m_join(struct Client *client_p,
return;
}
#ifdef VCHANS
if (parc > 3)
{
key = strtoken(&p2, parv[3], ",");
vkey = strtoken(&p3, parv[2], ",");
}
else
#endif
if (parc > 2)
{
key = strtoken(&p2, parv[2], ",");
@ -198,21 +184,6 @@ m_join(struct Client *client_p,
continue;
}
#ifdef VCHANS
/* Check if they want to join a subchan or something */
vchan_chptr = select_vchan(chptr, source_p, vkey, name);
if (!vchan_chptr)
continue;
if (vchan_chptr != chptr)
{
joining_vchan = 1;
root_chptr = chptr;
chptr = vchan_chptr;
}
else
#endif
{
joining_vchan = 0;
root_chptr = chptr;
@ -299,12 +270,6 @@ m_join(struct Client *client_p,
add_user_to_channel(chptr, source_p, flags);
#ifdef VCHANS
if (joining_vchan)
{
add_vchan_to_client_cache(source_p,root_chptr,chptr);
}
#endif
/*
** Set timestamp if appropriate, and propagate
@ -314,36 +279,6 @@ m_join(struct Client *client_p,
{
chptr->channelts = CurrentTime;
/*
* XXX - this is a rather ugly hack.
*
* Unfortunately, there's no way to pass
* the fact that it is a vchan through SJOIN...
*/
#ifdef VCHANS
/* Prevent users creating a fake vchan */
if (name[0] == '#' && name[1] == '#')
{
if ((pvc = strrchr(name+3, '_')))
{
/*
* OK, name matches possible vchan:
* ##channel_blah
*/
pvc++; /* point pvc after last _ */
vc_ts = atol(pvc);
/*
* if blah is the same as the TS, up the TS
* by one, to prevent this channel being
* seen as a vchan
*/
if (vc_ts == CurrentTime)
chptr->channelts++;
}
}
#endif
sendto_server(client_p, source_p, chptr, NOCAPS, NOCAPS,
LL_ICLIENT,
":%s SJOIN %lu %s + :@%s",
@ -494,7 +429,7 @@ static void do_join_0(struct Client *client_p, struct Client *source_p)
source_p->name,
source_p->username,
source_p->vhost,
RootChan(chptr)->chname);
chptr->chname);
remove_user_from_channel(chptr, source_p);
}
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_kline.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_kline.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -75,7 +75,7 @@ _moddeinit(void)
mod_del_cmd(&kline_msgtab);
mod_del_cmd(&dline_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/* Local function prototypes */
@ -386,7 +386,7 @@ apply_tkline(struct Client *source_p, struct ConfItem *aconf,
get_oper_name(source_p), tkline_time/60,
aconf->user, aconf->host,
aconf->passwd);
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. K-Line for [%s@%s]",
sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. K-Line [%s@%s]",
me.name, source_p->name, tkline_time/60,
aconf->user, aconf->host);
ilog(L_TRACE, "%s added temporary %d min. K-Line for [%s@%s] [%s]",
@ -469,11 +469,11 @@ cluster(char *hostname)
if(strchr(hostname,'@'))
{
strlcpy(result, hostname, HOSTLEN);
strlcpy(result, hostname, HOSTLEN + 1);
return(result);
}
strlcpy(temphost, hostname, HOSTLEN);
strlcpy(temphost, hostname, HOSTLEN + 1);
is_ip_number = YES; /* assume its an IP# */
ipp = temphost;
@ -502,7 +502,7 @@ cluster(char *hostname)
zap_point++;
*zap_point++ = '*'; /* turn 111.222.333.444 into */
*zap_point = '\0'; /* 111.222.333.* */
strlcpy(result, temphost, HOSTLEN);
strlcpy(result, temphost, HOSTLEN + 1);
return(result);
}
else
@ -530,17 +530,17 @@ cluster(char *hostname)
if(number_of_dots == 0)
{
result[0] = '*';
strlcpy(result + 1, host_mask, HOSTLEN);
strlcpy(result + 1, host_mask, HOSTLEN + 1);
return(result);
}
host_mask--;
}
result[0] = '*'; /* foo.com => *foo.com */
strlcpy(result + 1, temphost, HOSTLEN);
strlcpy(result + 1, temphost, HOSTLEN + 1);
}
else /* no tld found oops. just return it as is */
{
strlcpy(result, temphost, HOSTLEN);
strlcpy(result, temphost, HOSTLEN + 1);
return(result);
}
}
@ -584,7 +584,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
}
dlhost = parv[1];
strlcpy(cidr_form_host, dlhost, HOSTLEN);
strlcpy(cidr_form_host, dlhost, HOSTLEN + 1);
cidr_form_host[HOSTLEN] = '\0';
if ((t=parse_netmask(dlhost, NULL, &bits)) == HM_HOST)
@ -773,14 +773,20 @@ find_user_host(struct Client *source_p,
if(hostp != NULL) /* I'm a little user@host */
{
*(hostp++) = '\0'; /* short and squat */
strlcpy(luser,user_host_or_nick,USERLEN); /* here is my user */
strlcpy(lhost,hostp,HOSTLEN); /* here is my host */
if (*user_host_or_nick)
strlcpy(luser,user_host_or_nick,USERLEN + 1); /* here is my user */
else
strcpy(luser,"*");
if (*hostp)
strlcpy(lhost, hostp, HOSTLEN + 1); /* here is my host */
else
strcpy(lhost,"*");
}
else
{
luser[0] = '*'; /* no @ found, assume its *@somehost */
luser[1] = '\0';
strlcpy(lhost,user_host_or_nick,HOSTLEN);
strlcpy(lhost, user_host_or_nick, HOSTLEN + 1);
}
return 1;
@ -816,11 +822,11 @@ find_user_host(struct Client *source_p,
* if found in original user name (non-idented)
*/
strlcpy(luser, target_p->username, USERLEN);
strlcpy(luser, target_p->username, USERLEN + 1);
if (*target_p->username == '~')
luser[0] = '*';
strlcpy(lhost,cluster(target_p->host),HOSTLEN);
strlcpy(lhost,cluster(target_p->host), HOSTLEN + 1);
}
return 1;

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_knock.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: m_knock.c,v 1.4 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -34,7 +34,6 @@
#include "numeric.h"
#include "send.h"
#include "s_conf.h"
#include "vchannel.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
@ -81,7 +80,7 @@ _moddeinit(void)
mod_del_cmd(&knockll_msgtab);
}
const char *_version = "$Revision: 1.3 $";
const char *_version = "$Revision: 1.4 $";
#endif
/* m_knock
@ -176,9 +175,6 @@ static void parse_knock_local(struct Client *client_p,
struct Channel *chptr;
char *p, *name, *key;
#ifdef VCHANS
struct Channel *vchan_chptr;
#endif
name = parv[1];
key = (parc > 2) ? parv[2] : NULL;
@ -212,53 +208,6 @@ static void parse_knock_local(struct Client *client_p,
return;
}
#ifdef VCHANS
if (IsVchanTop(chptr))
{
/* They specified a vchan basename */
if(on_sub_vchan(chptr,source_p))
{
sendto_one(source_p, form_str(ERR_KNOCKONCHAN),
me.name, source_p->name, name);
return;
}
if (key && key[0] == '!')
{
/* Make "KNOCK #channel !" work like JOIN */
if (!key[1])
{
show_vchans(source_p, chptr, "knock");
return;
}
/* Find a matching vchan */
if ((vchan_chptr = find_vchan(chptr, key)))
{
chptr = vchan_chptr;
}
else
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
me.name, parv[0], name);
return;
}
}
else
{
/* No key specified */
show_vchans(source_p, chptr, "knock");
return;
}
}
else if (IsVchan(chptr))
{
/* Don't allow KNOCK'ing a vchans 'real' name */
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, parv[0],
name);
return;
}
else
#endif
{
/* Normal channel, just be sure they aren't on it */
if (IsMember(source_p, chptr))
@ -280,7 +229,7 @@ static void parse_knock_local(struct Client *client_p,
}
/* don't allow a knock if the user is banned, or the channel is secret */
if ((chptr->mode.mode & MODE_SECRET) ||
if ((chptr->mode.mode & MODE_PRIVATE) ||
(sockhost && is_banned_knock(chptr, source_p, sockhost)) ||
(!sockhost && is_banned(chptr, source_p)))
{
@ -332,9 +281,6 @@ static void parse_knock_remote(struct Client *client_p,
{
struct Channel *chptr;
char *p, *name, *key;
#ifdef VCHANS
struct Channel *vchan_chptr;
#endif
name = parv[1];
key = (parc > 2) ? parv[2] : NULL;
@ -345,21 +291,6 @@ static void parse_knock_remote(struct Client *client_p,
if(!IsChannelName(name) || !(chptr = hash_find_channel(name)))
return;
#ifdef VCHANS
if(IsVchanTop(chptr))
{
if(on_sub_vchan(chptr,source_p))
return;
if(key && (key[0] == '!') && (vchan_chptr = find_vchan(chptr, key)))
chptr = vchan_chptr;
else
return;
}
else if(IsVchan(chptr))
return;
#endif
if(IsMember(source_p, chptr))
return;
@ -442,7 +373,7 @@ static int is_banned_knock(struct Channel *chptr, struct Client *who,
ircsprintf(src_host,"%s!%s@%s", who->name, who->username, who->host);
ircsprintf(src_iphost,"%s!%s@%s", who->name, who->username, sockhost);
ircsprintf(src_vhost, "%s!%s@vhost", who->name, who->username, who->vhost);
ircsprintf(src_vhost, "%s!%s@%s", who->name, who->username, who->vhost);
return (check_banned_knock(chptr, who, src_host, src_iphost, src_vhost));
}
@ -473,7 +404,7 @@ static int check_banned_knock(struct Channel *chptr, struct Client *who,
actualBan = NULL;
}
if (actualBan != NULL)
if ((actualBan != NULL))
{
for (except = chptr->exceptlist.head; except; except = except->next)
{

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_links.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_links.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -62,7 +62,7 @@ _moddeinit(void)
mod_del_cmd(&links_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* m_links - LINKS message handler
@ -77,14 +77,13 @@ const char *_version = "$Revision: 1.2 $";
static void m_links(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
if (!ConfigServerHide.flatten_links)
{
mo_links(client_p, source_p, parc, parv);
return;
mo_links(client_p, source_p, parc, parv);
return;
}
SendMessageFile(source_p, &ConfigFileEntry.linksfile);
SendMessageFile(source_p, &ConfigFileEntry.linksfile);
/*
* Print our own info so at least it looks like a normal links
@ -109,11 +108,15 @@ static void mo_links(struct Client *client_p, struct Client *source_p,
dlink_node *ptr;
if (parc > 2)
if (parc > 2)
{
if (hunt_server(client_p, source_p, ":%s LINKS %s :%s", 1, parc, parv)
!= HUNTED_ISME)
if(!ConfigServerHide.disable_remote || IsOper(source_p))
{
if (hunt_server(client_p, source_p, ":%s LINKS %s :%s", 1, parc, parv)
!= HUNTED_ISME)
return;
}
mask = parv[2];
}
else if (parc == 2)
@ -177,7 +180,7 @@ static void ms_links(struct Client *client_p, struct Client *source_p,
!= HUNTED_ISME)
return;
if(IsOper(source_p))
if(IsClient(source_p))
m_links(client_p,source_p,parc,parv);
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_list.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_list.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -35,7 +35,6 @@
#include "s_conf.h"
#include "s_serv.h"
#include "send.h"
#include "vchannel.h"
#include "list.h"
#include "msg.h"
#include "parse.h"
@ -65,7 +64,7 @@ _moddeinit(void)
{
mod_del_cmd(&list_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
static int list_all_channels(struct Client *source_p);
static int list_named_channel(struct Client *source_p,char *name);
@ -215,26 +214,17 @@ static int list_named_channel(struct Client *source_p,char *name)
struct Channel *chptr;
char id_and_topic[TOPICLEN+NICKLEN+6]; /* <!!>, space and null */
char *p;
#ifdef VCHANS
dlink_node *ptr;
struct Channel *root_chptr;
struct Channel *tmpchptr;
#endif
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
if((p = strchr(name,',')))
while (*name == ',')
name++;
if ((p = strchr(name,',')) != NULL)
*p = '\0';
if(*name == '\0')
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK),me.name, source_p->name, name);
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
return 0;
}
if (!*name)
return 0;
chptr = hash_find_channel(name);
if (chptr == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK),me.name, source_p->name, name);
@ -242,11 +232,6 @@ static int list_named_channel(struct Client *source_p,char *name)
return 0;
}
#ifdef VCHANS
if (HasVchans(chptr))
ircsprintf(id_and_topic, "<!%s> %s", pick_vchan_id(chptr), chptr->topic == NULL ? "" : chptr->topic );
else
#endif
ircsprintf(id_and_topic, "%s", chptr->topic == NULL ? "" : chptr->topic);
if (ShowChannel(source_p, chptr))
@ -255,20 +240,6 @@ static int list_named_channel(struct Client *source_p,char *name)
/* Deal with subvchans */
#ifdef VCHANS
for (ptr = chptr->vchan_list.head; ptr; ptr = ptr->next)
{
tmpchptr = ptr->data;
if (ShowChannel(source_p, tmpchptr))
{
root_chptr = find_bchan(tmpchptr);
ircsprintf(id_and_topic, "<!%s> %s", pick_vchan_id(tmpchptr), tmpchptr->topic == NULL ? "" : chptr->topic);
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
root_chptr->chname, tmpchptr->users, id_and_topic);
}
}
#endif
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
return 0;
@ -284,29 +255,6 @@ static int list_named_channel(struct Client *source_p,char *name)
*/
static void list_one_channel(struct Client *source_p, struct Channel *chptr)
{
#ifdef VCHANS
struct Channel *root_chptr;
char id_and_topic[TOPICLEN+NICKLEN+6]; /* <!!>, plus space and null */
if(IsVchan(chptr) || HasVchans(chptr))
{
root_chptr = find_bchan(chptr);
if(root_chptr != NULL)
{
ircsprintf(id_and_topic, "<!%s> %s", pick_vchan_id(chptr), chptr->topic == NULL ? "" : chptr->topic );
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
root_chptr->chname, chptr->users, id_and_topic);
}
else
{
ircsprintf(id_and_topic, "<!%s> %s", pick_vchan_id(chptr), chptr->topic == NULL ? "" : chptr->topic );
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
chptr->chname, chptr->users, id_and_topic);
}
}
else
#endif
{
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
chptr->chname, chptr->users, chptr->topic == NULL ? "" : chptr->topic );

View file

@ -19,14 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_lljoin.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_lljoin.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
#include "tools.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "hash.h"
#include "common.h"
@ -64,7 +63,7 @@ _moddeinit(void)
mod_del_cmd(&lljoin_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* m_lljoin
@ -98,11 +97,6 @@ static void ms_lljoin(struct Client *client_p,
int i;
struct Client *target_p;
struct Channel *chptr, *vchan_chptr, *root_vchan;
#ifdef VCHANS
int cjoin = 0;
int vc_ts;
char *pvc = NULL;
#endif
if(uplink && !IsCapable(uplink,CAP_LL))
{
@ -120,19 +114,6 @@ static void ms_lljoin(struct Client *client_p,
if(nick == NULL)
return;
#ifdef VCHANS
if (nick[0] == '!')
{
cjoin = 1;
nick++;
}
if(parc > 4)
{
key = parv[4];
vkey = parv[3];
}
#endif
else if(parc >3)
{
key = vkey = parv[3];
@ -150,47 +131,12 @@ static void ms_lljoin(struct Client *client_p,
chptr = hash_find_channel(chname);
#ifdef VCHANS
if (cjoin)
{
if(!chptr) /* Uhm, bad! */
{
sendto_realops_flags(FLAGS_ALL, L_ALL,
"LLJOIN %s %s called by %s, but root chan doesn't exist!",
chname, nick, client_p->name);
return;
}
flags = CHFL_CHANOP;
if(! (vchan_chptr = cjoin_channel(chptr, target_p, chname)))
return;
root_vchan = chptr;
chptr = vchan_chptr;
}
else
#endif
{
#ifdef VCHANS
if (chptr)
{
vchan_chptr = select_vchan(chptr, target_p, vkey, chname);
}
else
#endif
{
chptr = vchan_chptr = get_or_create_channel(target_p, chname, NULL);
flags = CHFL_CHANOP;
}
#ifdef VCHANS
if (vchan_chptr != chptr)
{
root_vchan = chptr;
chptr = vchan_chptr;
}
else
#endif
root_vchan = chptr;
if(!chptr || !root_vchan)
@ -244,27 +190,6 @@ static void ms_lljoin(struct Client *client_p,
* the fact that it is a vchan through SJOIN...
*/
/* Prevent users creating a fake vchan */
#ifdef VCHANS
if (chname[0] == '#' && chname[1] == '#')
{
if ((pvc = strrchr(chname+3, '_')))
{
/*
* OK, name matches possible vchan:
* ##channel_blah
*/
pvc++; /* point pvc after last _ */
vc_ts = atol(pvc);
/*
* if blah is the same as the TS, up the TS
* by one, to prevent this channel being
* seen as a vchan
*/
if (vc_ts == CurrentTime)
chptr->channelts++;
}
}
#endif
sendto_one(uplink,
":%s SJOIN %lu %s + :@%s",
@ -298,11 +223,6 @@ static void ms_lljoin(struct Client *client_p,
add_user_to_channel(chptr, target_p, flags);
#ifdef VCHANS
if ( chptr != root_vchan )
add_vchan_to_client_cache(target_p,root_vchan,chptr);
#endif
sendto_channel_local(ALL_MEMBERS, chptr,
":%s!%s@%s JOIN :%s",
target_p->name,

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_lusers.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_lusers.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -58,7 +58,7 @@ _moddeinit(void)
mod_del_cmd(&lusers_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* m_lusers - LUSERS message handler
@ -113,6 +113,8 @@ static void ms_lusers(struct Client *client_p, struct Client *source_p,
return;
}
}
show_lusers(source_p);
if(IsClient(source_p))
show_lusers(source_p);
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_motd.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_motd.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -63,7 +63,7 @@ _moddeinit(void)
mod_del_cmd(&motd_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/* mr_motd()
@ -117,7 +117,7 @@ static void m_motd(struct Client *client_p, struct Client *source_p,
static void mo_motd(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
if(IsServer(source_p))
if(!IsClient(source_p))
return;
if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1,parc,parv)!=HUNTED_ISME)

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_names.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_names.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -27,7 +27,6 @@
#include "handlers.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "common.h" /* bleah */
#include "hash.h"
@ -67,7 +66,7 @@ _moddeinit(void)
mod_del_cmd(&names_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/************************************************************************
@ -88,20 +87,16 @@ static void m_names(struct Client *client_p,
struct Channel *ch2ptr = NULL;
char *s;
char *para = parc > 1 ? parv[1] : NULL;
#ifdef VCHANS
struct Channel *vchan = NULL;
char *vkey = NULL;
#endif
if (!BadPtr(para))
{
if( (s = strchr(para, ',')) )
while (*para == ',')
para++;
if ((s = strchr(para, ',')) != NULL)
*s = '\0';
if (!*para)
return;
#ifdef VCHANS
if (parc > 2)
vkey = parv[2];
#endif
if (!check_channel_name(para))
{
@ -112,26 +107,6 @@ static void m_names(struct Client *client_p,
if ((ch2ptr = hash_find_channel(para)) != NULL)
{
#ifdef VCHANS
if (HasVchans(ch2ptr))
{
vchan = map_vchan(ch2ptr, source_p);
if ((vkey && !vkey[1]) || (!vchan && !vkey))
{
show_vchans(source_p, ch2ptr, "names");
return;
}
else if (vkey && vkey[1])
{
vchan = find_vchan(ch2ptr, vkey);
if(!vchan)
return;
}
channel_member_names(source_p, vchan, ch2ptr->chname, 1);
}
else
#endif
{
channel_member_names(source_p, ch2ptr, ch2ptr->chname, 1);
}
@ -161,9 +136,6 @@ static void names_all_visible_channels(struct Client *source_p)
{
struct Channel *chptr;
char *chname=NULL;
#ifdef VCHANS
struct Channel *bchan;
#endif
/*
* First, do all visible channels (public and the one user self is)
@ -171,15 +143,6 @@ static void names_all_visible_channels(struct Client *source_p)
for (chptr = GlobalChannelList; chptr; chptr = chptr->nextch)
{
#ifdef VCHANS
if (IsVchan(chptr))
{
bchan = find_bchan (chptr);
if (bchan != NULL)
chname = bchan->chname;
}
else
#endif
chname = chptr->chname;
/* Find users on same channel (defined by chptr) */
@ -285,6 +248,7 @@ static void ms_names( struct Client *client_p,
return;
}
m_names(client_p,source_p,parc,parv);
if(IsClient(source_p))
m_names(client_p,source_p,parc,parv);
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_pong.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_pong.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -60,7 +60,7 @@ _moddeinit(void)
mod_del_cmd(&pong_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
static void ms_pong(struct Client *client_p,
struct Client *source_p,
@ -108,10 +108,9 @@ static void ms_pong(struct Client *client_p,
return;
}
static void mr_pong(struct Client *client_p,
struct Client *source_p,
int parc,
char *parv[])
static void
mr_pong(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
if (parc == 2 && *parv[1] != '\0')
{
@ -123,19 +122,22 @@ static void mr_pong(struct Client *client_p,
if(source_p->localClient->random_ping == incoming_ping)
{
char buf[USERLEN+1];
strlcpy(buf, source_p->username, USERLEN);
strlcpy(buf, source_p->username, USERLEN + 1);
source_p->flags2 |= FLAGS2_PING_COOKIE;
register_local_user(client_p, source_p, source_p->name, buf);
} else
}
else
{
sendto_one(source_p, form_str(ERR_WRONGPONG), me.name, source_p->name, source_p->localClient->random_ping);
sendto_one(source_p, form_str(ERR_WRONGPONG), me.name,
source_p->name, source_p->localClient->random_ping);
return;
}
}
}
} else
sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]);
}
else
sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]);
source_p->flags &= ~FLAGS_PINGSENT;
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_stats.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_stats.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -80,7 +80,7 @@ _moddeinit(void)
mod_del_cmd(&stats_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
const char* Lformat = ":%s %d %s %s %u %u %u %u %u :%u %u %s";
@ -867,7 +867,8 @@ static void ms_stats(struct Client *client_p, struct Client *source_p,
if (hunt_server(client_p,source_p,":%s STATS %s :%s",2,parc,parv)!=HUNTED_ISME)
return;
mo_stats(client_p, source_p, parc, parv);
if(IsClient(source_p))
mo_stats(client_p, source_p, parc, parv);
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_time.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_time.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -34,6 +34,7 @@
#include "msg.h"
#include "parse.h"
#include "modules.h"
#include "packet.h"
static void m_time(struct Client*, struct Client*, int, char**);
static void mo_time(struct Client*, struct Client*, int, char**);
@ -56,7 +57,7 @@ _moddeinit(void)
mod_del_cmd(&time_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* m_time
@ -66,6 +67,10 @@ const char *_version = "$Revision: 1.2 $";
static void m_time(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
/* this is not rate limited, so end the grace period */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
/* This is safe enough to use during non hidden server mode */
if(!ConfigServerHide.disable_remote)
{

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_topic.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $
* $Id: m_topic.c,v 1.3 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
@ -27,7 +27,6 @@
#include "handlers.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "hash.h"
#include "irc_string.h"
@ -62,7 +61,7 @@ _moddeinit(void)
mod_del_cmd(&topic_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
* m_topic
@ -77,9 +76,6 @@ static void m_topic(struct Client *client_p,
struct Channel *chptr = NULL;
struct Channel *root_chan;
char *p = NULL;
#ifdef VCHANS
struct Channel *vchan;
#endif
if ((p = strchr(parv[1],',')))
*p = '\0';
@ -113,16 +109,6 @@ static void m_topic(struct Client *client_p,
root_chan = chptr;
#ifdef VCHANS
if (HasVchans(chptr))
{
vchan = map_vchan(chptr,source_p);
if(vchan != NULL)
chptr = vchan;
}
else if (IsVchan(chptr))
root_chan = RootChan(chptr);
#endif
/* setting topic */
if (parc > 2)

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_version.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: m_version.c,v 1.4 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include <stdinc.h>
@ -59,7 +59,7 @@ _moddeinit(void)
mod_del_cmd(&version_msgtab);
}
const char *_version = "$Revision: 1.3 $";
const char *_version = "$Revision: 1.4 $";
#endif
/*
* m_version - VERSION command handler
@ -165,14 +165,15 @@ static char* confopts(struct Client *source_p)
*p++ = 'H';
}
*p++ = 'M';
#ifdef CRYPT_OPER_PASSWORD
*p++ = 'p';
#endif
#ifdef IGNORE_BOGUS_TS
*p++ = 'T';
#endif
#ifdef USE_SYSLOG
*p++ = 'Y';

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_who.c,v 1.4 2002/08/16 12:05:36 fishwaldo Exp $
* $Id: m_who.c,v 1.5 2002/09/02 04:10:59 fishwaldo Exp $
*/
#include "stdinc.h"
#include "tools.h"
@ -28,7 +28,6 @@
#include "client.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "hash.h"
#include "ircd.h"
#include "numeric.h"
@ -61,7 +60,7 @@ _moddeinit(void)
{
mod_del_cmd(&who_msgtab);
}
const char *_version = "$Revision: 1.4 $";
const char *_version = "$Revision: 1.5 $";
#endif
static void do_who_on_channel(struct Client *source_p,
struct Channel *chptr, char *real_name,
@ -105,9 +104,6 @@ static void m_who(struct Client *client_p,
char flags[NUMLISTS][2];
int server_oper = parc > 2 ? (*parv[2] == 'o' ): 0; /* Show OPERS only */
int member;
#ifdef VCHANS
struct Channel *vchan;
#endif
/* See if mask is there, collapse it or return if not there */
@ -144,17 +140,6 @@ static void m_who(struct Client *client_p,
return;
}
#ifdef VCHANS
if (HasVchans(mychannel))
{
vchan = map_vchan(mychannel,source_p);
if(vchan != 0)
do_who_on_channel(source_p,vchan,"*",NO,YES);
else
do_who_on_channel(source_p,mychannel,"*",NO,YES);
}
else
#endif
do_who_on_channel(source_p, mychannel, "*", NO, YES);
sendto_one(source_p, form_str(RPL_ENDOFWHO), me.name, parv[0], "*");
@ -171,24 +156,6 @@ static void m_who(struct Client *client_p,
chptr = hash_find_channel(mask);
if (chptr != NULL)
{
#ifdef VCHANS
if (HasVchans(chptr))
{
vchan = map_vchan(chptr,source_p);
/* If vchan not 0, that makes them a member automatically */
if ( vchan != 0 )
do_who_on_channel(source_p, vchan, chptr->chname, NO, YES);
else
{
if ( IsMember(source_p, chptr) )
do_who_on_channel(source_p, chptr, chptr->chname, NO, YES);
else if(!SecretChannel(chptr))
do_who_on_channel(source_p, chptr, chptr->chname, NO, NO);
}
}
else
#endif
{
if ( IsMember(source_p, chptr) )
do_who_on_channel(source_p, chptr, chptr->chname, NO, YES);
@ -207,9 +174,6 @@ static void m_who(struct Client *client_p,
{
char *chname=NULL;
int isinvis = 0;
#ifdef VCHANS
struct Channel *bchan;
#endif
if(IsServer(client_p))
client_burst_if_needed(client_p,target_p);
@ -231,14 +195,6 @@ static void m_who(struct Client *client_p,
if (chptr != NULL)
{
#ifdef VCHANS
if (IsVchan(chptr))
{
bchan = find_bchan (chptr);
if (bchan != NULL)
chname = bchan->chname;
}
#endif
/* XXX globalize this inside m_who.c ? */
/* jdc -- Check is_any_op() for +o > +h > +v priorities */
@ -474,7 +430,6 @@ static void do_who_list(struct Client *source_p, struct Channel *chptr,
}
else
done++;
ilog(1, "chanadmin1 %s", admins_flag);
if(chanadmins_ptr != NULL)
{
target_p = chanadmins_ptr->data;

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_whois.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $
* $Id: m_whois.c,v 1.3 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -30,7 +30,6 @@
#include "hash.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "hash.h"
#include "ircd.h"
#include "numeric.h"
@ -76,7 +75,7 @@ _moddeinit(void)
mod_del_cmd(&whois_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
/*
** m_whois
@ -182,8 +181,12 @@ static int do_whois(struct Client *client_p, struct Client *source_p,
glob = 1;
nick = parv[1];
if ( (p = strchr(parv[1],',')) )
while (*nick == ',')
nick++;
if ((p = strchr(nick,',')) != NULL)
*p = '\0';
if (!*nick)
return 0;
(void)collapse(nick);
wilds = (strchr(nick, '?') || strchr(nick, '*'));
@ -375,10 +378,7 @@ static void whois_person(struct Client *source_p,struct Client *target_p, int gl
int tlen;
int reply_to_send = NO;
struct hook_mfunc_data hd;
char ubuf[12];
#ifdef VCHANS
struct Channel *bchan;
#endif
char ubuf[BUFSIZE];
a2client_p = find_server(target_p->user->server);
@ -399,15 +399,6 @@ static void whois_person(struct Client *source_p,struct Client *target_p, int gl
chptr = lp->data;
chname = chptr->chname;
#ifdef VCHANS
if (IsVchan(chptr))
{
bchan = find_bchan (chptr);
if (bchan != NULL)
chname = bchan->chname;
}
#endif
if (ShowChannel(source_p, chptr))
{
@ -522,6 +513,9 @@ static void ms_whois(struct Client *client_p,
return;
}
if(!IsClient(source_p))
return;
/* its a client doing a remote whois:
* :parv[0] WHOIS parv[1] :parv[2]
*

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_whowas.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $
* $Id: m_whowas.c,v 1.3 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -61,7 +61,7 @@ _moddeinit(void)
{
mod_del_cmd(&whowas_msgtab);
}
const char *_version = "$Revision: 1.2 $";
const char *_version = "$Revision: 1.3 $";
#endif
static int whowas_do(struct Client *client_p, struct Client *source_p,
int parc, char *parv[]);
@ -134,11 +134,13 @@ static int whowas_do(struct Client *client_p, struct Client *source_p,
if (hunt_server(client_p,source_p,":%s WHOWAS %s %s :%s", 3,parc,parv))
return 0;
if((p = strchr(parv[1],',')))
*p = '\0';
nick = parv[1];
while (*nick == ',')
nick++;
if((p = strchr(nick,',')) != NULL)
*p = '\0';
if (!*nick)
return 0;
temp = WHOWASHASH[hash_whowas_name(nick)];
found = 0;

View file

@ -18,37 +18,25 @@ balloc.o: balloc.c ../include/stdinc.h ../include/config.h \
channel.o: channel.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/tools.h \
../include/channel.h ../include/ircd_defs.h ../include/channel_mode.h \
../include/vchannel.h ../include/client.h ../include/ircd_handler.h \
../include/linebuf.h ../include/res.h ../include/fileio.h \
../adns/adns.h ../include/ircd.h ../include/memory.h \
../include/balloc.h ../include/irc_string.h ../include/sprintf_irc.h \
../include/common.h ../include/hash.h ../include/list.h \
../include/numeric.h ../include/s_serv.h ../include/s_user.h \
../include/send.h ../include/whowas.h ../include/s_conf.h \
../include/motd.h ../include/class.h ../include/event.h \
../include/resv.h ../include/s_log.h
../include/client.h ../include/ircd_handler.h ../include/linebuf.h \
../include/res.h ../include/fileio.h ../adns/adns.h ../include/ircd.h \
../include/memory.h ../include/balloc.h ../include/irc_string.h \
../include/sprintf_irc.h ../include/common.h ../include/hash.h \
../include/list.h ../include/numeric.h ../include/s_serv.h \
../include/s_user.h ../include/send.h ../include/whowas.h \
../include/s_conf.h ../include/motd.h ../include/class.h \
../include/event.h ../include/resv.h ../include/s_log.h
channel_mode.o: channel_mode.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/tools.h \
../include/channel.h ../include/ircd_defs.h ../include/channel_mode.h \
../include/vchannel.h ../include/client.h ../include/ircd_handler.h \
../include/linebuf.h ../include/res.h ../include/fileio.h \
../adns/adns.h ../include/ircd.h ../include/memory.h \
../include/balloc.h ../include/irc_string.h ../include/sprintf_irc.h \
../include/common.h ../include/hash.h ../include/list.h \
../include/numeric.h ../include/s_serv.h ../include/s_user.h \
../include/send.h ../include/whowas.h ../include/s_conf.h \
../include/motd.h ../include/class.h ../include/event.h \
../include/s_log.h
vchannel.o: vchannel.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/tools.h \
../include/vchannel.h ../include/channel.h ../include/ircd_defs.h \
../include/channel_mode.h ../include/client.h ../include/ircd_handler.h \
../include/linebuf.h ../include/res.h ../include/fileio.h \
../adns/adns.h ../include/ircd.h ../include/memory.h \
../include/balloc.h ../include/irc_string.h ../include/sprintf_irc.h \
../include/common.h ../include/hash.h ../include/list.h \
../include/send.h ../include/numeric.h ../include/s_conf.h \
../include/motd.h ../include/class.h
../include/client.h ../include/ircd_handler.h ../include/linebuf.h \
../include/res.h ../include/fileio.h ../adns/adns.h ../include/ircd.h \
../include/memory.h ../include/balloc.h ../include/irc_string.h \
../include/sprintf_irc.h ../include/common.h ../include/hash.h \
../include/list.h ../include/numeric.h ../include/s_serv.h \
../include/s_user.h ../include/send.h ../include/whowas.h \
../include/s_conf.h ../include/motd.h ../include/class.h \
../include/event.h ../include/s_log.h
class.o: class.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/tools.h \
../include/class.h ../include/client.h ../include/ircd_defs.h \
@ -256,7 +244,7 @@ packet.o: packet.c ../include/stdinc.h ../include/config.h \
../include/class.h ../include/client.h ../include/ircd_handler.h \
../include/linebuf.h ../include/channel.h ../include/s_serv.h \
../include/common.h ../include/list.h ../include/parse.h \
../include/packet.h ../include/hook.h
../include/packet.h ../include/hook.h ../include/send.h
parse.o: parse.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/parse.h \
../include/client.h ../include/ircd_defs.h ../include/ircd_handler.h \
@ -267,7 +255,7 @@ parse.o: parse.c ../include/stdinc.h ../include/config.h \
../include/hash.h ../include/numeric.h ../include/s_log.h \
../include/s_stats.h ../include/send.h ../include/s_debug.h \
../include/msg.h ../include/s_conf.h ../include/motd.h \
../include/class.h ../include/vchannel.h ../include/s_serv.h
../include/class.h ../include/s_serv.h
rsa.o: rsa.c ../include/stdinc.h ../include/config.h ../include/setup.h \
../include/defaults.h ../include/memory.h ../include/ircd_defs.h \
../include/balloc.h ../include/tools.h ../include/rsa.h \
@ -399,17 +387,17 @@ s_misc.o: s_misc.c ../include/stdinc.h ../include/config.h \
s_serv.o: s_serv.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/rsa.h \
../include/tools.h ../include/s_serv.h ../include/channel_mode.h \
../include/ircd_defs.h ../include/vchannel.h ../include/channel.h \
../include/class.h ../include/client.h ../include/ircd_handler.h \
../include/linebuf.h ../include/res.h ../include/fileio.h \
../adns/adns.h ../include/ircd.h ../include/memory.h \
../include/balloc.h ../include/irc_string.h ../include/sprintf_irc.h \
../include/common.h ../include/event.h ../include/fdlist.h \
../include/hash.h ../include/md5.h ../include/list.h \
../include/numeric.h ../include/packet.h ../include/s_bsd.h \
../include/s_conf.h ../include/motd.h ../include/s_log.h \
../include/s_stats.h ../include/s_user.h ../include/scache.h \
../include/send.h ../include/s_debug.h ../include/hook.h
../include/ircd_defs.h ../include/class.h ../include/client.h \
../include/ircd_handler.h ../include/linebuf.h ../include/channel.h \
../include/res.h ../include/fileio.h ../adns/adns.h ../include/ircd.h \
../include/memory.h ../include/balloc.h ../include/irc_string.h \
../include/sprintf_irc.h ../include/common.h ../include/event.h \
../include/fdlist.h ../include/hash.h ../include/md5.h \
../include/list.h ../include/numeric.h ../include/packet.h \
../include/s_bsd.h ../include/s_conf.h ../include/motd.h \
../include/s_log.h ../include/s_stats.h ../include/s_user.h \
../include/scache.h ../include/send.h ../include/s_debug.h \
../include/hook.h
s_stats.o: s_stats.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/s_stats.h \
../include/client.h ../include/ircd_defs.h ../include/ircd_handler.h \
@ -450,7 +438,7 @@ send.o: send.c ../include/stdinc.h ../include/config.h ../include/setup.h \
../include/numeric.h ../include/fdlist.h ../include/s_bsd.h \
../include/s_serv.h ../include/s_conf.h ../include/motd.h \
../include/list.h ../include/s_debug.h ../include/s_log.h \
../include/vchannel.h ../include/hook.h
../include/hook.h
sprintf_irc.o: sprintf_irc.c ../include/stdinc.h ../include/config.h \
../include/setup.h ../include/defaults.h ../include/sprintf_irc.h \
../include/irc_string.h

View file

@ -1,7 +1,7 @@
#
# Makefile.in for ircd/src
#
# $Id: Makefile.in,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $
# $Id: Makefile.in,v 1.3 2002/09/02 04:11:00 fishwaldo Exp $
#
CC = @CC@
INSTALL = @INSTALL@
@ -58,7 +58,6 @@ BASE_SRCS = \
balloc.c \
channel.c \
channel_mode.c \
vchannel.c \
class.c \
client.c \
dynlink.c \

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: channel.c,v 1.4 2002/08/16 12:05:37 fishwaldo Exp $
* $Id: channel.c,v 1.5 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -27,7 +27,6 @@
#include "tools.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "common.h"
#include "hash.h"
@ -185,10 +184,6 @@ remove_user_from_channel(struct Channel *chptr, struct Client *who)
dlink_node *next_ptr;
/* last user in the channel.. set a vchan_id incase we need it */
#ifdef VCHANS
if (chptr->users == 1)
ircsprintf(chptr->vchan_id, "!%s", who->name);
#endif
if ((ptr = find_user_link(&chptr->peons, who)))
dlinkDelete(ptr, &chptr->peons);
@ -246,11 +241,6 @@ remove_user_from_channel(struct Channel *chptr, struct Client *who)
who->user->joined--;
#ifdef VCHANS
if (IsVchan(chptr))
del_vchan_from_client_cache(who, chptr);
#endif
if (MyClient(who))
{
if (chptr->locusers > 0)
@ -524,32 +514,6 @@ cleanup_channels(void *unused)
{
next_chptr = chptr->nextch;
#ifdef VCHANS
if (IsVchan(chptr))
{
if (IsVchanTop(chptr))
{
chptr->users_last = CurrentTime;
}
else
{
if ((CurrentTime - chptr->users_last >= MAX_VCHAN_TIME))
{
if (chptr->users == 0)
{
if (uplink && IsCapable(uplink, CAP_LL))
{
sendto_one(uplink, ":%s DROP %s", me.name, chptr->chname);
}
destroy_channel(chptr);
}
else
chptr->users_last = CurrentTime;
}
}
}
else
#endif
{
if(chptr->users == 0)
{
@ -588,24 +552,7 @@ destroy_channel(struct Channel *chptr)
{
dlink_node *ptr;
dlink_node *m;
#ifdef VCHANS
struct Channel *root_chptr;
#endif
/* Don't ever delete the top of a chain of vchans! */
#ifdef VCHANS
if (IsVchanTop(chptr))
return;
if (IsVchan(chptr))
{
root_chptr = chptr->root_chptr;
/* remove from vchan double link list */
m = dlinkFind(&root_chptr->vchan_list, chptr);
dlinkDelete(m, &root_chptr->vchan_list);
free_dlink_node(m);
}
#endif
/* Walk through all the dlink's pointing to members of this channel,
* then walk through each client found from each dlink, removing
@ -704,10 +651,6 @@ delete_members(struct Channel *chptr, dlink_list * list)
who->user->joined--;
#ifdef VCHANS
if (IsVchan(chptr))
del_vchan_from_client_cache(who, chptr);
#endif
/* remove reference to who from chptr */
dlinkDelete(ptr, list);

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: channel_mode.c,v 1.5 2002/08/16 14:22:06 fishwaldo Exp $
* $Id: channel_mode.c,v 1.6 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -28,7 +28,6 @@
#include "tools.h"
#include "channel.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "client.h"
#include "common.h"
#include "hash.h"
@ -1193,8 +1192,8 @@ chm_op(struct Client *client_p, struct Client *source_p,
mode_get_status(chptr, targ_p, &t_op, &t_hop, &t_voice, &t_admin, 1);
if (((dir == MODE_ADD) && t_op) ||
((dir == MODE_DEL) && !t_op
if (((dir == MODE_ADD) && (t_op || t_admin)) ||
((dir == MODE_DEL) && (!t_op || t_admin)
&& !t_hop
))
return;
@ -2182,9 +2181,9 @@ sync_channel_oplists(struct Channel *chptr, int dir)
for (ptr=chptr->locpeons.head; ptr!=NULL && ptr->data!=NULL; ptr=ptr->next)
sync_oplists(chptr, ptr->data, MODE_ADD, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_ADD, chptr->chname);
for (ptr=chptr->locvoiced.head; ptr!=NULL && ptr->data!=NULL; ptr = ptr->next)
sync_oplists(chptr, ptr->data, MODE_ADD, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_ADD, chptr->chname);
}
@ -2246,7 +2245,7 @@ static void update_channel_info(struct Channel *chptr)
{
mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 0);
if (!t_hop && !t_op && !t_admin)
sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_DEL, chptr->chname);
}
for (ptr = chptr->locvoiced.head; ptr != NULL && ptr->data != NULL;
@ -2254,27 +2253,27 @@ static void update_channel_info(struct Channel *chptr)
{
mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 0);
if (!t_hop && !t_op && !t_admin)
sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_DEL, chptr->chname);
}
for(ptr = chptr->lochalfops.head; ptr != NULL; ptr = ptr->next)
{
mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 1);
if(!t_hop && !t_op && !t_admin)
sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_DEL, chptr->chname);
}
for(ptr = chptr->locchanops.head; ptr != NULL; ptr = ptr->next)
{
mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 1);
if(!t_hop && !t_op && !t_admin)
sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_DEL, chptr->chname);
}
for(ptr = chptr->locchanadmins.head; ptr != NULL; ptr = ptr->next)
{
mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 1);
if(!t_hop && !t_op && !t_admin)
sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_DEL, chptr->chname);
}
}
else
@ -2334,14 +2333,14 @@ static void update_channel_info(struct Channel *chptr)
for (ptr=deopped.head; ptr != NULL && ptr->data != NULL; ptr=ptr_next)
{
ptr_next = ptr->next;
sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_DEL, chptr->chname);
free_dlink_node(ptr);
}
for(ptr = opped.head; ptr != NULL; ptr = ptr_next)
{
ptr_next = ptr->next;
sync_oplists(chptr, ptr->data, MODE_ADD, RootChan(chptr)->chname);
sync_oplists(chptr, ptr->data, MODE_ADD, chptr->chname);
free_dlink_node(ptr);
}
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: ircd_lexer.l,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $
* $Id: ircd_lexer.l,v 1.4 2002/09/02 04:11:00 fishwaldo Exp $
*/
%option case-insensitive
@ -261,10 +261,8 @@ use_halfops { return USE_HALFOPS; }
use_help { return USE_HELP; }
use_invex { return USE_INVEX; }
use_knock { return USE_KNOCK; }
use_vchans { return USE_VCHANS; }
throttle_time { return THROTTLE_TIME; }
user { return USER;}
vchans_oper_only { return VCHANS_OPER_ONLY; }
vhost { return VHOST; }
vhost6 { return VHOST6; }
warn { return WARN; }

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: ircd_parser.y,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $
* $Id: ircd_parser.y,v 1.4 2002/09/02 04:11:00 fishwaldo Exp $
*/
%{
@ -274,8 +274,6 @@ int class_redirport_var;
%token USE_HELP
%token USE_INVEX
%token USE_KNOCK
%token USE_VCHANS
%token VCHANS_OPER_ONLY
%token VHOST
%token VHOST6
%token WARN
@ -2525,8 +2523,7 @@ channel_entry: CHANNEL
channel_items: channel_items channel_item |
channel_item;
channel_item: channel_vchans_oper_only |
channel_max_bans |
channel_item: channel_max_bans |
channel_knock_delay |
channel_knock_delay_channel |
channel_max_chans_per_user |
@ -2539,13 +2536,6 @@ channel_item: channel_vchans_oper_only |
error;
channel_vchans_oper_only: VCHANS_OPER_ONLY '=' TYES ';'
{ ConfigChannel.vchans_oper_only = 1; }
|
VCHANS_OPER_ONLY '=' TNO ';'
{ ConfigChannel.vchans_oper_only = 0; };
channel_knock_delay: KNOCK_DELAY '=' timespec ';'
{
ConfigChannel.knock_delay = $3;

View file

@ -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: messages.tab,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $
* $Id: messages.tab,v 1.3 2002/09/02 04:11:00 fishwaldo Exp $
*/
static char * replies[] = {
@ -526,7 +526,7 @@ static char * replies[] = {
/* 496 */ NULL,
/* 497 */ NULL,
/* 498 */ NULL,
/* 499 */ NULL,
/* 499 ERR_CHANAPRIVSNEEDED */ ":%s 482 %s %s :You're not a Channel Admin" ,
/* 500 */ NULL,
/* 501 ERR_UMODEUNKNOWNFLAG, */ ":%s 501 %s :Unknown MODE flag",
/* 502 ERR_USERSDONTMATCH, */ ":%s 502 %s :Can't change mode for other users",

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: modules.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $
* $Id: modules.c,v 1.4 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -553,9 +553,6 @@ load_all_modules(int warn)
mod_add_cmd(&away_msgtab);
mod_add_cmd(&capab_msgtab);
mod_add_cmd(&cburst_msgtab);
#ifdef VCHANS
mod_add_cmd(&cjoin_msgtab);
#endif
mod_add_cmd(&client_msgtab);
mod_add_cmd(&close_msgtab);
mod_add_cmd(&connect_msgtab);

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: parse.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $
* $Id: parse.c,v 1.4 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -39,7 +39,6 @@
#include "ircd_handler.h"
#include "msg.h"
#include "s_conf.h"
#include "vchannel.h"
#include "memory.h"
#include "s_serv.h"
@ -842,7 +841,7 @@ do_numeric(char numeric[],
sendto_channel_local(ALL_MEMBERS, chptr,
":%s %s %s %s",
source_p->name,
numeric, RootChan(chptr)->chname, buffer);
numeric, chptr->chname, buffer);
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_conf.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $
* $Id: s_conf.c,v 1.4 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -1414,7 +1414,6 @@ set_default_conf(void)
ConfigFileEntry.oper_only_umodes = FLAGS_DEBUG;
ConfigFileEntry.throttle_time = 10;
ConfigChannel.vchans_oper_only = NO;
ConfigChannel.knock_delay = 300;
ConfigChannel.knock_delay_channel = 60;

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_serv.c,v 1.5 2002/08/16 14:22:06 fishwaldo Exp $
* $Id: s_serv.c,v 1.6 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -32,7 +32,6 @@
#include "tools.h"
#include "s_serv.h"
#include "channel_mode.h"
#include "vchannel.h"
#include "class.h"
#include "client.h"
#include "common.h"
@ -1574,10 +1573,6 @@ burst_all(struct Client *client_p)
struct Client* target_p;
struct Channel* chptr;
struct hook_burst_channel hinfo;
#ifdef VCHANS
struct Channel* vchan;
dlink_node *ptr;
#endif
/* serial counter borrowed from send.c */
current_serial++;
@ -1588,11 +1583,6 @@ burst_all(struct Client *client_p)
* sent along as subchannels of the top channel
*/
#ifdef VCHANS
if(IsVchan(chptr))
continue;
#endif
if(chptr->users != 0)
{
burst_members(client_p,&chptr->chanops);
@ -1606,29 +1596,6 @@ burst_all(struct Client *client_p)
hook_call_event("burst_channel", &hinfo);
}
#ifdef VCHANS
if(IsVchanTop(chptr))
{
for ( ptr = chptr->vchan_list.head; ptr;
ptr = ptr->next)
{
vchan = ptr->data;
if(vchan->users != 0)
{
burst_members(client_p,&vchan->chanops);
burst_members(client_p,&vchan->voiced);
burst_members(client_p,&vchan->halfops);
burst_members(client_p,&vchan->peons);
burst_members(client_p,&vchan->chanadmins);
send_channel_modes(client_p, vchan);
hinfo.chptr = chptr;
hinfo.client = client_p;
hook_call_event("burst_channel", &hinfo);
}
}
}
#endif
}
/*
@ -1686,10 +1653,6 @@ cjoin_all(struct Client *client_p)
void
burst_channel(struct Client *client_p, struct Channel *chptr)
{
#ifdef VCHANS
dlink_node *ptr;
struct Channel* vchan;
#endif
burst_ll_members(client_p,&chptr->chanops);
burst_ll_members(client_p,&chptr->voiced);
@ -1709,32 +1672,6 @@ burst_channel(struct Client *client_p, struct Channel *chptr)
chptr->topic);
}
#ifdef VCHANS
if(IsVchanTop(chptr))
{
for ( ptr = chptr->vchan_list.head; ptr; ptr = ptr->next)
{
vchan = ptr->data;
burst_ll_members(client_p,&vchan->chanops);
burst_ll_members(client_p,&vchan->voiced);
burst_ll_members(client_p,&vchan->halfops);
burst_ll_members(client_p,&vchan->peons);
burst_ll_members(client_p,&vchan->chanadmins);
send_channel_modes(client_p, vchan);
add_lazylinkchannel(client_p,vchan);
if(vchan->topic != NULL && vchan->topic_info != NULL)
{
sendto_one(client_p, ":%s TOPIC %s %s %lu :%s",
me.name,
vchan->chname,
vchan->topic_info,
(unsigned long) vchan->topic_time,
vchan->topic);
}
}
}
#endif
}
/*

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: send.c,v 1.4 2002/08/16 12:05:37 fishwaldo Exp $
* $Id: send.c,v 1.5 2002/09/02 04:11:00 fishwaldo Exp $
*/
#include "stdinc.h"
@ -42,7 +42,6 @@
#include "list.h"
#include "s_debug.h"
#include "s_log.h"
#include "vchannel.h"
#include "memory.h"
#include "hook.h"
@ -513,11 +512,11 @@ sendto_channel_butone(struct Client *one, struct Client *from,
if(IsServer(from))
linebuf_putmsg(&local_linebuf, pattern, &args, ":%s %s %s ",
from->name, command, RootChan(chptr)->chname);
from->name, command, chptr->chname);
else
linebuf_putmsg(&local_linebuf, pattern, &args, ":%s!%s@%s %s %s ",
from->name, from->username, from->vhost,
command, RootChan(chptr)->chname);
command, chptr->chname);
linebuf_putmsg(&remote_linebuf, pattern, &args, ":%s %s %s ",
from->name, command, chptr->chname);

View file

@ -1,589 +0,0 @@
/*
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
* vchannel.c: Virtual channel functions
*
* Copyright (C) 2002 by the past and present ircd coders, and others.
*
* 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
*
* $Id: vchannel.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $
*/
#include "stdinc.h"
#include "tools.h"
#include "vchannel.h"
#include "channel.h"
#include "channel_mode.h"
#include "client.h"
#include "common.h"
#include "hash.h"
#include "irc_string.h"
#include "ircd.h"
#include "list.h"
#include "send.h"
#include "numeric.h"
#include "memory.h"
#include "s_conf.h" /* ConfigFileEntry */
#ifdef VCHANS
static void vchan_show_ids(struct Client *source_p, struct Channel *chptr);
/*
* cjoin_channel()
*
* input - root channel
* - client whos joining
* - channel name
* output - none
* side effects - vchan is created or client is told otherwise
*/
struct Channel *
cjoin_channel(struct Channel *root, struct Client *source_p, char *name)
{
char vchan_name[CHANNELLEN];
struct Channel *vchan_chptr;
int vchan_ts;
dlink_node *m;
/* don't cjoin a vchan, only the top is allowed */
if (IsVchan(root))
{
/* could send a notice here, but on a vchan aware server
* they shouldn't see the sub chans anyway
*/
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
me.name, source_p->name, name);
return NULL;
}
if (on_sub_vchan(root, source_p))
{
sendto_one(source_p, form_str(ERR_ALREADYONVCHAN),
me.name, source_p->name, name);
return NULL;
}
/* "root" channel name exists, now create a new copy of it */
if (strlen(name) > CHANNELLEN - 15)
{
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, source_p->name,
name);
return NULL;
}
if ((source_p->user->joined >= ConfigChannel.max_chans_per_user) &&
(!IsOper(source_p) || (source_p->user->joined >=
ConfigChannel.max_chans_per_user * 3)))
{
sendto_one(source_p, form_str(ERR_TOOMANYCHANNELS),
me.name, source_p->name, name);
return NULL;
}
/* Find an unused vchan name (##<chan>_<ts> format) */
vchan_ts = CurrentTime - 1;
do
{
vchan_ts++;
/*
* We have to give up eventually, so only allow the TS
* to be up to MAX_TS_DELTA seconds out.
*/
if (vchan_ts > (CurrentTime + ConfigFileEntry.ts_max_delta))
{
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
me.name, source_p->name, name);
return NULL;
}
ircsprintf(vchan_name, "##%s_%u", name + 1, vchan_ts);
vchan_chptr = hash_find_channel(vchan_name);
} while (vchan_chptr);
vchan_chptr = get_or_create_channel(source_p, vchan_name, NULL);
if (vchan_chptr == NULL)
{
sendto_one(source_p, form_str(ERR_BADCHANNAME),
me.name, source_p->name, (unsigned char *)name);
return NULL;
}
m = make_dlink_node();
dlinkAdd(vchan_chptr, m, &root->vchan_list);
vchan_chptr->root_chptr = root;
add_vchan_to_client_cache(source_p, root, vchan_chptr);
vchan_chptr->channelts = vchan_ts;
del_invite(vchan_chptr, source_p);
return vchan_chptr;
}
/*
* select_vchan()
*
* inputs - pointer to root channel
* - pointer to client
* - vchan key
* - channel name
* outputs - none
* side effects - user is shown vchans, vchan picked, or root returned
*/
struct Channel *
select_vchan(struct Channel *root,
struct Client *source_p, char *vkey, char *name)
{
struct Channel *chptr;
if (IsVchanTop(root))
{
if (on_sub_vchan(root, source_p))
return NULL;
if (vkey && vkey[0] == '!')
{
/* user joined with key "!". force listing.
(this prevents join-invited-chan voodoo) */
if (!vkey[1])
{
show_vchans(source_p, root, "join");
return NULL;
}
/* found a matching vchan? let them join it */
if ((chptr = find_vchan(root, vkey)))
return chptr;
else
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
me.name, source_p->name, name);
return NULL;
}
}
else
{
/* voodoo to auto-join channel invited to */
if ((chptr = vchan_invites(root, source_p)))
return chptr;
/* otherwise, they get a list of channels */
else
{
show_vchans(source_p, root, "join");
return NULL;
}
}
}
/* trying to join a sub chans 'real' name
* don't allow that
*/
else if (IsVchan(root))
{
sendto_one(source_p, form_str(ERR_BADCHANNAME),
me.name, source_p->name, name);
return NULL;
}
return root;
}
/*
* add_vchan_to_client_cache()
*
* input - pointer to client
* - pointer to root channel
* - vchan
* output - none
* side effects - add vchan pointer to clients cache
*/
void
add_vchan_to_client_cache(struct Client *source_p,
struct Channel *root_chan, struct Channel *vchan)
{
dlink_node *vchanmap_node;
struct Vchan_map *vchan_info;
assert(source_p != NULL);
if(source_p == NULL)
return;
/* oops its the top channel of the subchans */
if (root_chan == vchan)
return;
vchan_info = (struct Vchan_map *)MyMalloc(sizeof(struct Vchan_map));
vchan_info->base_chan = root_chan;
vchan_info->vchan = vchan;
vchanmap_node = make_dlink_node();
dlinkAdd(vchan_info, vchanmap_node, &source_p->vchan_map);
}
/*
* del_vchan_from_client_cache()
*
* inputs - pointer to client
* - pointer to vchan
* output - none
* side effects - remove vchan pointer from clients cache
*/
void
del_vchan_from_client_cache(struct Client *source_p, struct Channel *vchan)
{
dlink_node *vchanmap_node;
struct Vchan_map *vchan_info;
assert(source_p != NULL);
if(source_p == NULL)
return;
for (vchanmap_node = source_p->vchan_map.head; vchanmap_node;
vchanmap_node = vchanmap_node->next)
{
vchan_info = vchanmap_node->data;
if (vchan_info->vchan == vchan)
{
MyFree(vchan_info);
dlinkDelete(vchanmap_node, &source_p->vchan_map);
free_dlink_node(vchanmap_node);
return;
}
}
}
/*
* on_sub_vchan()
*
* input - pointer to channel
* - pointer to client
* output - none
* side effects - return YES if client is on a vchan, else NO
*/
int
on_sub_vchan(struct Channel *chptr, struct Client *source_p)
{
dlink_node *vchanmap_node;
struct Vchan_map *vchan_info;
assert(source_p != NULL);
if(source_p == NULL)
return NO;
/* they are in the root chan */
if (IsMember(source_p, chptr))
return YES;
/* check to see if this chptr maps to a sub vchan */
for (vchanmap_node = source_p->vchan_map.head; vchanmap_node;
vchanmap_node = vchanmap_node->next)
{
vchan_info = vchanmap_node->data;
if (vchan_info->base_chan == chptr)
return YES;
}
return NO;
}
/*
* map_vchan()
*
* input - pointer to channel
* - pointer to client
* output - none
* side effects - return matching vchan given base chan and source
*/
struct Channel *
map_vchan(struct Channel *chptr, struct Client *source_p)
{
dlink_node *vchanmap_node;
struct Vchan_map *vchan_info;
assert(source_p != NULL);
if(source_p == NULL)
return NULL;
/* they're in the root chan */
if (IsMember(source_p, chptr))
return chptr;
/* check to see if this chptr maps to a sub vchan */
for (vchanmap_node = source_p->vchan_map.head; vchanmap_node;
vchanmap_node = vchanmap_node->next)
{
vchan_info = vchanmap_node->data;
if (vchan_info->base_chan == chptr)
return (vchan_info->vchan);
}
return NULL;
}
/*
* find_bchan()
*
* input - pointer to channel
* output - none
* side effects - root channel is returned
*/
struct Channel *
find_bchan(struct Channel *chptr)
{
return (chptr->root_chptr);
}
/*
* show_vchans()
*
* input - pointer to client
* - pointer to channel
* - command given (ie: knock/join)
* output - none
* side effects - client is shown list of vchans
*/
void
show_vchans(struct Client *source_p, struct Channel *chptr, char *command)
{
int no_of_vchans = 0;
/* include the root itself in the count */
no_of_vchans = dlink_list_length(&chptr->vchan_list) + 1;
sendto_one(source_p, form_str(RPL_VCHANEXIST),
me.name, source_p->name, chptr->chname, no_of_vchans);
vchan_show_ids(source_p, chptr);
sendto_one(source_p, form_str(RPL_VCHANHELP),
me.name, source_p->name, command, chptr->chname);
}
/*
* vchan_show_ids
*
* inputs - pointer to client to report to
* - pointer to channel
* output - none
* side effects - client is sent list of ids for channel
*/
static void
vchan_show_ids(struct Client *source_p, struct Channel *chptr)
{
char buf[BUFSIZE];
char *t;
int mlen;
int cur_len;
int tlen;
dlink_node *ptr;
struct Channel *chtmp;
int done_secret = 0;
ircsprintf(buf, form_str(RPL_VCHANLIST), me.name, source_p->name,
chptr->chname);
mlen = strlen(buf);
cur_len = mlen;
t = buf + mlen;
if (!SecretChannel(chptr))
{
ircsprintf(t, "!%s ", pick_vchan_id(chptr));
tlen = strlen(t);
cur_len += tlen;
t += tlen;
}
else
{
strcpy(t, "<secret> ");
tlen = 9;
cur_len += tlen;
t += tlen;
done_secret = 1;
}
for (ptr = chptr->vchan_list.head; ptr; ptr = ptr->next)
{
chtmp = ptr->data;
if (cur_len > (BUFSIZE - (NICKLEN * 2 + 5)))
{
sendto_one(source_p, "%s", buf);
cur_len = mlen;
t = buf + mlen;
}
/* Obey the rules of /list */
if (SecretChannel(chtmp))
{
if (!done_secret)
{
strcpy(t, "<secret> ");
tlen = 9;
cur_len += tlen;
t += tlen;
done_secret = 1;
}
}
else
{
ircsprintf(t, "!%s ", pick_vchan_id(chtmp));
tlen = strlen(t);
cur_len += tlen;
t += tlen;
}
}
sendto_one(source_p, "%s", buf);
}
/*
* pick_vchan_id
* inputs - pointer to vchan
* output - pointer to static string
* side effects - pick a name from the channel.
* use who's been there longest according
* to the server.
*/
char *
pick_vchan_id(struct Channel *chptr)
{
dlink_node *lp;
struct Client *target_p;
for (lp = chptr->chanops.head; lp; lp = lp->next)
if (!lp->next)
{
target_p = lp->data;
return target_p->name;
}
for (lp = chptr->halfops.head; lp; lp = lp->next)
if (!lp->next)
{
target_p = lp->data;
return target_p->name;
}
for (lp = chptr->voiced.head; lp; lp = lp->next)
if (!lp->next)
{
target_p = lp->data;
return target_p->name;
}
for (lp = chptr->peons.head; lp; lp = lp->next)
if (!lp->next)
{
target_p = lp->data;
return target_p->name;
}
for (lp = chptr->chanadmins.head; lp; lp = lp->next)
if (!lp->next)
{
target_p = lp->data;
return target_p->name;
}
return chptr->vchan_id;
}
/*
* find_vchan()
*
* input - pointer to channel
* - vchan key
* output - none
* side effects - matching vchan is returned, else NULL
*/
struct Channel *
find_vchan(struct Channel *chptr, char *key)
{
dlink_node *ptr;
struct Channel *chtmp;
struct Client *target_p;
key++; /* go past the '!' */
if ((target_p = find_client(key)) != NULL)
if ((chtmp = map_vchan(chptr, target_p)) != NULL)
return chtmp;
/* try and match vchan_id */
if (*key == '!')
{
/* first the root */
if (chptr->vchan_id && (irccmp(chptr->vchan_id, key) == 0))
return chptr;
/* then it's vchans */
for (ptr = chptr->vchan_list.head; ptr; ptr = ptr->next)
{
chtmp = ptr->data;
if (chtmp->vchan_id && (irccmp(chtmp->vchan_id, key) == 0))
return chtmp;
}
}
return NULL;
}
/*
* vchan_invites()
*
* input - pointer to channel
* - pointer to client
* output - none
* side effects - return matching invite for vchans, else NULL
*/
struct Channel *
vchan_invites(struct Channel *chptr, struct Client *source_p)
{
dlink_node *lp;
dlink_node *vptr;
struct Channel *cp;
/* loop is nested this way to prevent preferencing channels higher
* in the vchan list
*/
for (lp = source_p->user->invited.head; lp; lp = lp->next)
{
/* check root first */
if (lp->data == chptr)
return chptr;
/* then vchan list */
for (vptr = chptr->vchan_list.head; vptr; vptr = vptr->next)
{
cp = vptr->data;
if (lp->data == cp)
return cp;
}
}
return NULL;
}
#endif