#define KEY_MAX_CHAN_BANS "max_chan_bans"
#define KEY_NICK "nick"
#define KEY_OLD_CHANSERV_NAME "old_chanserv_name"
-#define KEY_MAX_SWITCH_LOAD "max_switch_load"
-#define KEY_SWITCH_TIMEOUT "switch_timeout"
#define KEY_8BALL_RESPONSES "8ball"
#define KEY_OLD_BAN_NAMES "old_ban_names"
#define KEY_REFRESH_PERIOD "refresh_period"
#define KEY_SUPPORT_HELPER_EPITHET "support_helper_epithet"
#define KEY_NODELETE_LEVEL "nodelete_level"
#define KEY_MAX_USERINFO_LENGTH "max_userinfo_length"
+#define KEY_GIVEOWNERSHIP_PERIOD "giveownership_timeout"
/* ChanServ database */
#define KEY_CHANNELS "channels"
#define KEY_MAX "max"
#define KEY_NOTES "notes"
#define KEY_TOPIC_MASK "topic_mask"
+#define KEY_OWNER_TRANSFER "owner_transfer"
/* User data */
#define KEY_LEVEL "level"
{ "CSMSG_NO_SELF_CLVL", "You cannot change your own access." },
{ "CSMSG_NO_BUMP_ACCESS", "You cannot give users access greater than or equal to your own." },
{ "CSMSG_MULTIPLE_OWNERS", "There is more than one owner in %s; please use $bCLVL$b, $bDELOWNER$b and/or $bADDOWNER$b instead." },
+ { "CSMSG_TRANSFER_WAIT", "You must wait %s before you can give ownership of $b%s$b to someone else." },
{ "CSMSG_NO_TRANSFER_SELF", "You cannot give ownership to your own account." },
{ "CSMSG_OWNERSHIP_GIVEN", "Ownership of $b%s$b has been transferred to account $b%s$b." },
unsigned int greeting_length;
unsigned int refresh_period;
+ unsigned int giveownership_period;
unsigned int max_owned;
unsigned int max_chan_users;
channel->registered = now;
channel->visited = now;
channel->limitAdjusted = now;
+ channel->ownerTransfer = now;
channel->flags = CHANNEL_DEFAULT_FLAGS;
for(lvlOpt = 0; lvlOpt < NUM_LEVEL_OPTIONS; ++lvlOpt)
channel->lvlOpts[lvlOpt] = levelOptions[lvlOpt].default_value;
}
curr_user = owner;
}
+ else if (!force && (now < (time_t)(cData->ownerTransfer + chanserv_conf.giveownership_period)))
+ {
+ char delay[INTERVALLEN];
+ intervalString(delay, cData->ownerTransfer + chanserv_conf.giveownership_period - now, user->handle_info);
+ reply("CSMSG_TRANSFER_WAIT", delay, channel->name);
+ return 0;
+ }
if(!(new_owner_hi = modcmd_get_handle_info(user, argv[1])))
return 0;
if(new_owner_hi == user->handle_info)
new_owner->access = UL_OWNER;
if(curr_user)
curr_user->access = co_access;
+ cData->ownerTransfer = now;
reply("CSMSG_OWNERSHIP_GIVEN", channel->name, new_owner_hi->handle);
sprintf(reason, "%s ownership transferred to %s by %s.", channel->name, new_owner_hi->handle, user->handle_info->handle);
global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason);
NickChange(chanserv, str, 0);
str = database_get_data(conf_node, KEY_REFRESH_PERIOD, RECDB_QSTRING);
chanserv_conf.refresh_period = str ? ParseInterval(str) : 3*60*60;
+ str = database_get_data(conf_node, KEY_GIVEOWNERSHIP_PERIOD, RECDB_QSTRING);
+ chanserv_conf.giveownership_period = str ? ParseInterval(str) : 0;
str = database_get_data(conf_node, KEY_CTCP_SHORT_BAN_DURATION, RECDB_QSTRING);
chanserv_conf.ctcp_short_ban_duration = str ? str : "3m";
str = database_get_data(conf_node, KEY_CTCP_LONG_BAN_DURATION, RECDB_QSTRING);
/* We could use suspended->expires and suspended->revoked to
* set the CHANNEL_SUSPENDED flag, but we don't. */
}
- else if(IsSuspended(cData))
+ else if(IsSuspended(cData) && (str = database_get_data(hir->d.object, KEY_SUSPENDER, RECDB_QSTRING)))
{
suspended = calloc(1, sizeof(*suspended));
suspended->issued = 0;
suspended->revoked = 0;
+ suspended->suspender = strdup(str);
str = database_get_data(hir->d.object, KEY_SUSPEND_EXPIRES, RECDB_QSTRING);
suspended->expires = str ? atoi(str) : 0;
- suspended->suspender = strdup(database_get_data(hir->d.object, KEY_SUSPENDER, RECDB_QSTRING));
str = database_get_data(hir->d.object, KEY_SUSPEND_REASON, RECDB_QSTRING);
suspended->reason = strdup(str ? str : "No reason");
suspended->previous = NULL;
suspended->cData = cData;
}
else
+ {
+ cData->flags &= ~CHANNEL_SUSPENDED;
suspended = NULL; /* to squelch a warning */
+ }
if(IsSuspended(cData)) {
if(suspended->expires > now)
cData->registered = str ? (time_t)strtoul(str, NULL, 0) : now;
str = database_get_data(channel, KEY_VISITED, RECDB_QSTRING);
cData->visited = str ? (time_t)strtoul(str, NULL, 0) : now;
+ str = database_get_data(channel, KEY_OWNER_TRANSFER, RECDB_QSTRING);
+ cData->ownerTransfer = str ? (time_t)strtoul(str, NULL, 0) : 0;
str = database_get_data(channel, KEY_MAX, RECDB_QSTRING);
cData->max = str ? atoi(str) : 0;
str = database_get_data(channel, KEY_GREETING, RECDB_QSTRING);
saxdb_end_record(ctx);
}
+ if(channel->ownerTransfer)
+ saxdb_write_int(ctx, KEY_OWNER_TRANSFER, channel->ownerTransfer);
saxdb_write_int(ctx, KEY_VISITED, high_present ? now : channel->visited);
saxdb_end_record(ctx);
}
#endif
}
message_source = src;
- if (!(msg_type & 4) && !(format = handle_find_message(handle, format)))
+ if (!(msg_type & MSG_TYPE_NOXLATE)
+ && !(format = handle_find_message(handle, format)))
return 0;
/* fill in a buffer with the string */
input.used = 0;
case 'H':
value = handle ? handle->handle : "Account";
break;
-#define SEND_LINE() do { line[pos] = 0; if (pos > 0) irc_send(src, dest, line); chars_sent += pos; pos = 0; newline_ipos = ipos; } while (0)
+#define SEND_LINE(TRUNCED) do { \
+ line[pos] = 0; \
+ if (pos > 0) { \
+ if (!(msg_type & MSG_TYPE_MULTILINE) && (pos > 1) && TRUNCED) \
+ line[pos-2] = line[pos-1] = '.'; \
+ irc_send(src, dest, line); \
+ } \
+ chars_sent += pos; \
+ pos = 0; \
+ newline_ipos = ipos; \
+ if (!(msg_type & MSG_TYPE_MULTILINE)) return chars_sent; \
+} while (0)
/* Custom expansion handled by helpfile-specific function. */
case '{':
case '(': {
break;
case HF_TABLE:
/* Must send current line, then emit table. */
- SEND_LINE();
+ SEND_LINE(0);
table_send(src, (message_dest ? message_dest->nick : dest), 0, irc_send, exp.value.table);
value = "";
break;
/* word to send is too big to send now.. what to do? */
if (pos > 0) {
/* try to put it on a separate line */
- SEND_LINE();
+ SEND_LINE(1);
} else {
/* already at start of line; only send part of it */
strncpy(line, value, avail);
}
/* if we're looking at a newline, send the accumulated text */
if (*value == '\n') {
- SEND_LINE();
+ SEND_LINE(0);
value++;
}
}
send_line:
expand_pos = pos;
expand_ipos = ipos;
- SEND_LINE();
+ SEND_LINE(0);
#undef SEND_LINE
}
return chars_sent;
va_list ap;
va_start(ap, format);
- res = vsend_message(dest->nick, src, dest->handle_info, 4, expand, format, ap);
+ res = vsend_message(dest->nick, src, dest->handle_info, 12, expand, format, ap);
va_end(ap);
return res;
}