* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
*/
#include "stdinc.h"
#include "bandbi.h"
#include "operhash.h"
-static int mo_resv(struct Client *, struct Client *, int, const char **);
-static int ms_resv(struct Client *, struct Client *, int, const char **);
-static int me_resv(struct Client *, struct Client *, int, const char **);
-static int mo_unresv(struct Client *, struct Client *, int, const char **);
-static int ms_unresv(struct Client *, struct Client *, int, const char **);
-static int me_unresv(struct Client *, struct Client *, int, const char **);
+static int mo_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static int ms_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static int me_resv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static int mo_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static int ms_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static int me_unresv(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static const char resv_desc[] =
+ "Provides management of reserved nicknames and channels using (UN)RESV";
struct Message resv_msgtab = {
- "RESV", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
+ "RESV", 0, 0, 0, 0,
{mg_ignore, mg_not_oper, {ms_resv, 4}, {ms_resv, 4}, {me_resv, 5}, {mo_resv, 3}}
};
struct Message unresv_msgtab = {
- "UNRESV", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
+ "UNRESV", 0, 0, 0, 0,
{mg_ignore, mg_not_oper, {ms_unresv, 3}, {ms_unresv, 3}, {me_unresv, 2}, {mo_unresv, 2}}
};
mapi_clist_av1 resv_clist[] = { &resv_msgtab, &unresv_msgtab, NULL };
-DECLARE_MODULE_AV1(resv, NULL, NULL, resv_clist, NULL, NULL, "$Revision$");
+DECLARE_MODULE_AV2(resv, NULL, NULL, resv_clist, NULL, NULL, NULL, NULL, resv_desc);
static void parse_resv(struct Client *source_p, const char *name,
const char *reason, int temp_time, int propagated);
/*
* mo_resv()
- * parv[0] = sender prefix
* parv[1] = channel/nick to forbid
* parv[2] = reason
*/
static int
-mo_resv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+mo_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
const char *name;
const char *reason;
}
/* ms_resv()
- * parv[0] = sender prefix
* parv[1] = target server
* parv[2] = channel/nick to forbid
* parv[3] = reason
*/
static int
-ms_resv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+ms_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
/* parv[0] parv[1] parv[2] parv[3]
* oper target server resv reason
}
static int
-me_resv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+me_resv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
/* time name 0 :reason */
if(!IsPerson(source_p))
return;
}
- if(strchr(reason, '"'))
- {
- sendto_one_notice(source_p, ":Invalid character '\"' in comment");
- return;
- }
-
aconf = make_conf();
aconf->status = CONF_RESV_CHANNEL;
aconf->port = 0;
return;
}
- if(strchr(reason, '"'))
- {
- sendto_one_notice(source_p, ":Invalid character '\"' in comment");
- return;
- }
-
if(!valid_wild_card_simple(name))
{
sendto_one_notice(source_p,
}
rb_dlinkAddAlloc(aconf, &resv_conf_list);
+ resv_nick_fnc(aconf->host, aconf->passwd, temp_time);
}
else
sendto_one_notice(source_p, ":You have specified an invalid resv: [%s]", name);
/*
* mo_unresv()
- * parv[0] = sender prefix
* parv[1] = channel/nick to unforbid
*/
static int
-mo_unresv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+mo_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
int propagated = 1;
}
/* ms_unresv()
- * parv[0] = sender prefix
* parv[1] = target server
* parv[2] = resv to remove
*/
static int
-ms_unresv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+ms_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
/* parv[0] parv[1] parv[2]
* oper target server resv to remove
}
static int
-me_unresv(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+me_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
/* name */
if(!IsPerson(source_p))
{
struct ConfItem *aconf = NULL;
rb_dlink_node *ptr;
+ time_t now;
if(IsChannelName(name))
{
if((aconf = hash_find_resv(name)) == NULL)
{
if(propagated && rb_dlink_list_length(&cluster_conf_list))
- cluster_generic(source_p, "UNXLINE", SHARED_UNXLINE, CAP_CLUSTER, "%s", name);
+ cluster_generic(source_p, "UNRESV", SHARED_UNRESV, CAP_CLUSTER, "%s", name);
sendto_one_notice(source_p, ":No RESV for %s", name);
return;
"%s has removed the global RESV for: [%s]",
get_oper_name(source_p), name);
ilog(L_KLINE, "UR %s %s", get_oper_name(source_p), name);
- if(aconf->created < rb_current_time())
- aconf->created = rb_current_time();
+ now = rb_current_time();
+ if(aconf->created < now)
+ aconf->created = now;
else
aconf->created++;
aconf->hold = aconf->created;
(unsigned long)aconf->created,
0,
(int)(aconf->lifetime - aconf->created));
- deactivate_conf(aconf, ptr);
+ deactivate_conf(aconf, ptr, now);
return;
}
else if(propagated && rb_dlink_list_length(&cluster_conf_list) > 0)
if(aconf == NULL)
{
if(propagated && rb_dlink_list_length(&cluster_conf_list))
- cluster_generic(source_p, "UNXLINE", SHARED_UNXLINE, CAP_CLUSTER, "%s", name);
+ cluster_generic(source_p, "UNRESV", SHARED_UNRESV, CAP_CLUSTER, "%s", name);
sendto_one_notice(source_p, ":No RESV for %s", name);
return;
"%s has removed the global RESV for: [%s]",
get_oper_name(source_p), name);
ilog(L_KLINE, "UR %s %s", get_oper_name(source_p), name);
- if(aconf->created < rb_current_time())
- aconf->created = rb_current_time();
+ now = rb_current_time();
+ if(aconf->created < now)
+ aconf->created = now;
else
aconf->created++;
aconf->hold = aconf->created;
(unsigned long)aconf->created,
0,
(int)(aconf->lifetime - aconf->created));
- deactivate_conf(aconf, ptr);
+ deactivate_conf(aconf, ptr, now);
return;
}
else if(propagated && rb_dlink_list_length(&cluster_conf_list) > 0)