[srvx-commits] CVS: services/src proto_bahamut.h,1.6,1.7 proto.h,1.39,1.40 chanserv.h,1.34,1.35 chan
Brought to you by:
entrope
From: Entrope <en...@us...> - 2001-08-29 15:14:44
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv14756/src Modified Files: proto_bahamut.h proto.h chanserv.h chanserv.c Log Message: allow ChanServ to run in out-of-channel mode support auto-invite for users when they auth Index: proto_bahamut.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** proto_bahamut.h 2001/08/24 21:05:31 1.6 --- proto_bahamut.h 2001/08/29 15:14:40 1.7 *************** *** 28,31 **** --- 28,32 ---- #define PROTO_USER_MODE_CHARS " h" #define PROTO_CHANNEL_MODE_CHARS " rRcO" + #define CHANSERV_JOINS_CHANNELS 0 struct userNode_proto { Index: proto.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** proto.h 2001/08/24 21:05:31 1.39 --- proto.h 2001/08/29 15:14:40 1.40 *************** *** 79,82 **** --- 79,86 ---- #endif + #ifndef CHANSERV_JOINS_CHANNELS + #define CHANSERV_JOINS_CHANNELS 1 + #endif + /********************/ /* PROTOCOL SPEWING */ Index: chanserv.h =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** chanserv.h 2001/08/19 03:06:09 1.34 --- chanserv.h 2001/08/29 15:14:40 1.35 *************** *** 48,51 **** --- 48,52 ---- optGreet, optToys, + optAutoInvite, optMax }; *************** *** 75,79 **** #define CHANNEL_DEFAULT_FLAGS (CHANNEL_INFO_LINES) ! #define CHANNEL_DEFAULT_OPTIONS "lmoaaanp" #define IsProtected(x) ((x)->flags & CHANNEL_NODELETE) --- 76,80 ---- #define CHANNEL_DEFAULT_FLAGS (CHANNEL_INFO_LINES) ! #define CHANNEL_DEFAULT_OPTIONS "lmoaaanpn" #define IsProtected(x) ((x)->flags & CHANNEL_NODELETE) Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -r1.181 -r1.182 *** chanserv.c 2001/08/24 20:33:45 1.181 --- chanserv.c 2001/08/29 15:14:40 1.182 *************** *** 1176,1179 **** --- 1176,1180 ---- } + #if CHANSERV_JOINS_CHANNELS void chanserv_join(struct chanData *cData) { *************** *** 1181,1189 **** --- 1182,1197 ---- AddChannelOp(1, &cData->bot, cData->channel, cData->bot, 1); } + #else + #define chanserv_join(x) + #endif + #if CHANSERV_JOIN_CHANNELS void chanserv_part(struct chanData *cData, char *reason) { DelChannelUser(cData->bot, cData->channel, reason, 0); } + #else + #define chanserv_part(x, r) + #endif static struct userData* *************** *** 4204,4207 **** --- 4212,4229 ---- } + static OPTION_FUNC(opt_invite) + { + struct valueData values[] = + { + {"Peons and above will be auto-invited", 'p'}, + {"Ops and above will be auto-invited", 'o'}, + {"Masters and above will be auto-invited", 'm'}, + {"Coowners and above will be auto-invited", 'c'}, + {"Owners will be auto-invited", 'w'}, + {"No one will be auto-invited", 'n'} + }; + MULTIPLE_OPTION("Invite ", "auto-invite", optAutoInvite); + } + static CHANSERV_FUNC(cmd_set) { *************** *** 4214,4218 **** opt_topic, opt_greeting, opt_modes, opt_pubcmd, opt_strictop, opt_autoop, opt_enfmodes, opt_enftopic, opt_protect, opt_toys, ! opt_voice, opt_greet, opt_greetusers, opt_userinfo, opt_dynlimit, opt_topicsnarf, opt_nodelete }; --- 4236,4241 ---- opt_topic, opt_greeting, opt_modes, opt_pubcmd, opt_strictop, opt_autoop, opt_enfmodes, opt_enftopic, opt_protect, opt_toys, ! opt_invite, ! opt_voice, opt_greet, opt_greetusers, opt_userinfo, opt_dynlimit, opt_topicsnarf, opt_nodelete }; *************** *** 4608,4626 **** for(channel = user->handle_info->channels; channel; channel = channel->next) { ! struct chanNode *cn = channel->channel->channel; ! if(!cn || IsSuspended(channel->channel) || !GetUserMode(cn, user)) continue; ! if(channel->user->access >= ulMaster) ! { ! channel->channel->visited = now; ! } ! if(validate_auto_op(user, cn)) ! { ! AddChannelOp(1, &user, cn, channel->channel->bot, 1); } - - channel->user->seen = now; - channel->user->present = 1; } } --- 4631,4656 ---- for(channel = user->handle_info->channels; channel; channel = channel->next) { ! struct chanNode *cn; ! if(IsSuspended(channel->channel)) continue; ! if(!(cn = channel->channel->channel)) continue; ! if (GetUserMode(cn, user)) { ! if(channel->user->access >= ulMaster) ! { ! channel->channel->visited = now; ! } ! if(validate_auto_op(user, cn)) ! { ! AddChannelOp(1, &user, cn, channel->channel->bot, 1); ! } ! channel->user->seen = now; ! channel->user->present = 1; ! } else { ! char value = channel->channel->options[optAutoInvite]; ! if((value!='n') && (channel->user->access >= user_level(value))) { ! irc_invite(channel->channel->bot, user, cn); ! } } } } *************** *** 5283,5289 **** --- 5313,5321 ---- dict_insert(sChannels, cData->name, cData); } else { + #if CHANSERV_JOINS_CHANNELS cData->channel = AddChannel(cData->name, now, NULL, NULL, 0); AddChannelUser(cData->bot, cData->channel, 1); cData->channel->channel_info = cData; + #endif } cData->next = channelList; *************** *** 5636,5643 **** --- 5668,5677 ---- if(!suspender) { + #if CHANSERV_JOINS_CHANNELS /* chanserv_join() cannot be used here. The channel has to be created and join manually. */ cNode = AddChannel(key, now, NULL, NULL, 0); AddChannelUser(uNode, cNode, 1); + #endif } else *************** *** 6346,6350 **** --- 6380,6386 ---- DEFINE_COMMAND(unregister, CMD_REQUIRE_REGISTERED | CMD_SUSPEND_OVERRIDE, ulOwner); DEFINE_COMMAND(move, CMD_REQUIRE_PRIVILEGE | CMD_REQUIRE_REGISTERED, ulOwner); + #if CHANSERV_JOINS_CHANNELS DEFINE_COMMAND(opchan, CMD_REQUIRE_PRIVILEGE | CMD_REQUIRE_CHANNEL, ulOwner); + #endif #if TRANSITION DEFINE_COMMAND(switch, CMD_REQUIRE_HANDLE | CMD_REQUIRE_CHANNEL, ulNone); |