*/
#include "stdinc.h"
-#include "tools.h"
#include "channel.h"
#include "client.h"
#include "common.h"
call_hook(h_can_create_channel, &moduledata);
- if(moduledata.approved != 0 && !IsOper(source_p))
+ if(moduledata.approved != 0)
{
sendto_one(source_p, form_str(moduledata.approved),
me.name, source_p->name, name);
flags = CHFL_CHANOP;
}
- if((dlink_list_length(&source_p->user->channel) >=
+ if((rb_dlink_list_length(&source_p->user->channel) >=
(unsigned long) ConfigChannel.max_chans_per_user) &&
(!IsOper(source_p) ||
- (dlink_list_length(&source_p->user->channel) >=
+ (rb_dlink_list_length(&source_p->user->channel) >=
(unsigned long) ConfigChannel.max_chans_per_user * 3)))
{
sendto_one(source_p, form_str(ERR_TOOMANYCHANNELS),
me.name, source_p->name, name);
if(successful_join_count)
- source_p->localClient->last_join_time = CurrentTime;
+ source_p->localClient->last_join_time = rb_current_time();
return 0;
}
/* add the user to the channel */
add_user_to_channel(chptr, source_p, flags);
if (chptr->mode.join_num &&
- CurrentTime - chptr->join_delta >= chptr->mode.join_time)
+ rb_current_time() - chptr->join_delta >= chptr->mode.join_time)
{
chptr->join_count = 0;
- chptr->join_delta = CurrentTime;
+ chptr->join_delta = rb_current_time();
}
chptr->join_count++;
/* its a new channel, set +nt and burst. */
if(flags & CHFL_CHANOP)
{
- chptr->channelts = CurrentTime;
+ chptr->channelts = rb_current_time();
chptr->mode.mode |= MODE_TOPICLIMIT;
chptr->mode.mode |= MODE_NOPRIVMSGS;
channel_member_names(chptr, source_p, 1);
if(successful_join_count)
- source_p->localClient->last_join_time = CurrentTime;
+ source_p->localClient->last_join_time = rb_current_time();
hook_info.client = source_p;
hook_info.chptr = chptr;
int isnew;
int keep_our_modes = YES;
int keep_new_modes = YES;
- dlink_node *ptr, *next_ptr;
+ rb_dlink_node *ptr, *next_ptr;
/* special case for join 0 */
if((parv[1][0] == '0') && (parv[1][1] == '\0') && parc == 2)
set_final_mode(&mode, &chptr->mode);
chptr->mode = mode;
remove_our_modes(chptr, source_p);
- DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head)
+ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head)
{
del_invite(chptr, ptr->data);
}
{
add_user_to_channel(chptr, source_p, CHFL_PEON);
if (chptr->mode.join_num &&
- CurrentTime - chptr->join_delta >= chptr->mode.join_time)
+ rb_current_time() - chptr->join_delta >= chptr->mode.join_time)
{
chptr->join_count = 0;
- chptr->join_delta = CurrentTime;
+ chptr->join_delta = rb_current_time();
}
chptr->join_count++;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
{
struct membership *msptr;
struct Channel *chptr = NULL;
- dlink_node *ptr;
+ rb_dlink_node *ptr;
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
return 1;
}
-struct mode_letter
-{
- int mode;
- char letter;
-};
-
-static struct mode_letter flags[] = {
- {MODE_NOPRIVMSGS, 'n'},
- {MODE_TOPICLIMIT, 't'},
- {MODE_SECRET, 's'},
- {MODE_MODERATED, 'm'},
- {MODE_INVITEONLY, 'i'},
- {MODE_PRIVATE, 'p'},
- {MODE_REGONLY, 'r'},
- {MODE_EXLIMIT, 'L'},
- {MODE_PERMANENT, 'P'},
- {MODE_NOCOLOR, 'c'},
- {MODE_FREEINVITE, 'g'},
- {MODE_OPMODERATE, 'z'},
- {MODE_FREETARGET, 'F'},
- {MODE_DISFORWARD, 'Q'},
- {0, 0}
-};
-
static void
set_final_mode(struct Mode *mode, struct Mode *oldmode)
{
int i;
/* ok, first get a list of modes we need to add */
- for(i = 0; flags[i].letter; i++)
+ for(i = 0; chmode_flags[i].letter; i++)
{
- if((mode->mode & flags[i].mode) && !(oldmode->mode & flags[i].mode))
+ if((mode->mode & chmode_flags[i].mode) && !(oldmode->mode & chmode_flags[i].mode))
{
if(dir != MODE_ADD)
{
*mbuf++ = '+';
dir = MODE_ADD;
}
- *mbuf++ = flags[i].letter;
+ *mbuf++ = chmode_flags[i].letter;
}
}
/* now the ones we need to remove. */
- for(i = 0; flags[i].letter; i++)
+ for(i = 0; chmode_flags[i].letter; i++)
{
- if((oldmode->mode & flags[i].mode) && !(mode->mode & flags[i].mode))
+ if((oldmode->mode & chmode_flags[i].mode) && !(mode->mode & chmode_flags[i].mode))
{
if(dir != MODE_DEL)
{
*mbuf++ = '-';
dir = MODE_DEL;
}
- *mbuf++ = flags[i].letter;
+ *mbuf++ = chmode_flags[i].letter;
}
}
dir = MODE_DEL;
}
*mbuf++ = 'k';
- len = ircsprintf(pbuf, "%s ", oldmode->key);
+ len = rb_sprintf(pbuf, "%s ", oldmode->key);
pbuf += len;
}
if(oldmode->join_num && !mode->join_num)
dir = MODE_ADD;
}
*mbuf++ = 'l';
- len = ircsprintf(pbuf, "%d ", mode->limit);
+ len = rb_sprintf(pbuf, "%d ", mode->limit);
pbuf += len;
}
if(mode->key[0] && strcmp(oldmode->key, mode->key))
dir = MODE_ADD;
}
*mbuf++ = 'k';
- len = ircsprintf(pbuf, "%s ", mode->key);
+ len = rb_sprintf(pbuf, "%s ", mode->key);
pbuf += len;
}
if(mode->join_num && (oldmode->join_num != mode->join_num || oldmode->join_time != mode->join_time))
dir = MODE_ADD;
}
*mbuf++ = 'j';
- len = ircsprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
+ len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
pbuf += len;
}
if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) && ConfigChannel.use_forward)
dir = MODE_ADD;
}
*mbuf++ = 'f';
- len = ircsprintf(pbuf, "%s ", mode->forward);
+ len = rb_sprintf(pbuf, "%s ", mode->forward);
pbuf += len;
}
*mbuf = '\0';
remove_our_modes(struct Channel *chptr, struct Client *source_p)
{
struct membership *msptr;
- dlink_node *ptr;
+ rb_dlink_node *ptr;
char lmodebuf[MODEBUFLEN];
char *lpara[MAXMODEPARAMS];
int count = 0;
for(i = 0; i < MAXMODEPARAMS; i++)
lpara[i] = NULL;
- DLINK_FOREACH(ptr, chptr->members.head)
+ RB_DLINK_FOREACH(ptr, chptr->members.head)
{
msptr = ptr->data;