More moving

This commit is contained in:
JD Horelick 2010-02-23 02:52:01 -05:00
parent 67b90240c4
commit 9230426e7a
3 changed files with 70 additions and 78 deletions

View File

@ -272,7 +272,8 @@ extern int valid_extban(const char *banstr, struct Client *client_p, struct Chan
const char * get_extban_string(void);
extern struct Channel * check_forward(struct Client *source_p, struct Channel *chptr, char *key);
extern void user_join(struct Client * source_p, char * channels, char * keys);
extern void user_join(struct Client * client_p, struct Client * source_p, char * channels, char * keys);
extern void do_join_0(struct Client *client_p, struct Client *source_p);
extern int check_channel_name_loc(struct Client *source_p, const char *name);
#endif /* INCLUDED_channel_h */

View File

@ -60,9 +60,6 @@ mapi_clist_av1 join_clist[] = { &join_msgtab, &sjoin_msgtab, NULL };
DECLARE_MODULE_AV1(join, NULL, NULL, join_clist, NULL, NULL, "$Revision: 3494 $");
static void do_join_0(struct Client *client_p, struct Client *source_p);
static int check_channel_name_loc(struct Client *source_p, const char *name);
static void set_final_mode(struct Mode *mode, struct Mode *oldmode);
static void remove_our_modes(struct Channel *chptr, struct Client *source_p);
@ -83,7 +80,7 @@ static int pargs;
static int
m_join(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
user_join(source_p, parv[1], parc > 2 ? parv[2] : NULL); /* channel.c */
user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL); /* channel.c */
return 0;
}
@ -652,77 +649,6 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
return 0;
}
/*
* do_join_0
*
* inputs - pointer to client doing join 0
* output - NONE
* side effects - Use has decided to join 0. This is legacy
* from the days when channels were numbers not names. *sigh*
*/
static void
do_join_0(struct Client *client_p, struct Client *source_p)
{
struct membership *msptr;
struct Channel *chptr = NULL;
rb_dlink_node *ptr;
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s JOIN 0", use_id(source_p));
while((ptr = source_p->user->channel.head))
{
if(MyConnect(source_p) &&
!IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
msptr = ptr->data;
chptr = msptr->chptr;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
remove_user_from_channel(msptr);
}
}
static int
check_channel_name_loc(struct Client *source_p, const char *name)
{
const char *p;
s_assert(name != NULL);
if(EmptyString(name))
return 0;
if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p))
{
for(p = name; *p; ++p)
{
if(!IsChanChar(*p) || IsFakeChanChar(*p))
return 0;
}
}
else
{
for(p = name; *p; ++p)
{
if(!IsChanChar(*p))
return 0;
}
}
if(ConfigChannel.only_ascii_channels)
{
for(p = name; *p; ++p)
if(*p < 33 || *p > 126)
return 0;
}
return 1;
}
static void
set_final_mode(struct Mode *mode, struct Mode *oldmode)

View File

@ -1401,7 +1401,72 @@ check_forward(struct Client *source_p, struct Channel *chptr,
return NULL;
}
void user_join(struct Client * source_p, char * channels, char * keys)
/*
* do_join_0
*
* inputs - pointer to client doing join 0
* output - NONE
* side effects - Use has decided to join 0. This is legacy
* from the days when channels were numbers not names. *sigh*
* There is a bunch of evilness necessary here due to
* anti spambot code.
*/
void
do_join_0(struct Client *client_p, struct Client *source_p)
{
struct membership *msptr;
struct Channel *chptr = NULL;
rb_dlink_node *ptr;
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s JOIN 0", use_id(source_p));
if(source_p->user->channel.head && MyConnect(source_p) &&
!IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
while((ptr = source_p->user->channel.head))
{
msptr = ptr->data;
chptr = msptr->chptr;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
remove_user_from_channel(msptr);
}
}
int
check_channel_name_loc(struct Client *source_p, const char *name)
{
s_assert(name != NULL);
if(EmptyString(name))
return 0;
if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p))
{
for(; *name; ++name)
{
if(!IsChanChar(*name) || IsFakeChanChar(*name))
return 0;
}
}
else
{
for(; *name; ++name)
{
if(!IsChanChar(*name))
return 0;
}
}
return 1;
}
void user_join(struct Client * client_p, struct Client * source_p, char * channels, char * keys)
{
static char jbuf[BUFSIZE];
struct Channel *chptr = NULL;