+2005-04-24 Michael Poole <mdpoole@troilus.org>
+
+ * doc/example.conf: Document new autoconnect field of Connect.
+
+ * include/s_conf.h: Add CONF_AUTOCONNECT and field for it.
+
+ * ircd/ircd.c (try_connections): Skip non-autoconnect servers.
+
+ * ircd/ircd_lexer.l: Recognize autoconnect token.
+
+ * ircd/ircd_parser.y: Add autoconnect= option to Connect block.
+
+ * ircd/m_invite.c (m_invite): Avoid sending channel timestamp to
+ user being invited.
+ (ms_invite): Likewise.
+
+ * ircd/s_user.c (register_user): Show class name rather than
+ pointer-as-integer.
+
2005-04-24 Michael Poole <mdpoole@troilus.org>
* ircd/ircd_parser.y: Rewrite so each error condition gets its own
# class = "classname";
# maxhops = 2;
# hub = "*.eu.undernet.org";
+# autoconnect = no;
# };
#
# The "port" field defines the default port the server tries to connect
# to if an operator uses /connect without specifying a port. This is also
# the port used when the server attempts to auto-connect to the remote
# server. (See Class blocks for more informationa about auto-connects).
+# You may tell ircu to not automatically connect to a server by adding
+# "autoconnect = no;"; the default is to autoconnect.
#
# The maxhops field causes an SQUIT if a hub tries to introduce
# servers farther away than that; the element 'leaf;' is an alias for
#define CONF_OPERATOR 0x0020 /**< ConfItem describes an Operator block */
#define CONF_UWORLD 0x8000 /**< ConfItem describes a Uworld server */
+#define CONF_AUTOCONNECT 0x0001 /**< Autoconnect to a server */
+
/** Indicates ConfItem types that count associated clients. */
#define CONF_CLIENT_MASK (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER)
time_t hold; /**< Earliest time to attempt an outbound
connect on this ConfItem. */
int dns_pending; /**< A dns request is pending. */
+ int flags; /**< Additional modifiers for item. */
int addrbits; /**< Number of bits valid in ConfItem::address. */
struct Privs privs; /**< Privileges for opers. */
/** Used to detect if a privilege has been set by this ConfItem. */
*/
if (!(aconf->status & CONF_SERVER)
|| aconf->address.port == 0
+ || !(aconf->flags & CONF_AUTOCONNECT)
|| ((ajupe = jupe_find(aconf->name)) && JupeIsActive(ajupe)))
continue;
TOKEN(PREPEND),
TOKEN(USERMODE),
TOKEN(FAST),
+ TOKEN(AUTOCONNECT),
#undef TOKEN
{ "administrator", ADMIN },
{ "apass_opmode", TPRIV_APASS_OPMODE },
+ { "auto", AUTOCONNECT },
{ "b", BYTES },
{ "badchan", TPRIV_BADCHAN },
{ "chan_limit", TPRIV_CHAN_LIMIT },
int yylex(void);
/* Now all the globals we need :/... */
- int tping, tconn, maxlinks, sendq, port, invert, stringno;
+ int tping, tconn, maxlinks, sendq, port, invert, stringno, flags;
char *name, *pass, *host, *ip, *username, *origin, *hub_limit;
char *stringlist[MAX_STRINGS];
struct ConnectionClass *c_class;
%token IAUTH
%token TIMEOUT
%token FAST
+%token AUTOCONNECT
/* and now a lot of privileges... */
%token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
%token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
connectblock: CONNECT
{
maxlinks = 65535;
+ flags = CONF_AUTOCONNECT;
} '{' connectitems '}'
{
struct ConfItem *aconf = NULL;
aconf->host = host;
aconf->maximum = maxlinks;
aconf->hub_limit = hub_limit;
+ aconf->flags = flags;
lookup_confhost(aconf);
}
if (!aconf) {
}
name = pass = host = origin = hub_limit = NULL;
c_class = NULL;
- port = 0;
+ port = flags = 0;
}';';
connectitems: connectitem connectitems | connectitem;
connectitem: connectname | connectpass | connectclass | connecthost
| connectport | connectvhost | connectleaf | connecthub
- | connecthublimit | connectmaxhops | error;
+ | connecthublimit | connectmaxhops | connectauto | error;
connectname: NAME '=' QSTRING ';'
{
MyFree(name);
{
maxlinks = $3;
};
+connectauto: AUTOCONNECT '=' YES ';' { flags |= CONF_AUTOCONNECT; }
+ | AUTOCONNECT '=' NO ';' { flags &= ~CONF_AUTOCONNECT; };
uworldblock: UWORLD '{' uworlditems '}' ';';
uworlditems: uworlditem uworlditems | uworlditem;
if (cli_user(acptr)->away)
send_reply(sptr, RPL_AWAY, cli_name(acptr), cli_user(acptr)->away);
- if (MyConnect(acptr))
+ if (MyConnect(acptr)) {
add_invite(acptr, chptr);
+ sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr);
+ }
if (!IsLocalChannel(chptr->chname) || MyConnect(acptr)) {
if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
/* Announce to channel operators. */
sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str,
- NULL, chptr, sptr, SKIP_NONOPS,
+ NULL, chptr, sptr, SKIP_NONOPS,
"%H %C %C :%C has been invited by %C",
chptr, acptr, sptr, acptr, sptr);
- /* Announce to servers with channel operators, but skip acptr,
- * since they will be notified below. */
- sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS,
+ /* Announce to servers with channel operators. */
+ sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, SKIP_NONOPS,
"%s %H %Tu", cli_name(acptr),
chptr, chptr->creationtime);
}
- sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr),
- chptr, chptr->creationtime);
}
return 0;
if (is_silenced(sptr, acptr))
return 0;
- if (MyConnect(acptr))
+ if (MyConnect(acptr)) {
add_invite(acptr, chptr);
+ sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr);
+ }
if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
/* Announce to channel operators. */
NULL, chptr, sptr, SKIP_NONOPS,
"%H %C %C :%C has been invited by %C",
chptr, acptr, sptr, acptr, sptr);
- /* Announce to servers with channel operators, but skip acptr,
- * since they will be notified below. */
- sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS,
+ /* Announce to servers with channel operators. */
+ sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, SKIP_NONOPS,
"%s %H %Tu", cli_name(acptr), chptr,
chptr->creationtime);
}
- sendcmdto_one(sptr, CMD_INVITE, acptr,
- "%s %H %Tu",
- cli_name(acptr), chptr, chptr->creationtime);
return 0;
}
{
last_too_many1 = CurrentTime;
sendto_opmask_butone(0, SNO_TOOMANY, "Too many connections in "
- "class %i for %s.", get_client_class(sptr),
+ "class %s for %s.", get_client_class(sptr),
get_client_name(sptr, SHOW_IP));
}
++ServerStats->is_ref;