- /* XXX modify the G-line */;
-
- /* XXX create the G-line */return 0;
-
-
-
-
-
-/* if ((parc == 3 && *mask == '-') || parc == 5) */
-/* { */
-/* if (!find_conf_byhost(cli_confs(cptr), cli_name(sptr), CONF_UWORLD)) */
-/* return need_more_params(sptr, "GLINE"); */
-
-/* flags |= GLINE_FORCE; */
-/* } */
-/* else if (parc > 5) */
-/* lastmod = atoi(parv[4]); */
-/* else */
-/* return need_more_params(sptr, "GLINE"); */
-
-/* if (parc > 4) */
-/* reason = parv[parc - 1]; */
-
-/* if (IsServer(sptr)) */
-/* flags |= GLINE_FORCE; */
-
-/* if (!(target[0] == '*' && target[1] == '\0')) { */
-/* if (!(acptr = FindNServer(target))) */
-/* return 0; /\* no such server *\/ */
-
-/* if (!IsMe(acptr)) { /\* manually propagate *\/ */
-/* if (!lastmod) */
-/* sendcmdto_one(sptr, CMD_GLINE, acptr, */
-/* (parc == 3) ? "%C %s" : "%C %s %s :%s", acptr, mask, */
-/* parv[3], reason); */
-/* else */
-/* sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s %s %s :%s", acptr, */
-/* flags & GLINE_OPERFORCE ? "!" : "", mask, parv[3], */
-/* parv[4], reason); */
-
-/* return 0; */
-/* } */
-
-/* flags |= GLINE_LOCAL; */
-/* } */
-
-/* if (*mask == '-') */
-/* mask++; */
-/* else if (*mask == '+') { */
-/* flags |= GLINE_ACTIVE; */
-/* mask++; */
-/* } else */
-/* flags |= GLINE_ACTIVE; */
-
-/* expire_off = parc < 5 ? 0 : atoi(parv[3]); */
-
-/* agline = gline_find(mask, GLINE_ANY | GLINE_EXACT); */
-
-/* if (agline) { */
-/* if (GlineIsLocal(agline) && !(flags & GLINE_LOCAL)) /\* global over local *\/ */
-/* gline_free(agline); */
-/* else if (!lastmod && ((flags & GLINE_ACTIVE) == GlineIsRemActive(agline))) */
-/* return gline_propagate(cptr, sptr, agline); */
-/* else if (!lastmod || GlineLastMod(agline) < lastmod) { /\* new mod *\/ */
-/* if (flags & GLINE_ACTIVE) */
-/* return gline_activate(cptr, sptr, agline, lastmod, flags); */
-/* else */
-/* return gline_deactivate(cptr, sptr, agline, lastmod, flags); */
-/* } else if (GlineLastMod(agline) == lastmod || IsBurstOrBurstAck(cptr)) */
-/* return 0; */
-/* else */
-/* return gline_resend(cptr, agline); /\* other server desynched WRT gline *\/ */
-/* } else if (parc == 3 && !(flags & GLINE_ACTIVE)) { */
-/* /\* U-lined server removing a G-line we don't have; propagate the removal */
-/* * anyway. */
-/* *\/ */
-/* if (!(flags & GLINE_LOCAL)) */
-/* sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* -%s", mask); */
-/* return 0; */
-/* } else if (parc < 5) */
-/* return need_more_params(sptr, "GLINE"); */
-
-/* return gline_add(cptr, sptr, mask, reason, expire_off, lastmod, flags); */
+ return gline_modify(cptr, sptr, agline, action, reason, expire,
+ lastmod, lifetime, flags);
+
+ assert(action != GLINE_LOCAL_ACTIVATE);
+ assert(action != GLINE_LOCAL_DEACTIVATE);
+ assert(action != GLINE_MODIFY);
+
+ if (!expire) { /* Cannot *add* a G-line we don't have, but try hard */
+ Debug((DEBUG_DEBUG, "Propagating G-line %s for G-line we don't have",
+ action == GLINE_ACTIVATE ? "activation" : "deactivation"));
+
+ /* propagate the G-line, even though we don't have it */
+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s %Tu",
+ action == GLINE_ACTIVATE ? '+' : '-',
+ mask, lastmod);
+
+ return 0;
+ }
+
+ return gline_add(cptr, sptr, mask, reason, expire, lastmod, lifetime,
+ flags | ((action == GLINE_ACTIVATE) ? GLINE_ACTIVE : 0));