|
|
@@ -704,23 +704,28 @@ void write_invites(bd::Stream& stream, int idx)
|
|
|
static void write_chan(bd::Stream& stream, int idx, struct chanset_t* chan)
|
|
|
{
|
|
|
bd::String buf;
|
|
|
- char w[1024] = "";
|
|
|
-
|
|
|
- char inactive = 0;
|
|
|
|
|
|
putlog(LOG_DEBUG, "*", "writing channel %s to userfile..", chan->dname);
|
|
|
- get_mode_protect(chan, w, sizeof(w));
|
|
|
|
|
|
+ bool force_inactive = 0;
|
|
|
/* if a bot should explicitly NOT join, just set it +inactive ... */
|
|
|
if (idx >= 0 && !botshouldjoin(dcc[idx].user, chan))
|
|
|
- inactive = '+';
|
|
|
- /* ... otherwise give the bot the *actual* setting */
|
|
|
- else
|
|
|
- inactive = PLSMNS(channel_inactive(chan));
|
|
|
+ force_inactive = 1;
|
|
|
|
|
|
- stream << buf.printf("\
|
|
|
-+ channel add %s { chanmode { %s } addedby %s addedts %li \
|
|
|
-bad-cookie %d manop %d mdop %d mop %d limit %d ban-type %d \
|
|
|
+ stream << buf.printf("+ channel add %s { ", chan->dname);
|
|
|
+ if (chan != chanset_default)
|
|
|
+ stream << buf.printf("addedby %s addedts %li ", chan->added_by, (long)chan->added_ts);
|
|
|
+ stream << channel_to_string(chan, force_inactive);
|
|
|
+ stream << buf.printf("}\n");
|
|
|
+}
|
|
|
+
|
|
|
+bd::String channel_to_string(struct chanset_t* chan, bool force_inactive) {
|
|
|
+ bd::String buf;
|
|
|
+ char w[1024] = "";
|
|
|
+
|
|
|
+ get_mode_protect(chan, w, sizeof(w));
|
|
|
+ buf.printf("\
|
|
|
+chanmode { %s } bad-cookie %d manop %d mdop %d mop %d limit %d ban-type %d \
|
|
|
flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d \
|
|
|
flood-kick %d:%d flood-deop %d:%d flood-nick %d:%d flood-mjoin %d:%d \
|
|
|
closed-ban %d closed-invite %d closed-private %d ban-time %d \
|
|
|
@@ -729,11 +734,8 @@ flood-exempt %d flood-lock-time %d knock %d \
|
|
|
%cmeankicks %cenforcebans %cdynamicbans %cuserbans %cbitch \
|
|
|
%cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
|
|
|
%cdynamicinvites %cuserinvites %cnodesynch %cclosed %cvoice \
|
|
|
-%cfastop %cautoop %cbotbitch %cbackup %cnomassjoin %crbl %c%s}\n",
|
|
|
- chan->dname,
|
|
|
+%cfastop %cautoop %cbotbitch %cbackup %cnomassjoin %crbl %c%s",
|
|
|
w,
|
|
|
- chan->added_by,
|
|
|
- (long)chan->added_ts,
|
|
|
/* Chanchar template
|
|
|
* temp,
|
|
|
* also include temp %s in dprintf.
|
|
|
@@ -773,7 +775,7 @@ flood-exempt %d flood-lock-time %d knock %d \
|
|
|
PLSMNS(channel_bitch(chan)),
|
|
|
PLSMNS(channel_privchan(chan)),
|
|
|
PLSMNS(channel_cycle(chan)),
|
|
|
- inactive,
|
|
|
+ force_inactive ? '+' : PLSMNS(channel_inactive(chan)),
|
|
|
PLSMNS(channel_dynamicexempts(chan)),
|
|
|
PLSMNS(!channel_nouserexempts(chan)),
|
|
|
PLSMNS(channel_dynamicinvites(chan)),
|
|
|
@@ -794,6 +796,7 @@ flood-exempt %d flood-lock-time %d knock %d \
|
|
|
* PLSMNS(channel_temp(chan)),
|
|
|
*/
|
|
|
);
|
|
|
+ return buf;
|
|
|
}
|
|
|
|
|
|
/* Write the channels to the userfile
|