X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/ff0482a9cb989d23082d0a1ed53c5faa463a8c2f..609a0d5514a8dd018712fdf4539243ad16156be5:/modules/m_resv.c diff --git a/modules/m_resv.c b/modules/m_resv.c index 7ce57c7..5101023 100644 --- a/modules/m_resv.c +++ b/modules/m_resv.c @@ -69,6 +69,7 @@ static void cluster_resv(struct Client *source_p, int temp_time, static void handle_remote_unresv(struct Client *source_p, const char *name); static void remove_resv(struct Client *source_p, const char *name); +static void resv_chan_forcepart(const char *name, const char *reason, int temp_time); /* * mo_resv() @@ -220,6 +221,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te aconf->host = rb_strdup(name); aconf->passwd = rb_strdup(reason); add_to_resv_hash(aconf->host, aconf); + resv_chan_forcepart(aconf->host, aconf->passwd, temp_time); if(temp_time > 0) { @@ -235,7 +237,16 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te temp_time / 60, name); } else + { + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "%s added RESV for [%s] [%s]", + get_oper_name(source_p), name, reason); + ilog(L_KLINE, "R %s 0 %s %s", + get_oper_name(source_p), name, reason); + sendto_one_notice(source_p, ":Added RESV [%s]", name); + bandb_add(BANDB_RESV, source_p, aconf->host, NULL, aconf->passwd, NULL, 0); + } } else if(clean_resv_nick(name)) { @@ -288,7 +299,16 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te temp_time / 60, name); } else + { + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "%s added RESV for [%s] [%s]", + get_oper_name(source_p), name, reason); + ilog(L_KLINE, "R %s 0 %s %s", + get_oper_name(source_p), name, reason); + sendto_one_notice(source_p, ":Added RESV [%s]", name); + bandb_add(BANDB_RESV, source_p, aconf->host, NULL, aconf->passwd, NULL, 0); + } } else sendto_one_notice(source_p, ":You have specified an invalid resv: [%s]", name); @@ -490,3 +510,54 @@ remove_resv(struct Client *source_p, const char *name) return; } + +static void +resv_chan_forcepart(const char *name, const char *reason, int temp_time) +{ + rb_dlink_node *ptr; + rb_dlink_node *next_ptr; + struct Channel *chptr; + struct membership *msptr; + struct Client *target_p; + + if(!ConfigChannel.resv_forcepart) + return; + + /* for each user on our server in the channel list + * send them a PART, and notify opers. + */ + chptr = find_channel(name); + if(chptr != NULL) + { + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) + { + msptr = ptr->data; + target_p = msptr->client_p; + + if(IsExemptResv(target_p)) + continue; + + sendto_server(target_p, chptr, CAP_TS6, NOCAPS, + ":%s PART %s", target_p->id, chptr->chname); + + sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s", + target_p->name, target_p->username, + target_p->host, chptr->chname, target_p->name); + + remove_user_from_channel(msptr); + + /* notify opers & user they were removed from the channel */ + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "Forced PART for %s!%s@%s from %s (%s)", + target_p->name, target_p->username, + target_p->host, name, reason); + + if(temp_time > 0) + sendto_one_notice(target_p, ":*** Channel %s is temporarily unavailable on this server.", + name); + else + sendto_one_notice(target_p, ":*** Channel %s is no longer available on this server.", + name); + } + } +}