+ /* Next, try to find the G-line... */
+ if ((flags & GLINE_GLOBAL) || IsMe(acptr)) /* don't bother if it's not me! */
+ agline = gline_find(mask, flags | GLINE_ANY | GLINE_EXACT);
+
+ /* We now have all the pieces to tell us what we've got; let's put
+ * it all together and convert the rest of the arguments.
+ */
+
+ /* Handle the local G-lines first... */
+ if (flags & GLINE_LOCAL) {
+ assert(acptr);
+
+ /* normalize the action, first */
+ if (action == GLINE_LOCAL_ACTIVATE || action == GLINE_MODIFY)
+ action = GLINE_ACTIVATE;
+ else if (action == GLINE_LOCAL_DEACTIVATE)
+ action = GLINE_DEACTIVATE;
+
+ if (action == GLINE_ACTIVATE) { /* get expiration and reason */
+ if (parc < 5) /* check parameter count... */
+ return need_more_params(sptr, "GLINE");
+
+ expire = atoi(parv[3]); /* get expiration... */
+ expire = abs_expire(expire); /* convert to absolute... */
+ reason = parv[parc - 1]; /* and reason */
+
+ if (IsMe(acptr)) {
+ if (agline) /* G-line already exists, so let's ignore it... */
+ return 0;
+
+ /* OK, create the local G-line */
+ Debug((DEBUG_DEBUG, "I am creating a local G-line here; target %s, "
+ "mask %s, operforce %s, action %s, expire %Tu, reason: %s",
+ target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
+ action == GLINE_ACTIVATE ? "+" : "-", expire, reason));
+
+ return gline_add(cptr, sptr, mask, reason, expire, lastmod,
+ lifetime, flags | GLINE_ACTIVE);
+ }
+ } else if (IsMe(acptr)) { /* destroying a local G-line */
+ if (!agline) /* G-line doesn't exist, so let's complain... */
+ return send_reply(sptr, ERR_NOSUCHGLINE, mask);
+
+ /* Let's now destroy the G-line */;
+ Debug((DEBUG_DEBUG, "I am destroying a local G-line here; target %s, "
+ "mask %s, operforce %s, action %s", target, mask,
+ flags & GLINE_OPERFORCE ? "YES" : "NO",
+ action == GLINE_ACTIVATE ? "+" : "-"));
+
+ return gline_destroy(cptr, sptr, agline);