ajupe = (struct Jupe*) MyMalloc(sizeof(struct Jupe)); /* alloc memory */
assert(0 != ajupe);
- DupString(ajupe->ju_server, server); /* copy vital information */
+ DupString(ajupe->ju_server, server); /* copy vital information */
DupString(ajupe->ju_reason, reason);
ajupe->ju_expire = expire;
ajupe->ju_lastmod = lastmod;
- ajupe->ju_flags = flags; /* set jupe flags */
+ ajupe->ju_flags = flags & JUPE_MASK; /* set jupe flags */
- ajupe->ju_next = GlobalJupeList; /* link it into the list */
+ ajupe->ju_next = GlobalJupeList; /* link it into the list */
ajupe->ju_prev_p = &GlobalJupeList;
if (GlobalJupeList)
GlobalJupeList->ju_prev_p = &ajupe->ju_next;
return;
sendcmdto_serv_butone(cptr, CMD_JUPE, sptr, "* %c%s %Tu %Tu :%s",
- JupeIsActive(jupe) ? '+' : '-', jupe->ju_server,
+ JupeIsRemActive(jupe) ? '+' : '-', jupe->ju_server,
jupe->ju_expire - CurrentTime, jupe->ju_lastmod,
jupe->ju_reason);
}
jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
time_t lastmod, unsigned int flags)
{
+ unsigned int saveflags = 0;
+
assert(0 != jupe);
assert(!JupeIsLocal(jupe));
- jupe->ju_flags |= JUPE_ACTIVE;
+ saveflags = jupe->ju_flags;
- if (jupe->ju_lastmod >= lastmod) /* force lastmod to increase */
- jupe->ju_lastmod++;
- else
- jupe->ju_lastmod = lastmod;
+ if (flags & JUPE_LOCAL)
+ jupe->ju_flags &= ~JUPE_LDEACT;
+ else {
+ jupe->ju_flags |= JUPE_ACTIVE;
+
+ if (jupe->ju_lastmod >= lastmod) /* force lastmod to increase */
+ jupe->ju_lastmod++;
+ else
+ jupe->ju_lastmod = lastmod;
+ }
+
+ if ((saveflags & JUPE_ACTMASK) == JUPE_ACTIVE)
+ return 0; /* was active to begin with */
/* Inform ops and log it */
sendto_op_mask(SNO_NETWORK, "%s activating JUPE for %s, expiring at "
jupe_deactivate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
time_t lastmod, unsigned int flags)
{
+ unsigned int saveflags = 0;
+
assert(0 != jupe);
+ saveflags = jupe->ju_flags;
+
if (!JupeIsLocal(jupe)) {
- jupe->ju_flags &= ~JUPE_ACTIVE;
+ if (flags & JUPE_LOCAL)
+ jupe->ju_flags |= JUPE_LDEACT;
+ else {
+ jupe->ju_flags &= ~JUPE_ACTIVE;
+
+ if (jupe->ju_lastmod >= lastmod) /* force lastmod to increase */
+ jupe->ju_lastmod++;
+ else
+ jupe->ju_lastmod = lastmod;
+ }
- if (jupe->ju_lastmod >= lastmod) /* force lastmod to increase */
- jupe->ju_lastmod++;
- else
- jupe->ju_lastmod = lastmod;
+ if ((saveflags & JUPE_ACTMASK) != JUPE_ACTIVE)
+ return 0; /* was inactive to begin with */
}
/* Inform ops and log it */
jupe_free(jupe);
else if (!JupeIsLocal(jupe)) /* forward global jupes */
sendcmdto_one(cptr, CMD_JUPE, &me, "* %c%s %Tu %Tu :%s",
- JupeIsActive(jupe) ? '+' : '-', jupe->ju_server,
+ JupeIsRemActive(jupe) ? '+' : '-', jupe->ju_server,
jupe->ju_expire - CurrentTime, jupe->ju_lastmod,
jupe->ju_reason);
}
return 0;
sendcmdto_one(cptr, CMD_JUPE, &me, "* %c%s %Tu %Tu :%s",
- JupeIsActive(jupe) ? '+' : '-', jupe->ju_server,
+ JupeIsRemActive(jupe) ? '+' : '-', jupe->ju_server,
jupe->ju_expire - CurrentTime, jupe->ju_lastmod,
jupe->ju_reason);