* added srvx.conf setting to allow chanserv to work being outside of a channel; if you'd like to have srvx set a mode as it joins, edit REGISTERED_MODE in hash.h. this will not work properly on P10 networks - though it may be nice for bahamut-based networks. either way, please do not ask us for assistance.
* changed the way part functions are called - a modeNode is now passed, and they are run *before* the user's membership link in that channel is nuked.
git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-58
# arch-tag: automatic-ChangeLog--srvx@srvx.net--2004-srvx/srvx--devo--1.3
#
+2004-05-06 09:46:38 GMT adam <adam@gamesurge.net> patch-58
+
+ Summary:
+ basic off-channel support; restructuring how part functions are handled
+ Revision:
+ srvx--devo--1.3--patch-58
+
+ * added srvx.conf setting to allow chanserv to work being outside of a channel; if you'd like to have srvx set a mode as it joins, edit REGISTERED_MODE in hash.h. this will not work properly on P10 networks - though it may be nice for bahamut-based networks. either way, please do not ask us for assistance.
+
+ * changed the way part functions are called - a modeNode is now passed, and they are run *before* the user's membership link in that channel is nuked.
+
+
+
+ modified files:
+ ChangeLog src/chanserv.c src/hash.c src/hash.h
+ src/mod-helpserv.c src/mod-snoop.c src/proto-common.c
+ src/proto-p10.c srvx.conf.example
+
+
2004-05-01 11:17:11 GMT adam <akl@gamesurge.net> patch-57
Summary:
}
static void
-handle_part(struct userNode *user, struct chanNode *channel, UNUSED_ARG(const char *reason))
+handle_part(struct modeNode *mn, UNUSED_ARG(const char *reason))
{
struct chanData *cData;
struct userData *uData;
- cData = channel->channel_info;
- if(!cData || IsSuspended(cData) || IsLocal(user))
+ cData = mn->channel->channel_info;
+ if(!cData || IsSuspended(cData) || IsLocal(mn->user))
return;
- if((cData->flags & CHANNEL_DYNAMIC_LIMIT) && !channel->join_flooded)
+ if((cData->flags & CHANNEL_DYNAMIC_LIMIT) && !mn->channel->join_flooded)
{
/* Allow for a bit of padding so that the limit doesn't
track the user count exactly, which could get annoying. */
- if((channel->limit - channel->members.used) > chanserv_conf.adjust_threshold + 5)
+ 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);
}
}
- if((uData = GetTrueChannelAccess(cData, user->handle_info)))
+ if((uData = GetTrueChannelAccess(cData, mn->user->handle_info)))
{
- scan_user_presence(uData, user);
+ scan_user_presence(uData, mn->user);
uData->seen = now;
}
- if(IsHelping(user) && IsSupportHelper(user))
+ if(IsHelping(mn->user) && IsSupportHelper(mn->user))
{
unsigned int ii, jj;
for(ii = 0; ii < chanserv_conf.support_channels.used; ++ii)
{
- for(jj = 0; jj < user->channels.used; ++jj)
- if(user->channels.list[jj]->channel == chanserv_conf.support_channels.list[ii])
+ for(jj = 0; jj < mn->user->channels.used; ++jj)
+ if(mn->user->channels.list[jj]->channel == chanserv_conf.support_channels.list[ii])
break;
- if(jj < user->channels.used)
+ if(jj < mn->user->channels.used)
break;
}
if(ii == chanserv_conf.support_channels.used)
- HANDLE_CLEAR_FLAG(user->handle_info, HELPING);
+ HANDLE_CLEAR_FLAG(mn->user->handle_info, HELPING);
}
}
struct string_list *strlist;
struct chanNode *chan;
unsigned int ii;
+ extern int off_channel;
if(!(conf_node = conf_get_data(CHANSERV_CONF_NAME, RECDB_OBJECT)))
{
else
strlist = alloc_string_list(2);
chanserv_conf.old_ban_names = strlist;
+ /* the variable itself is actually declared in proto-common.c; this is equally
+ * parse issue. */
+ str = database_get_data(conf_node, "off_channel", RECDB_QSTRING);
+ off_channel = (str && enabled_string(str)) ? 1 : 0;
}
static void
char *str, *argv[10];
dict_iterator_t it;
unsigned int argc;
+ extern int off_channel;
channel = hir->d.object;
cData->flags &= ~CHANNEL_SUSPENDED;
}
- if(!(cData->flags & CHANNEL_SUSPENDED))
- {
- struct mod_chanmode change;
- mod_chanmode_init(&change);
- change.argc = 1;
- change.args[0].mode = MODE_CHANOP;
- change.args[0].member = AddChannelUser(chanserv, cNode);
- mod_chanmode_announce(chanserv, cNode, &change);
- }
- else if(suspended->expires > now)
- {
- timeq_add(suspended->expires, chanserv_expire_suspension, suspended);
+ if (!off_channel) {
+ if (!(cData->flags & CHANNEL_SUSPENDED)) {
+ struct mod_chanmode change;
+ mod_chanmode_init(&change);
+ change.argc = 1;
+ change.args[0].mode = MODE_CHANOP;
+ change.args[0].member = AddChannelUser(chanserv, cNode);
+ mod_chanmode_announce(chanserv, cNode, &change);
+
+ } else if (suspended->expires > now) {
+ timeq_add(suspended->expires, chanserv_expire_suspension, suspended);
+ }
}
str = database_get_data(channel, KEY_REGISTERED, RECDB_QSTRING);
&& (argc = split_line(str, 0, ArrayLength(argv), argv))
&& (modes = mod_chanmode_parse(cNode, argv, argc, MCP_KEY_FREE))) {
cData->modes = *modes;
+ if(off_channel && !(REGISTERED_MODE == 0))
+ cData->modes.modes_set |= REGISTERED_MODE;
if(cData->modes.argc > 1)
cData->modes.argc = 1;
if(!IsSuspended(cData))
if (!mNode)
return;
+ for (n=0; n<pf_used; n++)
+ pf_list[n](mNode, reason);
+
/* remove modeNode from channel and user */
modeList_remove(&channel->members, mNode);
modeList_remove(&user->channels, mNode);
free(mNode);
- for (n=0; n<pf_used; n++)
- pf_list[n](user, channel, reason);
-
if (!deleting && !channel->members.used && !channel->locks)
DelChannel(channel);
}
#define IsReggedNick(x) ((x)->modes & FLAGS_REGNICK)
#define IsLocal(x) ((x)->uplink == self)
+/* Please set this and define the mode you wish to be set/maintained on registered channels. */
+#define REGISTERED_MODE 0
+
#define NICKLEN 30
#define USERLEN 10
#define HOSTLEN 63
struct modeNode* AddChannelUser(struct userNode* user, struct chanNode* channel);
-typedef void (*part_func_t) (struct userNode *user, struct chanNode *chan, const char *reason);
+typedef void (*part_func_t) (struct modeNode *mn, const char *reason);
void reg_part_func(part_func_t handler);
void unreg_part_func(part_func_t handler);
void DelChannelUser(struct userNode* user, struct chanNode* channel, const char *reason, int deleting);
}
/* Drop requests that persist until part when a user leaves the chan */
-static void handle_part(struct userNode *user, struct chanNode *chan, UNUSED_ARG(const char *reason)) {
+static void handle_part(struct modeNode *mn, UNUSED_ARG(const char *reason)) {
struct helpserv_botlist *botlist;
struct helpserv_userlist *userlist;
const int from_opserv = 0; /* for helpserv_notice */
unsigned int i;
- if ((botlist = dict_find(helpserv_bots_bychan_dict, chan->name, NULL))) {
+ if ((botlist = dict_find(helpserv_bots_bychan_dict, mn->channel->name, NULL))) {
for (i=0; i < botlist->used; i++) {
struct helpserv_bot *hs;
dict_iterator_t it;
for (it=dict_first(hs->requests); it; it=iter_next(it)) {
struct helpserv_request *req = iter_data(it);
- if (user != req->user)
+ if (mn->user != req->user)
continue;
if (req->text->used) {
- helpserv_message(hs, user, MSGTYPE_REQ_DROPPED);
- helpserv_msguser(user, "HSMSG_REQ_DROPPED_PART", chan->name, req->id);
+ helpserv_message(hs, mn->user, MSGTYPE_REQ_DROPPED);
+ helpserv_msguser(mn->user, "HSMSG_REQ_DROPPED_PART", mn->channel->name, req->id);
if (req->helper && (hs->notify >= NOTIFY_DROP))
- helpserv_notify(req->helper, "HSMSG_NOTIFY_REQ_DROP_PART", req->id, user->nick);
+ helpserv_notify(req->helper, "HSMSG_NOTIFY_REQ_DROP_PART", req->id, mn->user->nick);
}
helpserv_log_request(req, "Dropped");
dict_remove(hs->requests, iter_key(it));
}
}
- if (user->handle_info && (userlist = dict_find(helpserv_users_byhand_dict, user->handle_info->handle, NULL))) {
+ if (mn->user->handle_info && (userlist = dict_find(helpserv_users_byhand_dict, mn->user->handle_info->handle, NULL))) {
for (i=0; i < userlist->used; i++) {
struct helpserv_user *hs_user = userlist->list[i];
struct helpserv_bot *hs = hs_user->hs;
dict_iterator_t it;
- if ((hs->helpserv == NULL) || (hs->helpchan != chan) || find_handle_in_channel(hs->helpchan, user->handle_info, user))
+ if ((hs->helpserv == NULL) || (hs->helpchan != mn->channel) || find_handle_in_channel(hs->helpchan, mn->user->handle_info, mn->user))
continue;
/* In case of the clock being set back for whatever reason,
if ((hs->persist_types[PERSIST_T_HELPER] == PERSIST_PART)
&& (req->helper == hs_user)) {
char reason[CHANNELLEN + 8];
- sprintf(reason, "parted %s", chan->name);
+ sprintf(reason, "parted %s", mn->channel->name);
helpserv_page_helper_gone(hs, req, reason);
}
}
unh = unh->next_unhandled;
if (num_trials) {
- helpserv_page(PGSRC_ALERT, "HSMSG_PAGE_FIRSTONLYTRIALALERT", hs->helpchan->name, user->nick, num_trials, num_unh);
+ helpserv_page(PGSRC_ALERT, "HSMSG_PAGE_FIRSTONLYTRIALALERT", hs->helpchan->name, mn->user->nick, num_trials, num_unh);
} else {
- helpserv_page(PGSRC_ALERT, "HSMSG_PAGE_FIRSTEMPTYALERT", hs->helpchan->name, user->nick, num_unh);
+ helpserv_page(PGSRC_ALERT, "HSMSG_PAGE_FIRSTEMPTYALERT", hs->helpchan->name, mn->user->nick, num_unh);
}
if (num_unh || !hs->req_on_join) {
timeq_del(0, run_empty_interval, hs, TIMEQ_IGNORE_WHEN);
}
static void
-snoop_part(struct userNode *user, struct chanNode *chan, const char *reason) {
+snoop_part(struct modeNode *mn, const char *reason) {
if (!snoop_cfg.enabled) return;
- if (user->dead) return;
+ if (mn->user->dead) return;
UPDATE_TIMESTAMP();
- SNOOP("$bPART$b %s by %s (%s)", chan->name, user->nick, reason ? reason : "");
+ SNOOP("$bPART$b %s by %s (%s)", mn->channel->name, mn->user->nick, reason ? reason : "");
}
static void
struct io_fd *socket_io_fd;
int force_n2k;
const char *hidden_host_suffix;
+int off_channel;
static char replay_line[MAXLEN+80];
static int ping_freq;
long last_mode=-1;
unsigned int n;
- if (!chan->members.used)
- return;
base_len = sprintf(burst_line, "%s " P10_BURST " %s " FMT_TIME_T " ",
self->numeric, chan->name, chan->timestamp);
len = irc_make_chanmode(chan, burst_line+base_len);
{
const char *numeric;
struct modeNode *mn = GetUserMode(channel, who);
- numeric = (mn && (mn->modes & MODE_CHANOP)) ? who->numeric : self->numeric;
+ numeric = ((!mn && off_channel) || (mn->modes & MODE_CHANOP)) ? who->numeric : self->numeric;
putsock("%s " P10_KICK " %s %s :%s",
numeric, channel->name, target->numeric, msg);
}
inttobase64(numer, (numnick << 12) + (usermask & 0x00fff), 3);
else
inttobase64(numer, (numnick << 18) + (usermask & 0x3ffff), 5);
+
str = conf_get_data("server/his_servername", RECDB_QSTRING);
his_servername = str ? strdup(str) : NULL;
str = conf_get_data("server/his_servercomment", RECDB_QSTRING);
his_servercomment = str ? strdup(str) : NULL;
+
str = conf_get_data("server/hostname", RECDB_QSTRING);
desc = conf_get_data("server/description", RECDB_QSTRING);
if (!str || !desc) {
chbuf.channel = channel;
chbuf.actor = who;
chbuf.chname_len = strlen(channel->name);
- if ((mn = GetUserMode(channel, who)) && (mn->modes & MODE_CHANOP))
+
+ mn = GetUserMode(channel, who);
+ if ((!mn && off_channel) || (mn->modes & MODE_CHANOP))
chbuf.is_chanop = 1;
/* First remove modes */
// (This is changed relative srvx-1.0.x, which would use default
// unless you specified ".disabled".)
"nick" "ChanServ";
+ // Should ChanServ join the channel? Please do not ask the srvx dev
+ // team for help configuring your ircd or a patch if you attempt to
+ // use this option on ircds that do not support having services off
+ // of the channel. Most people will leave this off; we cannot assist
+ // you in designing your network to make this option usefull to you.
+ "off_channel" "no";
// how long should a person be unseen before resending infoline?
"info_delay" "120";
// maximum greeting length