]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Force part local users (not resv_exempt) on channel resv.
authorJilles Tjoelker <redacted>
Sat, 19 Sep 2009 19:24:35 +0000 (21:24 +0200)
committerJilles Tjoelker <redacted>
Sat, 19 Sep 2009 19:24:35 +0000 (21:24 +0200)
A notice will be sent to any force parted users that the channel
is temporarily/permanently unavailable on the server.
A new config option channel::resv_forcepart can be used to disable this.

from ircd-ratbox (dubkat)

doc/example.conf
doc/reference.conf
include/s_conf.h
modules/m_info.c
modules/m_resv.c
src/newconf.c
src/s_conf.c

index 042364f36ce9c3fb57385b80f327ad730eef1415..cb58451690f73f7ab38c07ed668f4ab25b12acbf 100755 (executable)
@@ -318,6 +318,7 @@ channel {
        burst_topicwho = yes;
        kick_on_split_riding = no;
        only_ascii_channels = no;
+       resv_forcepart = yes;
 };
 
 serverhide {
index f23050aa7b248ca6e00d82234c80c5d225aac800..326520ff49ee37b613e9d77d6bd797d6c35c08dd 100755 (executable)
@@ -739,6 +739,11 @@ channel {
         * or non-ASCII).
         */
        only_ascii_channels = no;
+       /* resv_forcepart: force any local users to part a channel
+        * when a RESV is issued.
+        */
+       resv_forcepart = yes;
 };
 
 
index 6a10c56a5a50c476187e79f1329719d95f7b77cd..750bfbd357f2f1c1022fa8d8d37cab0610ad55dc 100644 (file)
@@ -238,6 +238,7 @@ struct config_channel_entry
        int burst_topicwho;
        int kick_on_split_riding;
        int only_ascii_channels;
+       int resv_forcepart;
 };
 
 struct config_server_hide
index 3be948d3bf357e43a0102377bf4295831c907d7c..d3ddb3b88bf5df161fab268f8882cb7633a24fd6 100644 (file)
@@ -572,6 +572,12 @@ static struct InfoStruct info_table[] = {
                &ConfigChannel.use_knock,
                "Enable /KNOCK",
        },
+       {
+               "resv_forcepart",
+               OUTPUT_BOOLEAN_YN,
+               { &ConfigChannel.resv_forcepart },
+               "Force-part local users on channel RESV"
+       },
        {
                "disable_hidden",
                OUTPUT_BOOLEAN_YN,
index 3cbf4a86986a83311e945e7bad6c03cdf894e206..faf4066a50af53fdf6d30e9b4e2f924b6197a041 100644 (file)
@@ -67,6 +67,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 int remove_resv_from_file(struct Client *source_p, const char *name);
+static void resv_chan_forcepart(const char *name, const char *reason, int temp_time);
 
 /*
  * mo_resv()
@@ -231,6 +232,7 @@ parse_resv(struct Client *source_p, const char *name,
                aconf->name = rb_strdup(name);
                aconf->passwd = rb_strdup(reason);
                add_to_resv_hash(aconf->name, aconf);
+               resv_chan_forcepart(aconf->name, aconf->passwd, temp_time);
 
                if(temp_time > 0)
                {
@@ -638,3 +640,54 @@ remove_resv_from_file(struct Client *source_p, const char *name)
 
        return 1;
 }
+
+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);
+               }
+       }
+}
index 36d05175785f4616b1a4402799440c16a0a51e65..2d0b63dd95c961b843e28c486fe7310d2379f928 100644 (file)
@@ -2190,6 +2190,7 @@ static struct ConfEntry conf_channel_table[] =
        { "use_invex",          CF_YESNO, NULL, 0, &ConfigChannel.use_invex             },
        { "use_knock",          CF_YESNO, NULL, 0, &ConfigChannel.use_knock             },
        { "use_forward",        CF_YESNO, NULL, 0, &ConfigChannel.use_forward           },
+       { "resv_forcepart",     CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart        },
        { "\0",                 0,        NULL, 0, NULL }
 };
 
index 94e8669d9146af3ce30bada0dec87accb55fe14b..7acb57343ef299e440ce38028e6b6ab948bf6cfd 100644 (file)
@@ -814,6 +814,7 @@ set_default_conf(void)
        ConfigChannel.default_split_server_count = 10;
        ConfigChannel.no_join_on_split = NO;
        ConfigChannel.no_create_on_split = YES;
+       ConfigChannel.resv_forcepart = YES;
 
        ConfigServerHide.flatten_links = 0;
        ConfigServerHide.links_delay = 300;