[X2serv-cvs] CVS: x2/source chan.c,1.67,1.68 commands.c,1.126,1.127 config.h,1.49,1.50 main.c,1.46,1
Brought to you by:
sirvulcan
From: Richard P. <lys...@us...> - 2001-01-23 14:20:09
|
Update of /cvsroot/x2serv/x2/source In directory usw-pr-cvs1:/tmp/cvs-serv16492/source Modified Files: chan.c commands.c config.h main.c Log Message: Updated these files for the new set/xset functions Index: chan.c =================================================================== RCS file: /cvsroot/x2serv/x2/source/chan.c,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -r1.67 -r1.68 *** chan.c 2001/01/22 07:24:33 1.67 --- chan.c 2001/01/23 14:20:24 1.68 *************** *** 28,32 **** char globsign; - extern set_list set_commands[NUMOFCHANSETTINGS]; void SetTopics(int period) --- 28,31 ---- Index: commands.c =================================================================== RCS file: /cvsroot/x2serv/x2/source/commands.c,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -r1.126 -r1.127 *** commands.c 2001/01/22 13:33:12 1.126 --- commands.c 2001/01/23 14:20:24 1.127 *************** *** 164,169 **** { "K", c_kick, REGED, OP, T, F, F, T }, { "DEOP", c_deop, REGED, OP, T, F, F, T }, ! { "SET", c_set, REGED, OP, T, T, F, T }, ! { "XSET", c_xset, NONE, 0, 0, 0, T, T }, { "GLOBAL", c_global, NONE, 0, 0, 0, T, T }, { "UNVISITED", c_unvisited, NONE, 0, 0, 0, T, T }, --- 164,169 ---- { "K", c_kick, REGED, OP, T, F, F, T }, { "DEOP", c_deop, REGED, OP, T, F, F, T }, ! { "SET", c_set, REGED, 0, T, T, F, T }, ! { "XSET", c_xset, NONE, 0, 0, 0, F, T }, { "GLOBAL", c_global, NONE, 0, 0, 0, T, T }, { "UNVISITED", c_unvisited, NONE, 0, 0, 0, T, T }, *************** *** 378,517 **** } - set_list set_commands[NUMOFCHANSETTINGS+1] = - /* Command min max def description set0 set1 set2 set3 set4 set5 */ - { - { - /* #define TOPICFREQ 0 */ - "TOPICFREQ", TOPICFREQ, 1,0, 4, 1, "How frequently X2 sets the channel topic to its default.", - "The Topic is refreshed: ", - {"Never.", - "Once a day.", - "Twice a day.", - "Every 4 hours.", - "Every hour.", - ""} - } - , - { - /* #define STRICTOP 1 */ - "STRICTOP", STRICTOP, 1,0, 2, 0, "Does X2 allow non-users to be opped by others?", - "Unknown users can be opped by: ", - {"Anyone.", - "Only OPs, MANAGERs, and (CO)OWNERs.", - "Only MANAGERs and (CO)OWNERs.", - "", "", ""} - } - , - { - "AUTOOP", AUTOOP, 1,0, 3, 2, "Who does X2 autoop?", - "X2 will Auto-op: ", - {"Nobody", - "Only MANAGERs and (CO)OWNERs.", - "OPs, MANAGERs, and (CO)OWNERs.", - "Everyone.", - "", ""} - } - , - { - "PROTECT", PROTECT, 1,0, 4, 0, "Who does X2 protect from whom?", - "X2 will protect: ", - {"No one from anyone.", - "users from anyone of lower rank.", - "users from anyone of equal or lower rank.", - "Only MANAGERs, and (CO)OWNERs from everyone.", - "Only (CO)OWNERS from everyone.", - ""} - } - , - { - "ENFMODES", ENFMODES, 1,0, 2, 0, "Should X2 force the default modes?", - "Default modes can be overridden by: ", - {"Everyone.", - "Only OPs, MANAGERs, and (CO)OWNERs.", - "Only MANAGERs and (CO)OWNERs.", - "", "", ""} - } - , - { - "PASSMODE", PASSMODE, 1,0, 1, 0, "Should X2 give ops to passworded users who are not verified?", - "Users who have set a password, but have NOT authenticated: ", - {"are NOT opped.", - "are given ops anyway.", - "", "", "", ""} - } - , - { - "BANTIMEOUT", BANTIMEOUT, 1, 0, 5, 0, "Should X2 remove old bans?", - "Bans are removed: ", - {"Never.", - "After 10 minutes.", - "After 2 hours.", - "After 4 hours.", - "After 24 hours.", - "After one week."} - } - , - { - "VOICE", VOICE, 1, 0, 2, 1, "Should X2 give voice?", - "Mode +v (voice) given to: ", - {"Noone.", - "Peons.", - "Everyone.", - "", - "", - ""} - } - , - { - "USERINFO", USERINFO, 1, 0, 1, 1, "Show userinfo lines?", - "Show userinfo lines when users join?: ", - {"No", - "Yes", - "", - "", - "", - ""} - } - , - { - "INCHAN", INCHAN, 1, 0, 1, 1, "Does X2 enter the channel?", - "Should X2 go into the channel?: ", - {"No", - "Yes", - "", - "", - "", - ""} - } - , - { /* Option not used anymore */ - "SUSPENDED", UNUSED, 0, 0, 1, 0, "Is it suspended?", - "Has the channel been suspended by CService Admin?: ", - {"No", - "Yes", - "", - "", - "", - ""} - } - , - { - "NODELETE", NODELETE, 0, 0, 1, 0, "Is it exempted from deletion?", - "Exempt from unvisited deletion rules?: ", - { "No", - "Yes", - "", - "", - "", - ""} - } - , - { - NULL, 0, 0, 0, 0, 0, NULL, - "", - {"", "", "", "", "", ""} - } - }; - /* Begin command descriptions */ --- 378,381 ---- *************** *** 1532,1535 **** --- 1396,1400 ---- strcpy(hptr->Pass, CryptPass); send_to_user(uptr, "Your password in channel %s has been changed.", cptr->Name); + WriteChanOpFile(cptr); return(TRUE); } *************** *** 1547,1550 **** --- 1412,1416 ---- SetInfo(cptr, hptr, rest); send_to_user(uptr, "Your info-line has been changed to: %s", rest); + WriteChanOpFile(cptr); return(TRUE); } *************** *** 2433,2436 **** --- 2299,2303 ---- send_to_user(uptr, " Channel Name : \002%s\002 ", cptr->Name); send_to_user(uptr, " Created : \002%s\002 by \002%s\002", timestring, cptr->Reggedby); + if (!strcmp(cptr->Topic, "*")) send_to_user(uptr, " No default topic."); *************** *** 2456,2464 **** send_to_user(uptr, " Num Of Lamers : %3d", LamerNumber); send_to_user(uptr, " "); - for (k = 0; set_commands[k].name != NULL; k++) - { - if (k != UNUSED) - send_to_user(uptr, " \002%s\002%s", set_commands[k].pre, set_commands[k].settings[cptr->settings[set_commands[k].index]]); - } if (OwnerNumber > 0) { --- 2323,2326 ---- *************** *** 2498,3031 **** } - /* TODO : Split this into a very basic function which calls - * perhapse s_name() functions for set paramiters. - */ int c_set(C_PARAM) { ! char *option, *param; ! int i, j, value, curset; ! char ModeString[LINEBUFFSIZE]; ! int ChangedINCHAN = 0; ! ! option = strtok(rest, " "); ! param = strtok(NULL, "\n"); ! ! if (!option) ! { ! send_to_user(uptr, "=----------- %s Settings -------------=", cptr->Name); ! send_to_user(uptr, " \002Topic \002: %s", cptr->Topic); ! send_to_user(uptr, " \002Modes \002: %s", GetModeString(ModeString, cptr->PlusModes, cptr->MinModes, cptr->Key, cptr->Limit)); ! send_to_user(uptr, " \002URL \002: %s", cptr->URL); ! if(IsChanOwner(hptr) || IsOper(uptr)) ! { ! send_to_user(uptr, " \002E-MAIL \002: %s", cptr->Email); ! if(IsOper(uptr)) ! send_to_user(uptr, "NOTE: E-mail is for official IRC Op use ONLY! Do not give it out!"); ! else { ! send_to_user(uptr, "NOTE: E-mail is visible to IRC Ops and Owners only;"); ! send_to_user(uptr, "It is used for verification of identity and contacting you."); ! } ! } ! send_to_user(uptr, "\002Description \002: %s", cptr->Description); ! for (i = 0; set_commands[i].name != NULL; i++) ! { ! if (i != UNUSED) ! { ! if(set_commands[i].user) /* If its not an IRCOP only command */ ! send_to_user(uptr, "\002%10s\002 : %d %s%s", set_commands[i].name, ! cptr->settings[set_commands[i].index], set_commands[i].pre, ! set_commands[i].settings[cptr->settings[set_commands[i].index]]); ! } ! } ! send_to_user(uptr, "=- The following are set by IRCOPS only -="); ! for (i = 0; set_commands[i].name != NULL; i++) ! { ! if (i != UNUSED) ! { ! if(!set_commands[i].user) /* If it IS an IRCOP only command */ ! send_to_user(uptr, "%10s : %d \002%s\002%s", set_commands[i].name, ! cptr->settings[set_commands[i].index], set_commands[i].pre, ! set_commands[i].settings[cptr->settings[set_commands[i].index]]); ! } ! } ! ! send_to_user(uptr, "=----------------- End ------------------="); ! return(TRUE); ! } ! if(!strcasecmp(option, "URL")) ! { ! if(!param) ! send_to_user(uptr, "\002URL\002: %s", cptr->URL); ! else ! { ! free(cptr->URL); ! if((cptr->URL = (char *) malloc(strlen(param) + 1))) ! { ! safecopy(cptr->URL, param, MAXURLLEN); ! send_to_user(uptr, "\002URL set to\002: %s", cptr->URL); ! } ! else ! { ! send_to_user(uptr, "\002Error allocating memory for new URL!\002"); ! return(FALSE); ! } ! WriteChanOpFile(cptr); ! } ! return(TRUE); ! } ! if(!strcasecmp(option, "DESCRIPTION")) ! { ! if(!param) ! send_to_user(uptr, "\002Description\002: %s", cptr->Description); ! else ! { ! free(cptr->Description); ! if((cptr->Description = (char *) malloc(strlen(param) + 1))) ! { ! safecopy(cptr->Description, param, MAXDESCLEN); ! send_to_user(uptr, "\002Description set to\002: %s", cptr->Description); ! } ! else ! { ! send_to_user(uptr, "\002Error allocating memory for new description!\002"); ! return(FALSE); ! } ! WriteChanOpFile(cptr); ! } ! return(TRUE); ! } ! if (!strcasecmp(option, "TOPIC")) ! { ! if (!param) ! send_to_user(uptr, "\002Topic\002: %s", cptr->Topic); ! else ! { ! free(cptr->Topic); ! if(strlen(param)>MAXTOPICLEN) ! param[MAXTOPICLEN] = '\0'; ! if((cptr->Topic = (char *) malloc(strlen(param) + 10))) ! { ! safecopy(cptr->Topic, param, MAXTOPICLEN); ! send_to_user(uptr, "\002Default topic set to\002: %s", cptr->Topic); ! } ! else ! { ! send_to_user(uptr, "\002Error allocating memory for new topic!"); ! return(FALSE); ! } ! } ! WriteChanOpFile(cptr); ! return(TRUE); ! } ! if (!strcasecmp(option, "EMAIL")) ! { ! if (!param) ! { ! if(IsChanOwner(hptr) || IsOper(uptr)) ! send_to_user(uptr, "\002E-mail\002: %s", cptr->Email); ! else ! send_to_user(uptr, "\002E-mail\002: [visible to owner and IRC Operators only]"); ! } ! else ! { ! free(cptr->Email); ! if(strlen(param)>MAXEMAILLEN) ! param[MAXEMAILLEN] = '\0'; ! if((cptr->Email = (char *) malloc(strlen(param) + 10))) ! { ! safecopy(cptr->Email, param, MAXEMAILLEN); ! send_to_user(uptr, "\002Owner e-mail set to\002: %s", cptr->Email); ! } ! else ! { ! send_to_user(uptr, "\002Error allocating memory for new e-mail!"); ! return(FALSE); ! } ! } ! WriteChanOpFile(cptr); ! return(TRUE); ! } ! else if (!strcasecmp(option, "MODES") || !strcasecmp(option, "MODE")) ! { ! int n; ! if(param) ! for(n=strlen(param)-1;n>=0;n--) ! { ! if(isblank(param[n])) ! param[n] = '\0'; ! else ! break; ! } ! if (!param || !*param) ! { ! send_to_user(uptr, "\002Mode: %s", ! GetModeString(ModeString, cptr->PlusModes, ! cptr->MinModes, cptr->Key, cptr->Limit)); ! } ! else ! { ! if (userleveloper(uptr, hptr) < MA) ! { ! send_to_user(uptr, "\002You must be set at access level OWNER or MANAGER to set permanent modes.\002"); ! return(FALSE); ! } ! ConvertModeString(param, &cptr->PlusModes, &cptr->MinModes, &cptr->Key, &cptr->Limit); ! if(cptr->settings[INCHAN]) ! { ! send_chanmode(cptr, "-k %s", cptr->CurrentKey); ! send_chanmode(cptr, "%s", GetModeString(ModeString, cptr->PlusModes, cptr->MinModes, ! cptr->Key, cptr->Limit)); ! } ! send_to_user(uptr, "\002Default mode set to: %s", ! ModeString); ! if (cptr->Key) ! safecopy(cptr->CurrentKey, cptr->Key, MAXCHANKEY); ! else ! strcpy(cptr->CurrentKey, ""); ! ! } ! WriteChanOpFile(cptr); ! return(TRUE); ! } ! if (param) ! { ! if (sscanf(param, "%d", &value) != 1) ! { ! send_to_user(uptr, "\002Error: Parameter must be a number.\002"); ! return(FALSE); ! } ! } ! for (i = 0; set_commands[i].name != NULL; i++) ! { ! if (i == UNUSED) ! continue; ! ! if (!strcasecmp(option, set_commands[i].name)) ! { ! if (!param) /* No parameter. */ ! { ! curset = cptr->settings[set_commands[i].index]; ! send_to_user(uptr, "=-----------------------------="); ! send_to_user(uptr, "\002%s\002: %s\002", set_commands[i].name, set_commands[i].pre); ! send_to_user(uptr, "=---- * indicates current ----="); ! for (j = 0; j < 6; j++) ! { ! if (set_commands[i].settings[j][0] == 0) ! break; ! if (j == curset) ! send_to_user(uptr, " %d: [*] %s", j, set_commands[i].settings[j]); ! else ! send_to_user(uptr, " %d: [ ] %s", j, set_commands[i].settings[j]); ! } ! send_to_user(uptr, "=------------ End ------------="); ! return(TRUE); ! } ! else if (userleveloper(uptr, hptr) < MA && !IsGodOper(uptr)) ! { ! send_to_user(uptr, "\002You must be set to access level OWNER or MANAGER to change settings.\002"); ! return(FALSE); ! } ! if (!set_commands[i].user && !IsGodOper(uptr)) ! { ! send_to_user(uptr, "\002%s can only be modified by the Channel Service administrators.\002", set_commands[i].name); ! return(FALSE); ! } ! if ((value < set_commands[i].min) || (value > set_commands[i].max)) ! { ! send_to_user(uptr, "\002Error: %s must be in the range %d-%d.", set_commands[i].name, ! set_commands[i].min, set_commands[i].max); ! return(FALSE); ! } ! if(!strcasecmp(option, "INCHAN")) ! { ! if(cptr->Suspended) ! { ! send_to_user(uptr, "Channel %s has been suspended by the Channel Service Admins.", cptr->Name); ! send_to_user(uptr, "E-mail cse...@af... for more information."); ! return(FALSE); ! } ! ChangedINCHAN = TRUE; ! } ! if(value == cptr->settings[set_commands[i].index]) ! { ! send_to_user(uptr, "%s already set to %d", option, value); ! return(FALSE); ! } ! cptr->settings[set_commands[i].index] = value; ! WriteChanOpFile(cptr); ! send_to_user(uptr, "\002%s\002 set to %d. \"\002%s\002%s\"", set_commands[i].name, ! value, set_commands[i].pre, set_commands[i].settings[value]); ! /* if(!strcasecmp(option, "SUSPENDED")) ! { ! ChangedINCHAN = TRUE; ! if(cptr->settings[SUSPENDED] == 1) ! { ! send_to_user(uptr, "Channel %s marked as suspended.", cptr->Name); ! cptr->settings[INCHAN] = 0; ! } ! else ! { ! send_to_user(uptr, "Suspension cleared for channel %s", cptr->Name); ! cptr->settings[INCHAN] = 1; ! } ! } */ ! if(ChangedINCHAN) ! { ! if(cptr->settings[INCHAN] == 0) /* Leave the channel */ ! { ! send_to_user(uptr, "Leaving disabled channel %s. \002/msg %s %s set INCHAN 1\002 to re-enable.", ! cptr->Name, IrcNick, cptr->Name); ! send_part(cptr, "Disabled by %s.", uptr->Nick); ! } ! else /* Join the channel */ ! { ! if(cptr->Suspended) ! { ! send_to_user(uptr, "This channel has been suspeneded by the Channel Service administrators."); ! send_to_user(uptr, "E-mail cse...@af... for more information."); ! return(FALSE); ! } ! send_to_user(uptr, "Rejoining channel %s.", cptr->Name); ! send_join(cptr); ! send_opchan(cptr); ! send_chanmode(cptr, "%s", GetModeString(ModeString, cptr->PlusModes, ! cptr->MinModes, cptr->Key, cptr->Limit)); ! ! if (strcmp(cptr->Topic, "*") && cptr->settings[TOPICFREQ]) ! send_topic(cptr, cptr->Topic); ! } ! } /* INCHAN */ ! return(TRUE); ! } ! } ! send_to_user(uptr, "\002Unknown setting [\002%s\002].\002", option); ! return(FALSE); } - /* TODO : Same as above-- make this a small parent function that calls perhapse x_function - * or something. - */ int c_xset(C_PARAM) { ! char *UpCaseOpt; ! char *Option, *Value; ! int Val; ! ! /* gota break up rest like parse used to do.. */ ! Option = strtok(rest, " "); ! Value = strtok(NULL, "\0"); ! rest = Value; ! ! if (!Option) ! { ! send_to_user(uptr, "\002XSET <option> <value>\002"); ! send_to_user(uptr, "\002Option Function\002"); ! send_to_user(uptr, "\002-------------------------------\002"); ! send_to_user(uptr, "\002MAXCLONES \002How many clones until I take action?"); ! send_to_user(uptr, "\002CLONERES \002What action must I take? 0 = nothing, 1 = warn, 2 = kill, 3 = GLINE *!*user@*host"); ! send_to_user(uptr, "\002GATECHECK \002Check for wingates? 0 = no, 1 = warn, 2 = GLINE"); ! send_to_user(uptr, "\002PINGOUTCONNECT \002Have X2 send a CONNECT when a server pings out."); ! send_to_user(uptr, "\002AUTOROUTING \002Should X2 try to force routing to the currenly loaded route.dat?"); ! send_to_user(uptr, "\002AUTOCONNECT \002Should X2 try to connect to a server, or wait for a connection (1 or 0 respectively)?"); ! send_to_user(uptr, "\002DEBUG \002What debugging information should be displayed? 0 = all, 60=none"); ! send_to_user(uptr, "\002DBTARGET \002Where should debugging information go? \002DO NOT ABUSE THIS!\002"); ! send_to_user(uptr, "\002-------------------------------\002"); ! return(FALSE); ! } ! if (!Value) ! { ! send_to_user(uptr, "\002Set %s to what?\002", Option); ! if (!strcasecmp(Option, "ENFORCE")) ! send_to_user(uptr, "\0020 = disabled, 1 = enabled.\002"); ! if (!strcasecmp(Option, "GATECHECK")) ! send_to_user(uptr, "\0020 = no action, 1 = warn IRC Ops, 2 = GLINE.\002"); ! if (!strcasecmp(Option, "CLONERES")) ! send_to_user(uptr, "\0020 = no action, 1 = warn IRC Ops, 2 = kill\002"); ! return(FALSE); ! } ! /* ok now to continue with xset.. */ ! ! UpCaseOpt = UpCase(Option); ! if (!strcmp(UpCaseOpt, "AUTOROUTING")) ! { ! if ((strlen(Value) > 1) || (!isdigit(Value[0]))) ! { ! send_to_user(uptr, "\002Error:\002 Value must be a single-digit number."); ! free(UpCaseOpt); ! return(FALSE); ! } ! Val = atoi(Value); ! if ((Val != 0) && (Val != 1)) ! { ! send_to_user(uptr, "\002Error:\002 Value must be either 0 or 1."); ! free(UpCaseOpt); ! return(FALSE); ! } ! if (AUTOROUTING == Val) ! { ! send_to_user(uptr, "AUTOROUTING is already set to %d.", AUTOROUTING); ! free(UpCaseOpt); ! return(FALSE); ! } ! AUTOROUTING = Val; ! send_wallops("AUTOROUTING %s by %s.", GetSetting(AUTOROUTING), uptr->Nick); ! } ! else if (!strcmp(UpCaseOpt, "PINGOUTCONNECT")) ! { ! if ((strlen(Value) > 1) || (!isdigit(Value[0]))) ! { ! send_to_user(uptr, "\002Error:\002 Value must be a single-digit number."); ! free(UpCaseOpt); ! return(FALSE); ! } ! Val = atoi(Value); ! if ((Val != 0) && (Val != 1)) ! { ! send_to_user(uptr, "\002Error:\002 Value must be either 0 or 1."); ! free(UpCaseOpt); ! return(FALSE); ! } ! if (PINGOUTCONNECT == Val) ! { ! send_to_user(uptr, "PINGOUTCONNECT is already set to %d.", PINGOUTCONNECT); ! free(UpCaseOpt); ! return(FALSE); ! } ! PINGOUTCONNECT = Val; ! send_wallops("PINGOUTCONNECT %s by %s.", GetSetting(PINGOUTCONNECT), uptr); ! } ! else if (!strcmp(UpCaseOpt, "GATECHECK")) ! { ! if ((strlen(Value) > 1) || (!isdigit(Value[0]))) ! { ! send_to_user(uptr, "\002Error:\002 Value must be a single-digit number."); ! free(UpCaseOpt); ! return(FALSE); ! } ! Val = atoi(Value); ! if ((Val < 0) || (Val > 2)) ! { ! send_to_user(uptr, "\002Error:\002 Value must be one of the following: 0 (no check), 1 (warn IRC Ops) or 2 (GLINE)."); ! free(UpCaseOpt); ! return(FALSE); ! } ! if (GATECHECK == Val) ! { ! send_to_user(uptr, "GATECHECK is already set to %d.", GATECHECK); ! free(UpCaseOpt); ! return(FALSE); ! } ! GATECHECK = Val; ! send_wallops("GATECHECK set to %d by %s.", GATECHECK, uptr->Nick); ! } ! else if (!strcmp(UpCaseOpt, "AUTOCONNECT")) ! { ! if ((strlen(Value) > 1) || (!isdigit(Value[0]))) ! { ! send_to_user(uptr, "\002Error:\002 Value must be a single-digit number."); ! free(UpCaseOpt); ! return(FALSE); ! } ! Val = atoi(Value); ! if ((Val != 0) && (Val != 1)) ! { ! send_to_user(uptr, "\002Error:\002 Value must be either 0 or 1."); ! free(UpCaseOpt); ! return(FALSE); ! } ! if (AUTOCONNECT == Val) ! { ! send_to_user(uptr, "AUTOCONNECT is already set to %d.", AUTOCONNECT); ! free(UpCaseOpt); ! return(FALSE); ! } ! AUTOCONNECT = Val; ! send_wallops("AUTOCONNECT %s by %s.", GetSetting(AUTOCONNECT), uptr->Nick); ! } ! else if (!strcmp(UpCaseOpt, "MAXCLONES")) ! { ! if ((strlen(Value) > 1) || (!isdigit(Value[0]))) ! { ! send_to_user(uptr, "\002Error:\002 Value must be a single-digit number."); ! free(UpCaseOpt); ! return(FALSE); ! } ! Val = atoi(Value); ! if (MAXCLONES == Val) ! { ! send_to_user(uptr, "MAXCLONES is already set to %d", MAXCLONES); ! free(UpCaseOpt); ! return(FALSE); ! } ! MAXCLONES = Val; ! send_wallops("MAXCLONES set to %d by %s.", MAXCLONES, uptr->Nick); ! } ! else if (!strcmp(UpCaseOpt, "CLONERES")) ! { ! if ((strlen(Value) > 1) || (!isdigit(Value[0]))) ! { ! send_to_user(uptr, "\002Error:\002 Value must be a single-digit number."); ! free(UpCaseOpt); ! return(FALSE); ! } ! Val = atoi(Value); ! if (Val > 3) ! { ! send_to_user(uptr, "\002Error:\002 Value must be in the range 0-3."); ! free(UpCaseOpt); ! return(FALSE); ! } ! if (CLONERES == Val) ! { ! send_to_user(uptr, "CLONERES is already set to %d.", CLONERES); ! free(UpCaseOpt); ! return(FALSE); ! } ! CLONERES = Val; ! send_wallops("CLONERES set to %s by %s.", GetCloneResMet(CLONERES), uptr->Nick); ! } ! else if (!strcmp(UpCaseOpt, "DEBUG")) ! { ! if (!(Value && *Value)) ! { ! free(UpCaseOpt); ! return(FALSE); ! } ! Val = atoi(Value); ! if ((Val < 0) || (Val > 99)) ! { ! send_to_user(uptr, "\002Error:\002 Value must be in the range 0-99."); ! free(UpCaseOpt); ! return(FALSE); ! } ! DEBUG = Val; ! send_wallops("DEBUG set to %d by %s.", DEBUG, uptr->Nick); ! free(UpCaseOpt); ! return(TRUE); ! } ! else if (!strcasecmp(UpCaseOpt, "DBTARGET")) ! { ! if (Value && *Value && (strcasecmp("NULL", Value))) ! { ! safecopy(DBTARGET, Value, MAXNICKLEN); ! send_wallops("DEBUG TARGET set to %s by %s.", DBTARGET, uptr->Nick); ! free(UpCaseOpt); ! return(TRUE); ! } ! else ! { ! strcpy(DBTARGET, ""); ! send_wallops("Debugging disabled by %s.", uptr->Nick); ! free(UpCaseOpt); ! return(TRUE); ! } ! } ! else ! { ! send_to_user(uptr, "Unknown setting '%s'.", Option); ! return(FALSE); ! } ! free(UpCaseOpt); ! return(TRUE); } --- 2360,2371 ---- } int c_set(C_PARAM) { ! return(do_set(C_PARAM_CALL)); } int c_xset(C_PARAM) { ! return(do_xset(C_PARAM_CALL)); } Index: config.h =================================================================== RCS file: /cvsroot/x2serv/x2/source/config.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -r1.49 -r1.50 *** config.h 2001/01/22 13:33:12 1.49 --- config.h 2001/01/23 14:20:24 1.50 *************** *** 277,293 **** #define Reg1 register - typedef struct set_listType - { - char *name; - int index; - int user; /* Is it a user modifyable thing? */ - int min; - int max; - int def; - char *description; - char *pre; - char settings[6][150]; - } set_list; - typedef enum { --- 277,280 ---- *************** *** 438,448 **** #define PROTECT 3 #define ENFMODES 4 ! #define PASSMODE 5 #define BANTIMEOUT 6 #define VOICE 7 #define USERINFO 8 #define INCHAN 9 ! /*#define SUSPENDED 10 I can't just take an option out */ ! #define UNUSED 10 /* so I've renamed it to UNUSED -Lysergine */ #define NODELETE 11 --- 425,434 ---- #define PROTECT 3 #define ENFMODES 4 ! /*#define PASSMODE 5 unused option have name "" */ #define BANTIMEOUT 6 #define VOICE 7 #define USERINFO 8 #define INCHAN 9 ! /*#define SUSPENDED 10 */ #define NODELETE 11 *************** *** 450,453 **** --- 436,453 ---- * this INCLUDES the 0th setting. (0-11 would be 12) */ #define NUMOFCHANSETTINGS 12 + + typedef struct set_listType + { + char *name; + int index; + int level; + int user; /* Is it a user modifyable thing? */ + int num; + int def; + char *description; + char *pre; + char settings[6][45]; + } set_list; + extern set_list set_commands[NUMOFCHANSETTINGS+1]; /* This is all we know about a NICK on IRC */ Index: main.c =================================================================== RCS file: /cvsroot/x2serv/x2/source/main.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -r1.46 -r1.47 *** main.c 2001/01/22 07:24:33 1.46 --- main.c 2001/01/23 14:20:25 1.47 *************** *** 82,86 **** UpLinkList *CurUpLink; UpLinkList *UpLinks = NULL; - extern set_list set_commands[NUMOFCHANSETTINGS]; extern int REMOTE_AUTHENTICATED; --- 82,85 ---- *************** *** 463,471 **** /* If the suspended flag is used, convert it to the new system */ /* This is temporary code, to be removed after all files are converted */ ! if (settings[UNUSED]) { Suspended = malloc(strlen("Unknown reason") + 1); strcpy(Suspended, "Unknown reason"); ! settings[UNUSED] = 0; } continue; --- 462,470 ---- /* If the suspended flag is used, convert it to the new system */ /* This is temporary code, to be removed after all files are converted */ ! if (settings[10]) { Suspended = malloc(strlen("Unknown reason") + 1); strcpy(Suspended, "Unknown reason"); ! settings[10] = 0; } continue; |