Skip to content

Commit 8ab4552

Browse files
committed
inchannelban-enforce: fix namespace conflict issue
1 parent 48e093c commit 8ab4552

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

files/inchannelban-enforce.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct {
3434
int have_action;
3535
int have_kick_text;
3636
int have_notice_text;
37-
} settings;
37+
} ice_settings;
3838

3939
int ice_local_join(Client *client, Channel *joined_channel, MessageTag *mtags);
4040

@@ -64,7 +64,7 @@ int ice_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
6464
if(strcmp(ce->name, MYCONF))
6565
return 0;
6666

67-
settings.have_config = 1;
67+
ice_settings.have_config = 1;
6868

6969
for(cep = ce->items; cep; cep = cep->next) {
7070
if(!cep->name) {
@@ -80,12 +80,12 @@ int ice_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
8080
}
8181

8282
if(!strcmp(cep->name, "action")) {
83-
settings.have_action = ACTION_NONE;
83+
ice_settings.have_action = ACTION_NONE;
8484
if(!strcmp(cep->value, "kick"))
85-
settings.have_action = ACTION_KICK;
85+
ice_settings.have_action = ACTION_KICK;
8686
if(!strcmp(cep->value, "part"))
87-
settings.have_action = ACTION_PART;
88-
if(settings.have_action == ACTION_NONE){
87+
ice_settings.have_action = ACTION_PART;
88+
if(ice_settings.have_action == ACTION_NONE){
8989
config_error("%s:%i: %s::%s must be either \"kick\" or \"part\"", cep->file->filename, cep->line_number, MYCONF, cep->name);
9090
errors++;
9191
break;
@@ -94,12 +94,12 @@ int ice_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
9494
}
9595

9696
if(!strcmp(cep->name, "notice-text")) {
97-
settings.have_notice_text = 1;
97+
ice_settings.have_notice_text = 1;
9898
continue;
9999
}
100100

101101
if(!strcmp(cep->name, "kick-text")) {
102-
settings.have_kick_text = 1;
102+
ice_settings.have_kick_text = 1;
103103
continue;
104104
}
105105

@@ -112,11 +112,11 @@ int ice_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
112112

113113
int ice_configposttest(int *errs) {
114114
int errors = 0;
115-
if(settings.have_config && !settings.have_action){
115+
if(ice_settings.have_config && !ice_settings.have_action){
116116
config_error("No %s::action specfied!", MYCONF);
117117
errors++;
118118
}
119-
if(settings.have_action == ACTION_KICK && !settings.have_kick_text){
119+
if(ice_settings.have_action == ACTION_KICK && !ice_settings.have_kick_text){
120120
config_error("%s::kick-text is required if %s::method is set to \"kick\"!", MYCONF, MYCONF);
121121
errors++;
122122
}
@@ -125,12 +125,12 @@ int ice_configposttest(int *errs) {
125125
return -1;
126126
}
127127
/* config ok, proceed to apply defaults */
128-
settings.kick_text = NULL;
129-
settings.notice_text = NULL;
130-
if(!settings.have_config){
131-
safe_strdup(settings.kick_text, "Enforcing channel ban for $joined");
132-
safe_strdup(settings.notice_text, "*** Restrictions set on $ban prevent you from being on $joined at the same time. Leaving $ban");
133-
settings.action = ACTION_KICK;
128+
ice_settings.kick_text = NULL;
129+
ice_settings.notice_text = NULL;
130+
if(!ice_settings.have_config){
131+
safe_strdup(ice_settings.kick_text, "Enforcing channel ban for $joined");
132+
safe_strdup(ice_settings.notice_text, "*** Restrictions set on $ban prevent you from being on $joined at the same time. Leaving $ban");
133+
ice_settings.action = ACTION_KICK;
134134
}
135135
return 1;
136136
}
@@ -153,19 +153,19 @@ int ice_configrun(ConfigFile *cf, ConfigEntry *ce, int type) {
153153

154154
if(!strcmp(cep->name, "action")) {
155155
if(!strcmp(cep->value, "kick"))
156-
settings.action = ACTION_KICK;
156+
ice_settings.action = ACTION_KICK;
157157
if(!strcmp(cep->value, "part"))
158-
settings.action = ACTION_PART;
158+
ice_settings.action = ACTION_PART;
159159
continue;
160160
}
161161

162162
if(!strcmp(cep->name, "notice-text")) {
163-
safe_strdup(settings.notice_text, cep->value);
163+
safe_strdup(ice_settings.notice_text, cep->value);
164164
continue;
165165
}
166166

167167
if(!strcmp(cep->name, "kick-text")) {
168-
safe_strdup(settings.kick_text, cep->value);
168+
safe_strdup(ice_settings.kick_text, cep->value);
169169
continue;
170170
}
171171
}
@@ -174,7 +174,7 @@ int ice_configrun(ConfigFile *cf, ConfigEntry *ce, int type) {
174174

175175
ModuleHeader MOD_HEADER = {
176176
"third/inchannelban-enforce",
177-
"6.0",
177+
"6.1",
178178
"Enforce ~c bans so they can't be circumvented",
179179
"k4be",
180180
"unrealircd-6",
@@ -186,10 +186,10 @@ MOD_INIT(){
186186
}
187187

188188
MOD_TEST(){
189-
settings.have_config = 0;
190-
settings.have_action = ACTION_NONE;
191-
settings.have_kick_text = 0;
192-
settings.have_notice_text = 0;
189+
ice_settings.have_config = 0;
190+
ice_settings.have_action = ACTION_NONE;
191+
ice_settings.have_kick_text = 0;
192+
ice_settings.have_notice_text = 0;
193193
HookAdd(modinfo->handle, HOOKTYPE_CONFIGTEST, 0, ice_configtest);
194194
HookAdd(modinfo->handle, HOOKTYPE_CONFIGPOSTTEST, 0, ice_configposttest);
195195
return MOD_SUCCESS;
@@ -241,12 +241,12 @@ int ice_local_join(Client *client, Channel *joined_channel, MessageTag *mtags){
241241
value[1] = joined_channel->name;
242242
name[2] = NULL;
243243
value[2] = NULL;
244-
if(settings.notice_text){
245-
buildvarstring(settings.notice_text, buf, sizeof(buf), name, value);
244+
if(ice_settings.notice_text){
245+
buildvarstring(ice_settings.notice_text, buf, sizeof(buf), name, value);
246246
sendnotice(client, "%s", buf);
247247
}
248-
if(settings.action == ACTION_KICK){
249-
buildvarstring(settings.kick_text, buf, sizeof(buf), name, value);
248+
if(ice_settings.action == ACTION_KICK){
249+
buildvarstring(ice_settings.kick_text, buf, sizeof(buf), name, value);
250250
kick_user(NULL, channel, &me, client, buf);
251251
} else {
252252
parv[1] = channel->name;

0 commit comments

Comments
 (0)