Revision: 1883
http://undernet-ircu.svn.sourceforge.net/undernet-ircu/?rev=1883&view=rev
Author: klmitch
Date: 2008-10-03 01:16:53 +0000 (Fri, 03 Oct 2008)
Log Message:
-----------
Author: Kev <[EMAIL PROTECTED]>
Description:
1) Begin defining a temporary compatibility mechanism for use during the
testing period for the new mode infrastructure.
2) Mode deltas are not necessarily built against a specific client, so
pull the relevant fields out.
3) Declare a flag for extended modes: Modes that should always be sent
in a new extended format. All modes will be accepted in this
format, so this flag is for marking modes that MUST be sent in this
format.
The extended format, as I'm conceiving it, is {name<arg>}. For
instance, you could set a key to "mykey" with /mode +{k<mykey>} or
/mode +{key<mykey>}, in addition to the classic syntax. The purpose of
this extended format is to support the addition of future modes and
enable full support on all servers for those modes, even if intermediate
hubs have no clue what the mode is--they can be magically added on the
fly. (Needless to say, at least initially, these extended modes would
only be sent to other servers, though I could see adding it as a
capability setting...one of these days, I should finish the capability
draft!)
Modified Paths:
--------------
ircu2/branches/mode/ChangeLog
ircu2/branches/mode/include/mode.h
Added Paths:
-----------
ircu2/branches/mode/include/mode-compat.h
ircu2/branches/mode/ircd/mode-compat.c
Modified: ircu2/branches/mode/ChangeLog
===================================================================
--- ircu2/branches/mode/ChangeLog 2008-09-27 04:01:12 UTC (rev 1882)
+++ ircu2/branches/mode/ChangeLog 2008-10-03 01:16:53 UTC (rev 1883)
@@ -1,3 +1,18 @@
+2008-10-02 Kevin L. Mitchell <[EMAIL PROTECTED]>
+
+ * include/mode.h: mode deltas are not necessarily applied against
+ a specific client, so pull that code out; remove pre-declaration
+ of struct Channel that's no longer needed; define magic number and
+ initialization for modedesc_t; add MDFLAG_ARGEXTENDED flag to mark
+ extended argument flags; add MDPOL_AUTHZ_NONE for modes that will
+ be set only by the software; define initializer for modelist_t
+
+ * include/mode-compat.h: begin roughing out an interrim
+ compatibility mechanism while I'm building the mode system
+
+ * ircd/mode-compat.c: begin roughing out an interrim compatibility
+ mechanism while I'm building the mode system
+
2008-09-26 Kevin L. Mitchell <[EMAIL PROTECTED]>
* include/mode.h: add a flag to mark one-shot modes like +k; add
Added: ircu2/branches/mode/include/mode-compat.h
===================================================================
--- ircu2/branches/mode/include/mode-compat.h (rev 0)
+++ ircu2/branches/mode/include/mode-compat.h 2008-10-03 01:16:53 UTC (rev
1883)
@@ -0,0 +1,153 @@
+/*
+ * IRC - Internet Relay Chat, include/mode-compat.h
+ * Copyright (C) 2008 Kevin L. Mitchell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+/** @file
+ * @brief Temporary structures and functions for handling mode compatibility.
+ * @version $Id$
+ */
+#ifndef INCLUDED_mode_compat_h
+#define INCLUDED_mode_compat_h
+#ifndef INCLUDED_mode_h
+#include "mode.h"
+#endif
+
+/** Known channel modes. Note that this must be the same order as
+ * _cmodes[]!
+ */
+enum ChanModes {
+ _CMODE_CHANOP, /**< Channel operator (+o) */
+ _CMODE_VOICE, /**< Has voice (+v) */
+ _CMODE_PRIVATE, /**< Channel is private (+p) */
+ _CMODE_SECRET, /**< Channel is secret (+s) */
+ _CMODE_MODERATED, /**< Channel is moderated (+m) */
+ _CMODE_TOPICLIMIT, /**< Topic control limited (+t) */
+ _CMODE_INVITEONLY, /**< Invite-only channel (+i) */
+ _CMODE_NOPRIVMSGS, /**< No external private messages (+n) */
+ _CMODE_KEY, /**< Channel key (+k) */
+ _CMODE_BAN, /**< Channel ban (+b) */
+ _CMODE_LIMIT, /**< Channel limit (+l) */
+ _CMODE_REGONLY, /**< Only +r users may join (+r) */
+ _CMODE_DELJOINS, /**< Join messages delayed (+D) */
+ _CMODE_REGISTERED, /**< Channel is registered (+R) */
+ _CMODE_UPASS, /**< Channel user pass (+U) */
+ _CMODE_APASS, /**< Channel admin pass (+A) */
+ _CMODE_WASDELJOINS /**< Channel has delayed joins (+d) */
+};
+
+/** Channel operator (+o). */
+#define CMODE_CHANOP (&_cmodes[_CMODE_CHANOP])
+/** Has voice (+v). */
+#define CMODE_VOICE (&_cmodes[_CMODE_VOICE])
+/** Channel is private (+p). */
+#define CMODE_PRIVATE (&_cmodes[_CMODE_PRIVATE])
+/** Channel is secret (+s). */
+#define CMODE_SECRET (&_cmodes[_CMODE_SECRET])
+/** Channel is moderated (+m). */
+#define CMODE_MODERATED (&_cmodes[_CMODE_MODERATED])
+/** Topic control limited (+t). */
+#define CMODE_TOPICLIMIT (&_cmodes[_CMODE_TOPICLIMIT])
+/** Invite-only channel (+i). */
+#define CMODE_INVITEONLY (&_cmodes[_CMODE_INVITEONLY])
+/** No external private messages (+n). */
+#define CMODE_NOPRIVMSGS (&_cmodes[_CMODE_NOPRIVMSGS])
+/** Channel key (+k). */
+#define CMODE_KEY (&_cmodes[_CMODE_KEY])
+/** Channel ban (+b). */
+#define CMODE_BAN (&_cmodes[_CMODE_BAN])
+/** Channel limit (+l). */
+#define CMODE_LIMIT (&_cmodes[_CMODE_LIMIT])
+/** Only +r users may join (+r). */
+#define CMODE_REGONLY (&_cmodes[_CMODE_REGONLY])
+/** Join messages delayed (+D). */
+#define CMODE_DELJOINS (&_cmodes[_CMODE_DELJOINS])
+/** Channel is registered (+R). */
+#define CMODE_REGISTERED (&_cmodes[_CMODE_REGISTERED])
+/** Channel user pass (+U). */
+#define CMODE_UPASS (&_cmodes[_CMODE_UPASS])
+/** Channel admin pass (+A). */
+#define CMODE_APASS (&_cmodes[_CMODE_APASS])
+/** Channel has delayed joins (+d). */
+#define CMODE_WASDELJOINS (&_cmodes[_CMODE_WASDELJOINS])
+
+/** Known user modes. Note that this must be the same order as
+ * _umodes[]!
+ */
+enum UserModes {
+ _UMODE_LOCOP, /**< Local IRC operator (+O) */
+ _UMODE_OPER, /**< Global IRC operator (+o) */
+ _UMODE_SERVNOTICE, /**< Receive server notices (+s) */
+ _UMODE_INVISIBLE, /**< User invisible (+i) */
+ _UMODE_WALLOP, /**< User receives /WALLOPS (+w) */
+ _UMODE_DEAF, /**< User is deaf (+d) */
+ _UMODE_CHSERV, /**< User is a channel service (+k) */
+ _UMODE_DEBUG, /**< User receives debug messages (+g) */
+ _UMODE_ACCOUNT, /**< User is logged in (+r) */
+ _UMODE_HIDDENHOST /**< User's host is hidden (+x) */
+};
+
+/** Local IRC operator (+O). */
+#define UMODE_LOCOP (&_umodes[_UMODE_LOCOP])
+/** Global IRC operator (+o). */
+#define UMODE_OPER (&_umodes[_UMODE_OPER])
+/** Receive server notices (+s). */
+#define UMODE_SERVNOTICE (&_umodes[_UMODE_SERVNOTICE])
+/** User invisible (+i). */
+#define UMODE_INVISIBLE (&_umodes[_UMODE_INVISIBLE])
+/** User receives /WALLOPS (+w). */
+#define UMODE_WALLOP (&_umodes[_UMODE_WALLOP])
+/** User is deaf (+d). */
+#define UMODE_DEAF (&_umodes[_UMODE_DEAF])
+/** User is a channel service (+k). */
+#define UMODE_CHSERV (&_umodes[_UMODE_CHSERV])
+/** User receives debug messages (+g). */
+#define UMODE_DEBUG (&_umodes[_UMODE_DEBUG])
+/** User is logged in (+r). */
+#define UMODE_ACCOUNT (&_umodes[_UMODE_ACCOUNT])
+/** User's host is hidden (+x). */
+#define UMODE_HIDDENHOST (&_umodes[_UMODE_HIDDENHOST])
+
+/** Known server modes. Note that this must be the same order as
+ * _smodes[]!
+ */
+enum ServModes {
+ _SMODE_HUB, /**< Server is a hub (+h) */
+ _SMODE_SERVICE, /**< Server is a service (+s) */
+ _SMODE_IPV6 /**< Server supports IPv6 (+6) */
+};
+
+/** Server is a hub (+h). */
+#define SMODE_HUB (&_umodes[_SMODE_HUB])
+/** Server is a service (+s). */
+#define SMODE_SERVICE (&_umodes[_SMODE_SERVICE])
+/** Server supports IPv6 (+6). */
+#define SMODE_IPV6 (&_umodes[_SMODE_IPV6])
+
+/* Arrays of mode descriptors. */
+extern modedesc_t _cmodes[];
+extern modedesc_t _umodes[];
+extern modedesc_t _smodes[];
+
+/* Mode list descriptors. */
+extern modelist_t chanmodes;
+extern modelist_t usermodes;
+extern modelist_t servmodes;
+
+/* Initialize mode compatibility layer. */
+extern void mode_compat_init(void);
+
+#endif /* INCLUDED_mode_compat_h */
Property changes on: ircu2/branches/mode/include/mode-compat.h
___________________________________________________________________
Added: svn:keywords
+ Id
Modified: ircu2/branches/mode/include/mode.h
===================================================================
--- ircu2/branches/mode/include/mode.h 2008-09-27 04:01:12 UTC (rev 1882)
+++ ircu2/branches/mode/include/mode.h 2008-10-03 01:16:53 UTC (rev 1883)
@@ -33,7 +33,6 @@
#endif
struct Client;
-struct Channel;
/** Specifies the maximum number of modes permitted on any entity. */
#define MAX_MODES 64
@@ -64,6 +63,21 @@
flagpage_t md_flags; /**< Flags affecting mode. */
};
+/** Magic number for a mode descriptor. */
+#define MODE_DESC_MAGIC 0x54aacaed
+
+/** Initialize a modedesc_t.
+ * @param[in] name Descriptive name for the mode.
+ * @param[in] sw "Switch" character for the mode.
+ * @param[in] desc Description of the mode.
+ * @param[in] flags Flags affecting the mode.
+ * @param[in] pfx Prefix character used in /NAMES reply.
+ * @param[in] prio Priority for ordering prefix characters; unused otherwise.
+ */
+#define MODE_DESC_INIT(name, sw, desc, flags, pfx, prio) \
+ { REGENT_INIT(MODE_DESC_MAGIC, (name)), (sw), (pfx), 0, (desc), \
+ (flags) | (((prio) & 0x0f) << 16) }
+
/** Mode maintains a list. */
#define MDFLAG_LIST 0x80000000
/** Mode should not be propagated to other servers. */
@@ -72,6 +86,8 @@
#define MDFLAG_HEXINT 0x20000000
/** Mode can only be set or reset once per message. */
#define MDFLAG_ONESHOT 0x10000000
+/** Mode defaults to extended syntax. */
+#define MDFLAG_ARGEXTENDED 0x08000000
/** Mask for prefix ordering priority. */
#define MDFLAG_PRIO 0x000f0000
@@ -99,6 +115,8 @@
#define MDPOL_AUTHZ_GOP 0x00000300
/** Only servers can set or clear mode. */
#define MDPOL_AUTHZ_SERV 0x00000400
+/** No one can set or clear mode (mode under software control). */
+#define MDPOL_AUTHZ_NONE 0x00000500
/** Mode authorization mask. */
#define MDPOL_AUTHZ_MASK 0x00000f00
@@ -136,6 +154,14 @@
/**< Mode value map. */
};
+/** Initialize a modelist_t.
+ * @param[in] name Descriptive name for the mode list.
+ * @param[in] offset Offset of modeset_t entry in entity structure.
+ */
+#define MODE_LIST_INIT(name, offset) \
+ { REGTAB_INIT((name), MODE_DESC_MAGIC, 0, 0), (offset), \
+ KEYSPACE_INIT(MAX_MODES, 0, 0, 0) }
+
/** Describes the set of modes set on a specific channel, user, etc. */
DECLARE_FLAGSET(ModeSet, MAX_MODES);
@@ -155,7 +181,7 @@
mode_args_t* ma_prev; /**< Chain to previous set of modes
with arguments. */
struct {
- mode_desc_t* mam_mode; /**< The mode. */
+ mode_desc_t* mam_mode; /**< The mode. */
mode_dir_t mam_dir; /**< Direction of mode. */
union {
unsigned int mama_int; /**< Unsigned integer argument. */
@@ -170,12 +196,6 @@
/** Describes the difference between two mode_set_t's. */
struct ModeDelta {
struct Client* md_origin; /**< Origin of delta. */
- int md_etype; /**< Type of entity--1 for channel,
- 0 for client. */
- union {
- struct Client* mde_client; /**< Client mode delta applies to. */
- struct Channel* mde_chan; /**< Channel mode delta applies to. */
- } md_entity; /**< Entity mode delta applies to. */
mode_list_t* md_modes; /**< Mode list used by this delta. */
mode_set_t md_add; /**< Simple modes to be added. */
Added: ircu2/branches/mode/ircd/mode-compat.c
===================================================================
--- ircu2/branches/mode/ircd/mode-compat.c (rev 0)
+++ ircu2/branches/mode/ircd/mode-compat.c 2008-10-03 01:16:53 UTC (rev
1883)
@@ -0,0 +1,128 @@
+/*
+ * IRC - Internet Relay Chat, include/mode-compat.c
+ * Copyright (C) 2008 Kevin L. Mitchell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+/** @file
+ * @brief Temporary structures and functions for handling mode compatibility.
+ * @version $Id$
+ */
+#include "config.h"
+
+#include "mode-compat.h"
+#include "mode.h"
+
+/** Initial list of channel modes. Note that this must be the same
+ * order as enum ChanModes!
+ */
+modedesc_t _cmodes[] = {
+ MODE_DESC_INIT("CHANOP", 'o', "Channel operator.",
+ MDPAR_ARG_CLI | MDPAR_TYPE_REQARG | MDPOL_AUTHZ_CHOP,
+ '@', 15),
+ MODE_DESC_INIT("VOICE", 'v', "Has voice.",
+ MDPAR_ARG_CLI | MDPAR_TYPE_REQARG | MDPOL_AUTHZ_CHOP,
+ '+', 0),
+ MODE_DESC_INIT("PRIVATE", 'p', "Channel is private.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("SECRET", 's', "Channel is secret.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("MODERATED", 'm', "Channel is moderated.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("TOPICLIMIT", 't', "Topic control limited.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("INVITEONLY", 'i', "Invite-only channel.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("NOPRIVMSGS", 'n', "No external private messages.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("KEY", 'k', "Channel key.",
+ MDPAR_ARG_STR | MDPAR_TYPE_REQARG | MDPOL_AUTHZ_CHOP |
+ MDFLAG_VIS_CHOP | MDFLAG_ONESHOT, 0, 0),
+ MODE_DESC_INIT("BAN", 'b', "Channel ban.",
+ MDPAR_ARG_STR | MDPAR_TYPE_REQARG | MDPOL_AUTHZ_CHOP |
+ MDFLAG_LIST, 0, 0),
+ MODE_DESC_INIT("LIMIT", 'l', "Channel limit.",
+ MDPAR_ARG_INT | MDPAR_TYPE_ADDARG | MDPOL_AUTHZ_CHOP |
+ MDFLAG_ONESHOT, 0, 0),
+ MODE_DESC_INIT("REGONLY", 'r', "Only +r users may join.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("DELJOINS", 'D', "Join messages delayed.",
+ MDPOL_AUTHZ_CHOP, 0, 0),
+ MODE_DESC_INIT("REGISTERED", 'R', "Channel is registered.",
+ MDPOL_AUTHZ_SERV, 0, 0),
+ MODE_DESC_INIT("UPASS", 'U', "Channel user pass.",
+ MDPAR_ARG_STR | MDPAR_TYPE_REQARG | MDPOL_AUTHZ_CHOP |
+ MDFLAG_VIS_CHOP | MDFLAG_ONESHOT, 0, 0),
+ MODE_DESC_INIT("APASS", 'A', "Channel admin pass.",
+ MDPAR_ARG_STR | MDPAR_TYPE_REQARG | MDPOL_AUTHZ_CHOP |
+ MDFLAG_VIS_CHOP | MDFLAG_ONESHOT, 0, 0),
+ MODE_DESC_INIT("WASDELJOINS", 'd', "Channel has delayed joins.",
+ MDFLAG_AUTHZ_NONE, 0, 0)
+};
+
+/** Initial list of user modes. Note that this must be the same order
+ * as enum UserModes!
+ */
+modedesc_t _umodes[] = {
+ MODE_DESC_INIT("LOCOP", 'O', "Local IRC operator.",
+ MDPOL_AUTHZ_OPER, 0, 0),
+ MODE_DESC_INIT("OPER", 'o', "Global IRC operator.",
+ MDPOL_AUTHZ_GOP, 0, 0),
+ MODE_DESC_INIT("SERVNOTICE", 's', "Receive server notices.",
+ MDPAR_ARG_INT | MDPAR_TYPE_OPTARG | MDFLAG_HEXINT |
+ MDFLAG_LOCAL, 0, 0),
+ MODE_DESC_INIT("INVISIBLE", 'i', "User invisible.",
+ 0, 0, 0),
+ MODE_DESC_INIT("WALLOP", 'w', "User receives /WALLOPS.",
+ 0, 0, 0),
+ MODE_DESC_INIT("DEAF", 'd', "User is deaf.",
+ 0, 0, 0),
+ MODE_DESC_INIT("CHSERV", 'k', "User is a channel service.",
+ MDPOL_AUTHZ_SERV, 0, 0),
+ MODE_DESC_INIT("DEBUG", 'g', "User receives debug messages.",
+ 0, 0, 0),
+ MODE_DESC_INIT("ACCOUNT", 'r', "User is logged in.",
+ MDPAR_ARG_STR | MDPAR_TYPE_REQARG | MDPOL_AUTHZ_SERV |
+ MDFLAG_VIS_SERV, 0, 0),
+ MODE_DESC_INIT("HIDDENHOST", 'x', "User's host is hidden.",
+ 0, 0, 0)
+};
+
+/** Initial list of server modes. Note that this must be the same
+ * order as enum ServModes!
+ */
+modedesc_t _smodes[] = {
+ MODE_DESC_INIT("HUB", 'h', "Server is a hub.",
+ MDPOL_AUTHZ_SERV, 0, 0),
+ MODE_DESC_INIT("SERVICE", 's', "Server is a service.",
+ MDPOL_AUTHZ_SERV, 0, 0),
+ MODE_DESC_INIT("IPV6", '6', "Server supports IPv6.",
+ MDPOL_AUTHZ_SERV, 0, 0)
+};
+
+/** Mode list for channels. */
+modelist_t chanmodes = MODE_LIST_INIT("channel", 0);
+
+/** Mode list for users. */
+modelist_t usermodes = MODE_LIST_INIT("user", 0);
+
+/** Mode list for servers. */
+modelist_t servmodes = MODE_LIST_INIT("server", 0);
+
+/** Initialize the mode compatibility layer. */
+void
+mode_compat_init(void)
+{
+}
Property changes on: ircu2/branches/mode/ircd/mode-compat.c
___________________________________________________________________
Added: svn:keywords
+ Id
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches