]> jfr.im git - solanum.git/blobdiff - modules/m_resv.c
reference.conf: add drain_reason
[solanum.git] / modules / m_resv.c
index 84242b951d85445f1f6474bfa4766f8d827e5b07..4160326cd53695bec887c9db17d625996b6d5951 100644 (file)
@@ -69,7 +69,6 @@ static void propagate_resv(struct Client *source_p, const char *target,
 static void cluster_resv(struct Client *source_p, int temp_time,
                         const char *name, const char *reason);
 
-static void handle_remote_unresv(struct Client *source_p, const char *name);
 static void remove_resv(struct Client *source_p, const char *name, int propagated);
 
 /*
@@ -131,6 +130,13 @@ mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
        /* remote resv.. */
        if(target_server)
        {
+               if (temp_time)
+                       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is adding a %d min. RESV for [%s] on %s [%s]",
+                                       get_oper_name(source_p), temp_time / 60, name, target_server, reason);
+               else
+                       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is adding a permanent RESV for [%s] on %s [%s]",
+                                       get_oper_name(source_p), name, target_server, reason);
+
                propagate_resv(source_p, target_server, temp_time, name, reason);
 
                if(match(target_server, me.name) == 0)
@@ -193,12 +199,6 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
 {
        struct ConfItem *aconf;
 
-       if(!MyClient(source_p) &&
-          !find_shared_conf(source_p->username, source_p->host,
-                            source_p->servptr->name,
-                            (temp_time > 0) ? SHARED_TRESV : SHARED_PRESV))
-               return;
-
        if(IsChannelName(name))
        {
                if(hash_find_resv(name))
@@ -228,7 +228,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
                        aconf->hold = rb_current_time() + temp_time;
                        aconf->lifetime = aconf->hold;
                        replace_old_ban(aconf);
-                       rb_dlinkAddAlloc(aconf, &prop_bans);
+                       add_prop_ban(aconf);
 
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                               "%s added global %d min. RESV for [%s] [%s]",
@@ -312,7 +312,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
                        aconf->hold = rb_current_time() + temp_time;
                        aconf->lifetime = aconf->hold;
                        replace_old_ban(aconf);
-                       rb_dlinkAddAlloc(aconf, &prop_bans);
+                       add_prop_ban(aconf);
 
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                               "%s added global %d min. RESV for [%s] [%s]",
@@ -473,7 +473,7 @@ ms_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
        if(!IsPerson(source_p))
                return;
 
-       handle_remote_unresv(source_p, parv[2]);
+       remove_resv(source_p, parv[2], 0);
 }
 
 static void
@@ -483,19 +483,7 @@ me_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
        if(!IsPerson(source_p))
                return;
 
-       handle_remote_unresv(source_p, parv[1]);
-}
-
-static void
-handle_remote_unresv(struct Client *source_p, const char *name)
-{
-       if(!find_shared_conf(source_p->username, source_p->host,
-                            source_p->servptr->name, SHARED_UNRESV))
-               return;
-
-       remove_resv(source_p, name, 0);
-
-       return;
+       remove_resv(source_p, parv[1], 0);
 }
 
 static void
@@ -523,8 +511,7 @@ remove_resv(struct Client *source_p, const char *name, int propagated)
                                sendto_one_notice(source_p, ":Cannot remove global RESV %s on specific servers", name);
                                return;
                        }
-                       ptr = rb_dlinkFind(aconf, &prop_bans);
-                       if(ptr == NULL)
+                       if (!lookup_prop_ban(aconf))
                                return;
                        sendto_one_notice(source_p, ":RESV for [%s] is removed", name);
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
@@ -546,7 +533,7 @@ remove_resv(struct Client *source_p, const char *name, int propagated)
                                        (unsigned long)aconf->created,
                                        0,
                                        (int)(aconf->lifetime - aconf->created));
-                       deactivate_conf(aconf, ptr, now);
+                       deactivate_conf(aconf, now);
                        return;
                }
                else if(propagated && rb_dlink_list_length(&cluster_conf_list) > 0)
@@ -597,8 +584,7 @@ remove_resv(struct Client *source_p, const char *name, int propagated)
                                sendto_one_notice(source_p, ":Cannot remove global RESV %s on specific servers", name);
                                return;
                        }
-                       ptr = rb_dlinkFind(aconf, &prop_bans);
-                       if(ptr == NULL)
+                       if (!lookup_prop_ban(aconf))
                                return;
                        sendto_one_notice(source_p, ":RESV for [%s] is removed", name);
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
@@ -620,7 +606,7 @@ remove_resv(struct Client *source_p, const char *name, int propagated)
                                        (unsigned long)aconf->created,
                                        0,
                                        (int)(aconf->lifetime - aconf->created));
-                       deactivate_conf(aconf, ptr, now);
+                       deactivate_conf(aconf, now);
                        return;
                }
                else if(propagated && rb_dlink_list_length(&cluster_conf_list) > 0)