@@ -49,29 +49,34 @@ int ms_config(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
4949 const char * key , * value ;
5050 const char * old_value ;
5151 int result ;
52-
53- if (parc < 4 )
54- return need_more_params (sptr , "CF" );
5552
56- timestamp = atol (parv [1 ]);
57- key = parv [2 ];
58- value = parv [3 ];
53+ if (parc < 3 )
54+ return need_more_params (sptr , "CF" );
55+
56+ timestamp = atol (parv [1 ]);
57+ key = parv [2 ];
58+ value = (parc >= 4 ) ? parv [3 ] : "" ;
5959
60- /* Get the old value for comparison */
61- old_value = config_get (key );
62- char * old_value_copy = NULL ;
63- if (old_value )
64- DupString (old_value_copy , old_value );
60+ /* Get the old value for comparison */
61+ old_value = config_get (key );
62+ char * old_value_copy = NULL ;
63+ if (old_value )
64+ DupString (old_value_copy , old_value );
6565
6666 /* Try to set the configuration */
6767 result = config_set (key , value , timestamp );
68-
68+
6969 if (result != CONFIG_REJECTED ) {
70- /* Configuration was set or updated, propagate to other servers */
71- sendcmdto_serv_butone (sptr , CMD_CONFIG , cptr , "%Tu %s :%s" ,
72- timestamp , key , value );
73-
74- /* Send notification to operators based on what actually happened */
70+ /* Propagate to other servers */
71+ if (value [0 ] != '\0' ) {
72+ sendcmdto_serv_butone (sptr , CMD_CONFIG , cptr , "%Tu %s :%s" ,
73+ timestamp , key , value );
74+ } else {
75+ sendcmdto_serv_butone (sptr , CMD_CONFIG , cptr , "%Tu %s" ,
76+ timestamp , key );
77+ }
78+
79+ /* Notify operators */
7580 if (result == CONFIG_CREATED ) {
7681 sendto_opmask_butone (0 , SNO_NETWORK ,
7782 "Network configuration set: %s = %s" ,
@@ -80,10 +85,16 @@ int ms_config(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
8085 sendto_opmask_butone (0 , SNO_NETWORK ,
8186 "Network configuration updated: %s = %s (was: %s)" ,
8287 key , value , old_value_copy ? old_value_copy : "(unset)" );
88+ } else if (result == CONFIG_DELETED ) {
89+ sendto_opmask_butone (0 , SNO_NETWORK ,
90+ "Network configuration deleted: %s (was: %s)" ,
91+ key , old_value_copy ? old_value_copy : "(unset)" );
92+ Debug ((DEBUG_DEBUG , "NETCONF: %s deleted %s (timestamp: %Tu)" ,
93+ cli_name (sptr ), key , timestamp ));
94+ } else {
95+ Debug ((DEBUG_DEBUG , "NETCONF: %s set %s = %s (timestamp: %Tu)" ,
96+ cli_name (sptr ), key , value , timestamp ));
8397 }
84-
85- Debug ((DEBUG_DEBUG , "NETCONF: %s set %s = %s (timestamp: %Tu)" ,
86- cli_name (sptr ), key , value , timestamp ));
8798 }
8899
89100 /* Clean up the copied old value */
0 commit comments