[READ-ONLY] Mirror of https://github.com/VibeDevelopers/atheme. Modified fork of atheme IRC Services www.vibetalk.net/
0

Configure Feed

Select the types of activity you want to include in your feed.

allow config file sopers to be specified by ?EID

jesopo (Apr 17, 2022, 11:26 AM UTC) 214b0efb 3bff3ef7

+39 -6
+3
include/atheme/privs.h
··· 77 77 78 78 // Flags for (struct soper).flags 79 79 #define SOPER_CONF 0x1U // Oper is listed in atheme.conf 80 + #define SOPER_EID 0x2U /* oper is listed in atheme.conf by ?EID */ 80 81 81 82 struct operclass 82 83 { ··· 110 111 void soper_delete(struct soper *soper); 111 112 struct soper *soper_find(struct myuser *myuser); 112 113 struct soper *soper_find_named(const char *name); 114 + struct soper *soper_find_eid(const char *); 113 115 114 116 bool is_soper(struct myuser *myuser); 115 117 bool is_conf_soper(struct myuser *myuser); 118 + bool is_conf_named_soper(struct myuser *myuser); 116 119 117 120 /* has_any_privs(): used to determine whether we should give detailed 118 121 * messages about disallowed things
+2 -1
libathemecore/account.c
··· 153 153 154 154 myentity_put(entity(mu)); 155 155 156 - if ((soper = soper_find_named(entity(mu)->name)) != NULL) 156 + if ((soper = soper_find_named(entity(mu)->name)) != NULL 157 + || (soper = soper_find_eid(entity(mu)->id)) != NULL) 157 158 { 158 159 slog(LG_DEBUG, "myuser_add(): user `%s' has been declared as soper, activating privileges.", entity(mu)->name); 159 160 soper->myuser = mu;
+5 -1
libathemecore/conf.c
··· 604 604 char *name; 605 605 char *password = NULL; 606 606 struct operclass *operclass = NULL; 607 + unsigned int flags = SOPER_CONF; 607 608 mowgli_config_file_entry_t *topce; 608 609 609 610 if (ce->vardata == NULL) ··· 647 648 } 648 649 } 649 650 651 + if (*name == '?') 652 + flags |= SOPER_EID; 653 + 650 654 if (operclass != NULL) 651 - soper_add(name, operclass->name, SOPER_CONF, password); 655 + soper_add(name, operclass->name, flags, password); 652 656 else 653 657 conf_report_warning(topce, "skipping operator %s because of bad/missing parameters", 654 658 name);
+25
libathemecore/privs.c
··· 265 265 266 266 return NULL; 267 267 } 268 + struct soper * 269 + soper_find_eid(const char *eid) 270 + { 271 + struct soper *soper; 272 + mowgli_node_t *n; 273 + char lookup_eid[IDLEN+2]; // 2 for ? and \0 274 + 275 + snprintf(lookup_eid, sizeof lookup_eid, "?%s", eid); 276 + 277 + MOWGLI_ITER_FOREACH(n, soperlist.head) 278 + { 279 + soper = (struct soper *)n->data; 280 + 281 + if (soper->name && !irccasecmp(soper->name, lookup_eid)) 282 + return soper; 283 + } 284 + 285 + return NULL; 286 + } 268 287 269 288 bool 270 289 is_soper(struct myuser *myuser) ··· 288 307 return true; 289 308 290 309 return false; 310 + } 311 + 312 + bool 313 + is_conf_named_soper(struct myuser *myuser) 314 + { 315 + return is_conf_soper(myuser) && !(myuser->soper->flags & SOPER_EID); 291 316 } 292 317 293 318 bool
+2 -2
modules/nickserv/group.c
··· 145 145 command_fail(si, fault_noprivs, _("Nick \2%s\2 is an account name; you may not remove it."), mn->nick); 146 146 return; 147 147 } 148 - if (is_conf_soper(mu)) 148 + if (is_conf_named_soper(mu)) 149 149 { 150 - command_fail(si, fault_noprivs, _("You may not modify \2%s\2's account name because their operclass is defined in the configuration file."), 150 + command_fail(si, fault_noprivs, _("You may not modify \2%s\2's account name because their operclass is defined by name in the configuration file."), 151 151 entity(mu)->name); 152 152 return; 153 153 }
+2 -2
modules/nickserv/set_accountname.c
··· 27 27 return; 28 28 } 29 29 30 - if (is_conf_soper(si->smu)) 30 + if (is_conf_named_soper(si->smu)) 31 31 { 32 - command_fail(si, fault_noprivs, _("You may not modify your account name because your operclass is defined in the configuration file.")); 32 + command_fail(si, fault_noprivs, _("You may not modify your account name because your operclass is defined by name in the configuration file.")); 33 33 return; 34 34 } 35 35