-#define KEY_SUPPORT_CHANNEL "support_channel"
-#define KEY_SUPPORT_CHANNEL_MODES "support_channel_modes"
-#define KEY_DB_BACKUP_FREQ "db_backup_freq"
-#define KEY_INFO_DELAY "info_delay"
-#define KEY_MAX_GREETLEN "max_greetlen"
-#define KEY_ADJUST_THRESHOLD "adjust_threshold"
-#define KEY_ADJUST_DELAY "adjust_delay"
-#define KEY_CHAN_EXPIRE_FREQ "chan_expire_freq"
-#define KEY_CHAN_EXPIRE_DELAY "chan_expire_delay"
-#define KEY_DNR_EXPIRE_FREQ "dnr_expire_freq"
-#define KEY_MAX_CHAN_USERS "max_chan_users"
-#define KEY_MAX_CHAN_BANS "max_chan_bans"
-#define KEY_NICK "nick"
-#define KEY_OLD_CHANSERV_NAME "old_chanserv_name"
-#define KEY_8BALL_RESPONSES "8ball"
-#define KEY_OLD_BAN_NAMES "old_ban_names"
-#define KEY_REFRESH_PERIOD "refresh_period"
+#define KEY_SUPPORT_CHANNEL "support_channel"
+#define KEY_SUPPORT_CHANNEL_MODES "support_channel_modes"
+#define KEY_DB_BACKUP_FREQ "db_backup_freq"
+#define KEY_INFO_DELAY "info_delay"
+#define KEY_MAX_GREETLEN "max_greetlen"
+#define KEY_ADJUST_THRESHOLD "adjust_threshold"
+#define KEY_ADJUST_DELAY "adjust_delay"
+#define KEY_CHAN_EXPIRE_FREQ "chan_expire_freq"
+#define KEY_CHAN_EXPIRE_DELAY "chan_expire_delay"
+#define KEY_DNR_EXPIRE_FREQ "dnr_expire_freq"
+#define KEY_MAX_CHAN_USERS "max_chan_users"
+#define KEY_MAX_CHAN_BANS "max_chan_bans"
+#define KEY_NICK "nick"
+#define KEY_OLD_CHANSERV_NAME "old_chanserv_name"
+#define KEY_8BALL_RESPONSES "8ball"
+#define KEY_OLD_BAN_NAMES "old_ban_names"
+#define KEY_REFRESH_PERIOD "refresh_period"
#define KEY_CTCP_SHORT_BAN_DURATION "ctcp_short_ban_duration"
#define KEY_CTCP_LONG_BAN_DURATION "ctcp_long_ban_duration"
#define KEY_MAX_OWNED "max_owned"
#define KEY_IRC_OPERATOR_EPITHET "irc_operator_epithet"
#define KEY_NETWORK_HELPER_EPITHET "network_helper_epithet"
#define KEY_SUPPORT_HELPER_EPITHET "support_helper_epithet"
#define KEY_CTCP_SHORT_BAN_DURATION "ctcp_short_ban_duration"
#define KEY_CTCP_LONG_BAN_DURATION "ctcp_long_ban_duration"
#define KEY_MAX_OWNED "max_owned"
#define KEY_IRC_OPERATOR_EPITHET "irc_operator_epithet"
#define KEY_NETWORK_HELPER_EPITHET "network_helper_epithet"
#define KEY_SUPPORT_HELPER_EPITHET "support_helper_epithet"
-#define KEY_NOTE_OPSERV_ACCESS "opserv_access"
-#define KEY_NOTE_CHANNEL_ACCESS "channel_access"
-#define KEY_NOTE_SETTER_ACCESS "setter_access"
-#define KEY_NOTE_VISIBILITY "visibility"
-#define KEY_NOTE_VIS_PRIVILEGED "privileged"
-#define KEY_NOTE_VIS_CHANNEL_USERS "channel_users"
-#define KEY_NOTE_VIS_ALL "all"
-#define KEY_NOTE_MAX_LENGTH "max_length"
-#define KEY_NOTE_SETTER "setter"
-#define KEY_NOTE_NOTE "note"
+#define KEY_NOTE_OPSERV_ACCESS "opserv_access"
+#define KEY_NOTE_CHANNEL_ACCESS "channel_access"
+#define KEY_NOTE_SETTER_ACCESS "setter_access"
+#define KEY_NOTE_VISIBILITY "visibility"
+#define KEY_NOTE_VIS_PRIVILEGED "privileged"
+#define KEY_NOTE_VIS_CHANNEL_USERS "channel_users"
+#define KEY_NOTE_VIS_ALL "all"
+#define KEY_NOTE_MAX_LENGTH "max_length"
+#define KEY_NOTE_SETTER "setter"
+#define KEY_NOTE_NOTE "note"
-#define KEY_REGISTERED "registered"
-#define KEY_REGISTRAR "registrar"
-#define KEY_SUSPENDED "suspended"
-#define KEY_PREVIOUS "previous"
-#define KEY_SUSPENDER "suspender"
-#define KEY_ISSUED "issued"
-#define KEY_REVOKED "revoked"
-#define KEY_SUSPEND_EXPIRES "suspend_expires"
-#define KEY_SUSPEND_REASON "suspend_reason"
-#define KEY_VISITED "visited"
-#define KEY_TOPIC "topic"
-#define KEY_GREETING "greeting"
-#define KEY_USER_GREETING "user_greeting"
-#define KEY_MODES "modes"
-#define KEY_FLAGS "flags"
-#define KEY_OPTIONS "options"
-#define KEY_USERS "users"
-#define KEY_BANS "bans"
-#define KEY_MAX "max"
-#define KEY_NOTES "notes"
-#define KEY_TOPIC_MASK "topic_mask"
-#define KEY_OWNER_TRANSFER "owner_transfer"
+#define KEY_REGISTERED "registered"
+#define KEY_REGISTRAR "registrar"
+#define KEY_SUSPENDED "suspended"
+#define KEY_PREVIOUS "previous"
+#define KEY_SUSPENDER "suspender"
+#define KEY_ISSUED "issued"
+#define KEY_REVOKED "revoked"
+#define KEY_SUSPEND_EXPIRES "suspend_expires"
+#define KEY_SUSPEND_REASON "suspend_reason"
+#define KEY_VISITED "visited"
+#define KEY_TOPIC "topic"
+#define KEY_GREETING "greeting"
+#define KEY_USER_GREETING "user_greeting"
+#define KEY_MODES "modes"
+#define KEY_FLAGS "flags"
+#define KEY_OPTIONS "options"
+#define KEY_USERS "users"
+#define KEY_BANS "bans"
+#define KEY_MAX "max"
+#define KEY_NOTES "notes"
+#define KEY_TOPIC_MASK "topic_mask"
+#define KEY_OWNER_TRANSFER "owner_transfer"
- /* Flag to track whether the ban's been moved
- to the destination yet. */
- int moved = 0;
-
- /* Possible to assert (sbData->prev == NULL) here. */
- sNext = sbData->next;
-
- for(tbData = tFront; tbData; tbData = tNext)
- {
- tNext = tbData->next;
-
- /* Perform two comparisons between each source
- and target ban, conflicts are resolved by
- keeping the broader ban and copying the later
- expiration and triggered time. */
- if(match_ircglobs(tbData->mask, sbData->mask))
- {
- /* There is a broader ban in the target channel that
- overrides one in the source channel; remove the
- source ban and break. */
- if(sbData->expires > tbData->expires)
- tbData->expires = sbData->expires;
- if(sbData->triggered > tbData->triggered)
- tbData->triggered = sbData->triggered;
- del_channel_ban(sbData);
- break;
- }
- else if(match_ircglobs(sbData->mask, tbData->mask))
- {
- /* There is a broader ban in the source channel that
- overrides one in the target channel; remove the
- target ban, fall through and move the source over. */
- if(tbData->expires > sbData->expires)
- sbData->expires = tbData->expires;
- if(tbData->triggered > sbData->triggered)
- sbData->triggered = tbData->triggered;
- if(tbData == tFront)
- tFront = tNext;
- del_channel_ban(tbData);
- }
-
- /* Source bans can override multiple target bans, so
- we allow a source to run through this loop multiple
- times, but we can only move it once. */
- if(moved)
- continue;
- moved = 1;
-
- /* Remove the source ban from the source ban list. */
- if(sbData->next)
- sbData->next->prev = sbData->prev;
-
- /* Modify the source ban's associated channel. */
- sbData->channel = target;
-
- /* Insert the ban into the target channel's linked list. */
- sbData->prev = NULL;
- sbData->next = target->bans;
-
- if(target->bans)
- target->bans->prev = sbData;
- target->bans = sbData;
-
- /* Update the user counts for the target channel. */
- target->banCount++;
- }
+ /* Flag to track whether the ban's been moved
+ to the destination yet. */
+ int moved = 0;
+
+ /* Possible to assert (sbData->prev == NULL) here. */
+ sNext = sbData->next;
+
+ for(tbData = tFront; tbData; tbData = tNext)
+ {
+ tNext = tbData->next;
+
+ /* Perform two comparisons between each source
+ and target ban, conflicts are resolved by
+ keeping the broader ban and copying the later
+ expiration and triggered time. */
+ if(match_ircglobs(tbData->mask, sbData->mask))
+ {
+ /* There is a broader ban in the target channel that
+ overrides one in the source channel; remove the
+ source ban and break. */
+ if(sbData->expires > tbData->expires)
+ tbData->expires = sbData->expires;
+ if(sbData->triggered > tbData->triggered)
+ tbData->triggered = sbData->triggered;
+ del_channel_ban(sbData);
+ break;
+ }
+ else if(match_ircglobs(sbData->mask, tbData->mask))
+ {
+ /* There is a broader ban in the source channel that
+ overrides one in the target channel; remove the
+ target ban, fall through and move the source over. */
+ if(tbData->expires > sbData->expires)
+ sbData->expires = tbData->expires;
+ if(tbData->triggered > sbData->triggered)
+ sbData->triggered = tbData->triggered;
+ if(tbData == tFront)
+ tFront = tNext;
+ del_channel_ban(tbData);
+ }
+
+ /* Source bans can override multiple target bans, so
+ we allow a source to run through this loop multiple
+ times, but we can only move it once. */
+ if(moved)
+ continue;
+ moved = 1;
+
+ /* Remove the source ban from the source ban list. */
+ if(sbData->next)
+ sbData->next->prev = sbData->prev;
+
+ /* Modify the source ban's associated channel. */
+ sbData->channel = target;
+
+ /* Insert the ban into the target channel's linked list. */
+ sbData->prev = NULL;
+ sbData->next = target->bans;
+
+ if(target->bans)
+ target->bans->prev = sbData;
+ target->bans = sbData;
+
+ /* Update the user counts for the target channel. */
+ target->banCount++;
+ }
- struct banData *bData, *next;
-
- if(channel->channel_info->banCount >= chanserv_conf.max_chan_bans)
- {
- reply("CSMSG_MAXIMUM_BANS", chanserv_conf.max_chan_bans);
- free(ban);
- return 0;
- }
-
- if(action & ACTION_ADD_TIMED_BAN)
- {
- duration = ParseInterval(argv[2]);
-
- if(duration < 15)
- {
- reply("CSMSG_DURATION_TOO_LOW");
- free(ban);
- return 0;
- }
- else if(duration > (86400 * 365 * 2))
- {
- reply("CSMSG_DURATION_TOO_HIGH");
- free(ban);
- return 0;
- }
- }
-
- for(bData = channel->channel_info->bans; bData; bData = next)
- {
- if(match_ircglobs(bData->mask, ban))
- {
- int exact = !irccasecmp(bData->mask, ban);
-
- /* The ban is redundant; there is already a ban
- with the same effect in place. */
- if(exact)
- {
- if(bData->reason)
+ struct banData *bData, *next;
+
+ if(channel->channel_info->banCount >= chanserv_conf.max_chan_bans)
+ {
+ reply("CSMSG_MAXIMUM_BANS", chanserv_conf.max_chan_bans);
+ free(ban);
+ return 0;
+ }
+
+ if(action & ACTION_ADD_TIMED_BAN)
+ {
+ duration = ParseInterval(argv[2]);
+
+ if(duration < 15)
+ {
+ reply("CSMSG_DURATION_TOO_LOW");
+ free(ban);
+ return 0;
+ }
+ else if(duration > (86400 * 365 * 2))
+ {
+ reply("CSMSG_DURATION_TOO_HIGH");
+ free(ban);
+ return 0;
+ }
+ }
+
+ for(bData = channel->channel_info->bans; bData; bData = next)
+ {
+ if(match_ircglobs(bData->mask, ban))
+ {
+ int exact = !irccasecmp(bData->mask, ban);
+
+ /* The ban is redundant; there is already a ban
+ with the same effect in place. */
+ if(exact)
+ {
+ if(bData->reason)
- }
- if(exact && bData->expires)
- {
- int reset = 0;
-
- /* If the ban matches an existing one exactly,
- extend the expiration time if the provided
- duration is longer. */
- if(duration && ((time_t)(now + duration) > bData->expires))
- {
- bData->expires = now + duration;
- reset = 1;
- }
- else if(!duration)
- {
- bData->expires = 0;
- reset = 1;
- }
-
- if(reset)
- {
- /* Delete the expiration timeq entry and
- requeue if necessary. */
- timeq_del(0, expire_ban, bData, TIMEQ_IGNORE_WHEN);
-
- if(bData->expires)
- timeq_add(bData->expires, expire_ban, bData);
+ }
+ if(exact && bData->expires)
+ {
+ int reset = 0;
+
+ /* If the ban matches an existing one exactly,
+ extend the expiration time if the provided
+ duration is longer. */
+ if(duration && ((time_t)(now + duration) > bData->expires))
+ {
+ bData->expires = now + duration;
+ reset = 1;
+ }
+ else if(!duration)
+ {
+ bData->expires = 0;
+ reset = 1;
+ }
+
+ if(reset)
+ {
+ /* Delete the expiration timeq entry and
+ requeue if necessary. */
+ timeq_del(0, expire_ban, bData, TIMEQ_IGNORE_WHEN);
+
+ if(bData->expires)
+ timeq_add(bData->expires, expire_ban, bData);
- }
-
- if(!irccasecmp(argv[i], "name"))
- search->name = argv[++i];
- else if(!irccasecmp(argv[i], "registrar"))
- search->registrar = argv[++i];
- else if(!irccasecmp(argv[i], "unvisited"))
- search->unvisited = ParseInterval(argv[++i]);
- else if(!irccasecmp(argv[i], "registered"))
- search->registered = ParseInterval(argv[++i]);
- else if(!irccasecmp(argv[i], "flags"))
- {
- i++;
- if(!irccasecmp(argv[i], "nodelete"))
- search->flags |= CHANNEL_NODELETE;
- else if(!irccasecmp(argv[i], "suspended"))
- search->flags |= CHANNEL_SUSPENDED;
+ }
+
+ if(!irccasecmp(argv[i], "name"))
+ search->name = argv[++i];
+ else if(!irccasecmp(argv[i], "registrar"))
+ search->registrar = argv[++i];
+ else if(!irccasecmp(argv[i], "unvisited"))
+ search->unvisited = ParseInterval(argv[++i]);
+ else if(!irccasecmp(argv[i], "registered"))
+ search->registered = ParseInterval(argv[++i]);
+ else if(!irccasecmp(argv[i], "flags"))
+ {
+ i++;
+ if(!irccasecmp(argv[i], "nodelete"))
+ search->flags |= CHANNEL_NODELETE;
+ else if(!irccasecmp(argv[i], "suspended"))
+ search->flags |= CHANNEL_SUSPENDED;
- else
- {
- send_message(user, chanserv, "CSMSG_INVALID_CFLAG", argv[i]);
- goto fail;
- }
- }
- else if(!irccasecmp(argv[i], "limit"))
- search->limit = strtoul(argv[++i], NULL, 10);
- else
- {
- send_message(user, chanserv, "MSG_INVALID_CRITERIA", argv[i]);
- goto fail;
- }
+ else
+ {
+ send_message(user, chanserv, "CSMSG_INVALID_CFLAG", argv[i]);
+ goto fail;
+ }
+ }
+ else if(!irccasecmp(argv[i], "limit"))
+ search->limit = strtoul(argv[++i], NULL, 10);
+ else
+ {
+ send_message(user, chanserv, "MSG_INVALID_CRITERIA", argv[i]);
+ goto fail;
+ }
- /* Allow for a bit of padding so that the limit doesn't
- track the user count exactly, which could get annoying. */
- if((mn->channel->limit - mn->channel->members.used) > chanserv_conf.adjust_threshold + 5)
- {
- timeq_del(0, chanserv_adjust_limit, cData, TIMEQ_IGNORE_WHEN);
- timeq_add(now + chanserv_conf.adjust_delay, chanserv_adjust_limit, cData);
- }
+ /* Allow for a bit of padding so that the limit doesn't
+ track the user count exactly, which could get annoying. */
+ if((mn->channel->limit - mn->channel->members.used) > chanserv_conf.adjust_threshold + 5)
+ {
+ timeq_del(0, chanserv_adjust_limit, cData, TIMEQ_IGNORE_WHEN);
+ timeq_add(now + chanserv_conf.adjust_delay, chanserv_adjust_limit, cData);
+ }