]> jfr.im git - solanum.git/blobdiff - modules/m_resv.c
reference.conf: add drain_reason
[solanum.git] / modules / m_resv.c
index 27f02084b3743aa6e98644d04e6b267d24a566cd..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)
@@ -222,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]",
@@ -306,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]",
@@ -467,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
@@ -477,13 +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)
-{
-       remove_resv(source_p, name, 0);
+       remove_resv(source_p, parv[1], 0);
 }
 
 static void
@@ -511,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,
@@ -534,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)
@@ -585,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,
@@ -608,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)