/* SET MAX */ static void quote_max(struct Client *source_p, const char *arg, int newval) { if(newval > 0) { if(newval > maxconnections - MAX_BUFFER) { sendto_one_notice(source_p, ":You cannot set MAXCLIENTS to > %d", maxconnections - MAX_BUFFER); return; } if(newval < 32) { sendto_one_notice(source_p, ":You cannot set MAXCLIENTS to < 32 (%d:%d)", GlobalSetOptions.maxclients, rb_getmaxconnect()); return; } GlobalSetOptions.maxclients = newval; sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s set new MAXCLIENTS to %d (%lu current)", source_p->name, source_p->username, source_p->host, GlobalSetOptions.maxclients, rb_dlink_list_length(&lclient_list)); return; } else { sendto_one_notice(source_p, ":Current Maxclients = %d (%lu)", GlobalSetOptions.maxclients, rb_dlink_list_length(&lclient_list)); } }
/* * m_locops - LOCOPS message handler * (write to *all* local opers currently online) * parv[0] = sender prefix * parv[1] = message text */ static int m_locops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { sendto_wallops_flags(UMODE_LOCOPS, source_p, "LOCOPS - %s", parv[1]); if(rb_dlink_list_length(&cluster_conf_list) > 0) cluster_generic(source_p, "LOCOPS", SHARED_LOCOPS, ":%s", parv[1]); return 0; }
static void h_scc_channel_join(void *vdata) { hook_data_channel_activity *data = (hook_data_channel_activity *)vdata; struct Channel *chptr = data->chptr; struct Client *source_p = data->client; /* If they just joined a channel, and it only has one member, then they just created it. */ if(rb_dlink_list_length(&chptr->members) == 1 && is_chanop(find_channel_membership(chptr, source_p))) { sendto_realops_snomask(snomask_modes['l'], L_NETWIDE, "%s is creating new channel %s", source_p->name, chptr->chname); } }
/* * list_one_channel() * * inputs - client pointer, channel pointer, whether normally visible * outputs - none * side effects - a channel is listed */ static void list_one_channel(struct Client *source_p, struct Channel *chptr, int visible) { char topic[TOPICLEN + 1]; if (chptr->topic != NULL) rb_strlcpy(topic, chptr->topic, sizeof topic); else topic[0] = '\0'; strip_colour(topic); sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, visible ? "" : "!", chptr->chname, rb_dlink_list_length(&chptr->members), topic); }
/* m_knock * parv[1] = channel * * The KNOCK command has the following syntax: * :<sender> KNOCK <channel> * * If a user is not banned from the channel they can use the KNOCK * command to have the server NOTICE the channel operators notifying * they would like to join. Helpful if the channel is invite-only, the * key is forgotten, or the channel is full (INVITE can bypass each one * of these conditions. Concept by Dianora <*****@*****.**> and written by * <anonymous> */ static int m_knock(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Channel *chptr; char *p, *name; if(MyClient(source_p) && ConfigChannel.use_knock == 0) { sendto_one(source_p, form_str(ERR_KNOCKDISABLED), me.name, source_p->name); return 0; } name = LOCAL_COPY(parv[1]); /* dont allow one knock to multiple chans */ if((p = strchr(name, ','))) *p = '\0'; if(!IsChannelName(name)) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); return 0; } if((chptr = find_channel(name)) == NULL) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); return 0; } if(IsMember(source_p, chptr)) { if(MyClient(source_p)) sendto_one(source_p, form_str(ERR_KNOCKONCHAN), me.name, source_p->name, name); return 0; } if(!((chptr->mode.mode & MODE_INVITEONLY) || (*chptr->mode.key) || (chptr->mode.limit && rb_dlink_list_length(&chptr->members) >= (unsigned long)chptr->mode.limit))) { sendto_one_numeric(source_p, ERR_CHANOPEN, form_str(ERR_CHANOPEN), name); return 0; } /* cant knock to a +p channel */ if(HiddenChannel(chptr)) { sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), name, "channel does not accept knocks"); return 0; } if(MyClient(source_p)) { /* don't allow a knock if the user is banned */ if(is_banned(chptr, source_p, NULL, NULL, NULL) == CHFL_BAN || is_quieted(chptr, source_p, NULL, NULL, NULL) == CHFL_BAN) { sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), name, "you are banned from this channel"); return 0; } /* local flood protection: * allow one knock per user per knock_delay * allow one knock per channel per knock_delay_channel */ if(!IsOper(source_p) && (source_p->localClient->last_knock + ConfigChannel.knock_delay) > rb_current_time()) { sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), me.name, source_p->name, name, "user"); return 0; } else if((chptr->last_knock + ConfigChannel.knock_delay_channel) > rb_current_time()) { sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), me.name, source_p->name, name, "channel"); return 0; } /* ok, we actually can send the knock, tell client */ source_p->localClient->last_knock = rb_current_time(); sendto_one(source_p, form_str(RPL_KNOCKDLVR), me.name, source_p->name, name); } chptr->last_knock = rb_current_time(); if(ConfigChannel.use_knock) sendto_channel_local(chptr->mode.mode & MODE_FREEINVITE ? ALL_MEMBERS : ONLY_CHANOPS, chptr, form_str(RPL_KNOCK), me.name, name, name, source_p->name, source_p->username, source_p->host); sendto_server(client_p, chptr, CAP_KNOCK|CAP_TS6, NOCAPS, ":%s KNOCK %s", use_id(source_p), name); sendto_server(client_p, chptr, CAP_KNOCK, CAP_TS6, ":%s KNOCK %s", source_p->name, name); return 0; }