[IRC-Dev CVS] [CVS] Module ircd-ircdev: Change committed
Brought to you by:
zolty
From: Toni G. <zo...@us...> - 2005-06-22 09:59:10
|
CVSROOT : /cvsroot/irc-dev Module : ircd-ircdev Commit time: 2005-06-22 09:59:03 UTC Modified files: ChangeLog ChangeLog.es include/channel.h include/ddb.h include/patchlevel.h ircd/ddb.c ircd/ddb_events.c ircd/hash.c ircd/m_list.c ircd/s_user.c Log message: Author: zoltan <zo...@ir...> Log message: 2005-06-22 Toni García <zo...@ir...> 1.0.alpha40 * Tabla v de Vhosts * /LIST con comodines ---------------------- diff included ---------------------- Index: ircd-ircdev/ChangeLog diff -u ircd-ircdev/ChangeLog:1.41 ircd-ircdev/ChangeLog:1.42 --- ircd-ircdev/ChangeLog:1.41 Wed Jun 22 00:54:28 2005 +++ ircd-ircdev/ChangeLog Wed Jun 22 02:58:52 2005 @@ -1,10 +1,14 @@ # # ChangeLog for ircd-ircdev # -# $Id: ChangeLog,v 1.41 2005/06/22 07:54:28 zolty Exp $ +# $Id: ChangeLog,v 1.42 2005/06/22 09:58:52 zolty Exp $ # # Insert new changes at beginning of the change list. # +2005-06-22 Toni García <zo...@ir...> 1.0.alpha40 + * Vhosts table v + * /LIST with wildcards + 2005-06-22 Toni García <zo...@ir...> 1.0.alpha39 * Cleanups * Estetic bugfixes Index: ircd-ircdev/ChangeLog.es diff -u ircd-ircdev/ChangeLog.es:1.41 ircd-ircdev/ChangeLog.es:1.42 --- ircd-ircdev/ChangeLog.es:1.41 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/ChangeLog.es Wed Jun 22 02:58:52 2005 @@ -1,10 +1,14 @@ # # Log de Cambios para ircd-ircdev # -# $Id: ChangeLog.es,v 1.41 2005/06/22 07:54:29 zolty Exp $ +# $Id: ChangeLog.es,v 1.42 2005/06/22 09:58:52 zolty Exp $ # # Insertar los nuevos cambios al principio de esta lista de cambios. # +2005-06-22 Toni García <zo...@ir...> 1.0.alpha40 + * Tabla v de Vhosts + * /LIST con comodines + 2005-06-22 Toni García <zo...@ir...> 1.0.alpha39 * Limpieza * Fixs de bugs estéticos Index: ircd-ircdev/include/channel.h diff -u ircd-ircdev/include/channel.h:1.11 ircd-ircdev/include/channel.h:1.12 --- ircd-ircdev/include/channel.h:1.11 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/include/channel.h Wed Jun 22 02:58:52 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief Channel management and maintenance. - * @version $Id: channel.h,v 1.11 2005/06/22 07:54:29 zolty Exp $ + * @version $Id: channel.h,v 1.12 2005/06/22 09:58:52 zolty Exp $ */ #ifndef INCLUDED_channel_h #define INCLUDED_channel_h @@ -192,6 +192,7 @@ #define LISTARG_TOPICLIMITS 0x0001 #define LISTARG_SHOWSECRET 0x0002 +#define LISTARG_NEGATEWILDCARD 0x0004 /** * Maximum acceptable lag time in seconds: A channel younger than @@ -361,6 +362,7 @@ time_t max_topic_time; time_t min_topic_time; unsigned int bucket; + char wildcard[CHANNELLEN]; }; struct ModeBuf { Index: ircd-ircdev/include/ddb.h diff -u ircd-ircdev/include/ddb.h:1.10 ircd-ircdev/include/ddb.h:1.11 --- ircd-ircdev/include/ddb.h:1.10 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/include/ddb.h Wed Jun 22 02:58:52 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Distributed DataBases structures, macros and functions. - * @version $Id: ddb.h,v 1.10 2005/06/22 07:54:29 zolty Exp $ + * @version $Id: ddb.h,v 1.11 2005/06/22 09:58:52 zolty Exp $ */ #ifndef INCLUDED_ddb_h #define INCLUDED_ddb_h @@ -55,6 +55,8 @@ #define DDB_ILINEDB 'i' /** Nicks table of %DDB Distributed Databases. */ #define DDB_NICKDB 'n' +/** Vhost table of %DDB Distributed Databases. */ +#define DDB_VHOSTDB 'v' /** Config table of %DDB Distributed Databases. */ #define DDB_CONFIGDB 'z' /** Last table of %DDB Distributed Databases. */ Index: ircd-ircdev/include/patchlevel.h diff -u ircd-ircdev/include/patchlevel.h:1.40 ircd-ircdev/include/patchlevel.h:1.41 --- ircd-ircdev/include/patchlevel.h:1.40 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/include/patchlevel.h Wed Jun 22 02:58:52 2005 @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: patchlevel.h,v 1.40 2005/06/22 07:54:29 zolty Exp $ + * $Id: patchlevel.h,v 1.41 2005/06/22 09:58:52 zolty Exp $ * */ -#define PATCHLEVEL ".alpha39" +#define PATCHLEVEL ".alpha40" #define RELEASE "1.0" Index: ircd-ircdev/ircd/ddb.c diff -u ircd-ircdev/ircd/ddb.c:1.11 ircd-ircdev/ircd/ddb.c:1.12 --- ircd-ircdev/ircd/ddb.c:1.11 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/ircd/ddb.c Wed Jun 22 02:58:52 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief Implementation of Distributed DataBase. - * @version $Id: ddb.c,v 1.11 2005/06/22 07:54:29 zolty Exp $ + * @version $Id: ddb.c,v 1.12 2005/06/22 09:58:52 zolty Exp $ */ #include "config.h" @@ -151,7 +151,7 @@ unsigned int buffer[129 * sizeof(unsigned int)]; unsigned int *p = buffer; unsigned int x[2], v[2], k[2]; - char *p2; +/* char *p2; */ char buf[1024]; /* ID Mask Key Content */ @@ -208,6 +208,7 @@ ddb_resident_table[DDB_CHANDB2] = 32768; ddb_resident_table[DDB_ILINEDB] = 256; ddb_resident_table[DDB_NICKDB] = 32768; + ddb_resident_table[DDB_VHOSTDB] = 256; ddb_resident_table[DDB_CONFIGDB] = 256; for (table = DDB_INIT; table <= DDB_END; table++) Index: ircd-ircdev/ircd/ddb_events.c diff -u ircd-ircdev/ircd/ddb_events.c:1.7 ircd-ircdev/ircd/ddb_events.c:1.8 --- ircd-ircdev/ircd/ddb_events.c:1.7 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/ircd/ddb_events.c Wed Jun 22 02:58:52 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Events of Distributed DataBases. - * @version $Id: ddb_events.c,v 1.7 2005/06/22 07:54:29 zolty Exp $ + * @version $Id: ddb_events.c,v 1.8 2005/06/22 09:58:52 zolty Exp $ */ #include "config.h" @@ -48,6 +48,7 @@ static void ddb_events_table_c(char *key, char *content, int update); static void ddb_events_table_d(char *key, char *content, int update); static void ddb_events_table_n(char *key, char *content, int update); +static void ddb_events_table_v(char *key, char *content, int update); static void ddb_events_table_z(char *key, char *content, int update); @@ -63,6 +64,7 @@ ddb_events_table[DDB_CHANDB2] = ddb_events_table_d; ddb_events_table[DDB_ILINEDB] = 0; ddb_events_table[DDB_NICKDB] = ddb_events_table_n; + ddb_events_table[DDB_VHOSTDB] = ddb_events_table_v; ddb_events_table[DDB_CONFIGDB] = ddb_events_table_z; events_init = 1; @@ -342,6 +344,42 @@ } } +/** Handle events on Vhosts Table. + * @param[in] key Key of registry. + * @param[in] content Content of registry. + * @param[in] update Update of registry or no. + */ +static void +ddb_events_table_v(char *key, char *content, int update) +{ + struct Client *cptr; + + if (((cptr = FindUser(key))) && IsNickRegistered(cptr)) + { + /* Droping Key */ + if (!content) + { + /* + if (IsHiddenHost(cptr)) + { + ircd_snprintf(0, cli_user(cptr)->host, HOSTLEN, "SINIP"); + hide_hostmask(cptr, FLAG_HIDDENHOST); + + } + */ + } + else if (content) + { + if (IsHiddenHost(cptr)) + { + ircd_snprintf(0, cli_user(cptr)->host, HOSTLEN, content); + hide_hostmask(cptr, FLAG_NICKREG); + + } + } + } + +} /** Handle events on Config Table. * @param[in] key Key of registry. * @param[in] content Content of registry. Index: ircd-ircdev/ircd/hash.c diff -u ircd-ircdev/ircd/hash.c:1.10 ircd-ircdev/ircd/hash.c:1.11 --- ircd-ircdev/ircd/hash.c:1.10 Wed May 25 09:56:24 2005 +++ ircd-ircdev/ircd/hash.c Wed Jun 22 02:58:52 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief Hash table management. - * @version $Id: hash.c,v 1.10 2005/05/25 16:56:24 zolty Exp $ + * @version $Id: hash.c,v 1.11 2005/06/22 09:58:52 zolty Exp $ * * This file used to use some very complicated hash function. Now it * uses CRC-32, but effectively remaps each input byte according to a @@ -512,6 +512,10 @@ && chptr->users < args->max_users && chptr->creationtime > args->min_time && chptr->creationtime < args->max_time + && (!args->wildcard[0] || (args->flags & LISTARG_NEGATEWILDCARD) || + (!match(args->wildcard, chptr->chname))) + && (!(args->flags & LISTARG_NEGATEWILDCARD) || + match(args->wildcard, chptr->chname)) && (!(args->flags & LISTARG_TOPICLIMITS) || (chptr->topic[0] && chptr->topic_time > args->min_topic_time Index: ircd-ircdev/ircd/m_list.c diff -u ircd-ircdev/ircd/m_list.c:1.7 ircd-ircdev/ircd/m_list.c:1.8 --- ircd-ircdev/ircd/m_list.c:1.7 Mon Mar 21 10:39:08 2005 +++ ircd-ircdev/ircd/m_list.c Wed Jun 22 02:58:52 2005 @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * - * $Id: m_list.c,v 1.7 2005/03/21 18:39:08 zolty Exp $ + * $Id: m_list.c,v 1.8 2005/06/22 09:58:52 zolty Exp $ * */ @@ -108,10 +108,11 @@ 0, /* min_time */ 4294967295U, /* max_users */ 0, /* min_users */ - 0, /* topic_limits */ + 0, /* flags */ 2147483647, /* max_topic_time */ 0, /* min_topic_time */ - 0 /* chptr */ + 0, /* bucket */ + {0} /* wildcard */ }; static struct ListingArgs la_default = { @@ -119,10 +120,11 @@ 0, /* min_time */ 4294967295U, /* max_users */ 0, /* min_users */ - 0, /* topic_limits */ + 0, /* flags */ 2147483647, /* max_topic_time */ 0, /* min_topic_time */ - 0 /* chptr */ + 0, /* bucket */ + {0} /* wildcard */ }; static int @@ -151,17 +153,25 @@ " \002C>\002\037min_minutes\037 ; Channels that exist more " "than \037min_minutes\037."); send_reply(sptr, RPL_LISTUSAGE, - " \002T<\002\037max_minutes\037 ; Channels with a topic last " - "set less than \037max_minutes\037 ago."); + " \002T<\002\037max_minutes\037 ; Channels with a topic last " + "set less than \037max_minutes\037 ago."); send_reply(sptr, RPL_LISTUSAGE, - " \002T>\002\037min_minutes\037 ; Channels with a topic last " - "set more than \037min_minutes\037 ago."); + " \002T>\002\037min_minutes\037 ; Channels with a topic last " + "set more than \037min_minutes\037 ago."); + send_reply(sptr, RPL_LISTUSAGE, + " \037pattern\037 ; Channels with names matching " + "\037pattern\037. "); + send_reply(sptr, RPL_LISTUSAGE, + " !\037pattern\037 ; Channels with names not " + "matching \037pattern\037. "); + send_reply(sptr, RPL_LISTUSAGE, "Note: Patterns may contain * and ?. " + "You may only give one pattern match constraint."); if (IsAnOper(sptr)) send_reply(sptr, RPL_LISTUSAGE, " \002S\002 ; Show secret channels."); send_reply(sptr, RPL_LISTUSAGE, - "Example: LIST <3,>1,C<10,T>0 ; 2 users, younger than 10 " - "min., topic set."); + "Example: LIST <3,>1,C<10,T>0,#a* ; 2 users, younger than 10 " + "min., topic set., starts with #a"); return LPARAM_ERROR; /* return error condition */ } @@ -173,6 +183,7 @@ int is_time = 0; char dir; unsigned int val; + char *tmp1, *tmp2; assert(0 != args); @@ -246,7 +257,47 @@ return show_usage(sptr); break; - default: /* channel name? */ + default: + /* It might be a wildcard... */ + if (strchr(param, '*') || + strchr(param, '?')) + { + if (param[0] == '!') + { + param++; + args->flags |= LISTARG_NEGATEWILDCARD; + } + + /* Only one wildcard allowed... */ + if (args->wildcard[0] != 0) + return show_usage(sptr); + + /* If its not going to match anything, don't bother. */ + if (param[0] != '*' && + param[0] != '?' && + param[0] != '#' && + param[0] != '&') + return show_usage(sptr); + + tmp1 = strchr(param, ','); + tmp2 = strchr(param, ' '); + if (tmp2 && (!tmp1 || (tmp2 < tmp1))) + tmp1 = tmp2; + + if (tmp1) + *tmp1++ = 0; + + ircd_strncpy(args->wildcard, param, CHANNELLEN-1); + args->wildcard[CHANNELLEN-1] = 0; + + if (tmp1 == NULL) + return LPARAM_SUCCESS; + + param = tmp1; + continue; + } + + /* channel name? */ if (!permit_chan || !IsChannelName(param)) return show_usage(sptr); Index: ircd-ircdev/ircd/s_user.c diff -u ircd-ircdev/ircd/s_user.c:1.21 ircd-ircdev/ircd/s_user.c:1.22 --- ircd-ircdev/ircd/s_user.c:1.21 Wed Jun 22 00:54:30 2005 +++ ircd-ircdev/ircd/s_user.c Wed Jun 22 02:58:52 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Miscellaneous user-related helper functions. - * @version $Id: s_user.c,v 1.21 2005/06/22 07:54:30 zolty Exp $ + * @version $Id: s_user.c,v 1.22 2005/06/22 09:58:52 zolty Exp $ */ #include "config.h" @@ -1141,6 +1141,10 @@ if (!IsNickEquivalent(flags)) { #if defined(DDB) + struct Ddb *ddbv; + + ddbv = ddb_find_key(DDB_VHOSTDB, cli_name(sptr)); + if (MyConnect(sptr)) { struct Flags oldflags; @@ -1154,9 +1158,17 @@ else SetNickRegistered(sptr); + if (ddbv && !IsHiddenHost(sptr)) + SetHiddenHost(sptr); + send_umode_out(cptr, sptr, &oldflags, IsRegistered(sptr)); } } + if (ddbv) + { + ircd_snprintf(0, cli_user(sptr)->host, HOSTLEN, ddb_content(ddbv)); + hide_hostmask(sptr, FLAG_HIDDENHOST); + } #endif /* defined(DDB) */ /* Notify change nick local/remote user */ @@ -1415,6 +1427,13 @@ chan = chan->next_channel) ClearBanValid(chan); break; +#elsif defined(DDB) || defined(SERVICES) + case FLAG_NICKREG: + /* Invalidate all bans against the user so we check them again */ + for (chan = (cli_user(cptr))->channel; chan; + chan = chan->next_channel) + ClearBanValid(chan); + break; #endif default: return 0; @@ -1423,17 +1442,23 @@ SetFlag(cptr, flag); #if defined(UNDERNET) if (!HasFlag(cptr, FLAG_HIDDENHOST) || !HasFlag(cptr, FLAG_ACCOUNT)) +#elsif defined(DDB) || defined(SERVICES) + if (!HasFlag(cptr, FLAG_HIDDENHOST) || !HasFlag(cptr, FLAG_NICKREG)) #else if (!HasFlag(cptr, FLAG_HIDDENHOST)) #endif return 0; +#if defined(UNDERNET) || defined(SERVICES) sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Registered"); ircd_snprintf(0, cli_user(cptr)->host, HOSTLEN, "%s.%s", -#if defined(UNDERNET) +# if defined(UNDERNET) cli_user(cptr)->account, feature_str(FEAT_HIDDEN_HOST)); -#else +# else cli_yxx(cptr), feature_str(FEAT_HIDDEN_HOST)); +# endif +#else + sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Changing virtualhost"); #endif /* ok, the client is now fully hidden, so let them know -- hikari */ @@ -1452,13 +1477,23 @@ if (!IsDelayedJoin(chan)) sendcmdto_channel_butserv_butone(cptr, CMD_JOIN, chan->channel, cptr, 0, "%H", chan->channel); - if (IsChanOp(chan) && HasVoice(chan)) + +#if defined(DDB) || defined(SERVICES) + if (IsChanOwner(chan) || IsChanOp(chan) || HasVoice(chan)) sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0, - "%H +ov %C %C", chan->channel, cptr, + "%H +%s%s%s %C %C", chan->channel, cptr, + IsChanOwner(chan) ? "q" : "", + IsChanOp(chan) ? "o" : "", + HasVoice(chan) ? "v" : "", cptr); - else if (IsChanOp(chan) || HasVoice(chan)) +#else + if (IsChanOp(chan) || HasVoice(chan)) sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0, - "%H +%c %C", chan->channel, IsChanOp(chan) ? 'o' : 'v', cptr); + "%H +%s%s %C %C", chan->channel, cptr, + IsChanOp(chan) ? "o" : "", + HasVoice(chan) ? "v" : "", + cptr); +#endif } return 0; } ----------------------- End of diff ----------------------- |