Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send pseudo MODE for chm_hidden modes on oper_up #98

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion ircd/s_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,12 @@ user_welcome(struct Client *source_p)
void
oper_up(struct Client *source_p, struct oper_conf *oper_p)
{
unsigned int old = source_p->umodes, oldsnomask = source_p->snomask;
unsigned int old = source_p->umodes, oldsnomask = source_p->snomask, i = 0;
edk0 marked this conversation as resolved.
Show resolved Hide resolved
rb_dlink_node *ptr;
struct Channel *chptr;
unsigned char cmode1[256], cmode2[256];
unsigned char *cmode_ptr = cmode1;
edk0 marked this conversation as resolved.
Show resolved Hide resolved

hook_data_umode_changed hdata;

SetOper(source_p);
Expand Down Expand Up @@ -1469,6 +1474,29 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
send_umode_out(source_p, source_p, old);
sendto_one_numeric(source_p, RPL_SNOMASK, form_str(RPL_SNOMASK),
construct_snobuf(source_p->snomask));

if (HasPrivilege(source_p, "auspex:cmodes"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't oper_up when your privset changes, so I think this is the wrong place to do anything that checks privs. Currently the best place is probably user_mode, hacky though it is, since we arrange to call it every time privs change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't it also get called for other stuff? how are we meant to know when /mode mynick isn't supposed to send out these MODEs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can :(

Maybe it's time to bite the bullet and add a standard mechanism for all privilege changes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this involve

{
for (i = 0; i < 256; i++)
if (chmode_table[i].set_func == chm_hidden)
*cmode_ptr++ = i;
*cmode_ptr = '\0';

RB_DLINK_FOREACH(ptr, source_p->user->channel.head)
{
chptr = ((struct membership *)ptr->data)->chptr;
jesopo marked this conversation as resolved.
Show resolved Hide resolved
cmode_ptr = cmode2;

for (i = 0; cmode1[i]; i++)
if (chptr->mode.mode & chmode_flags[cmode1[i]])
*cmode_ptr++ = cmode1[i];
*cmode_ptr = '\0';

if (*cmode2)
jesopo marked this conversation as resolved.
Show resolved Hide resolved
sendto_one(source_p, ":%s MODE %s +%s", me.name, chptr->chname, cmode2);
}
}

sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name);
sendto_one_notice(source_p, ":*** Oper privilege set is %s", oper_p->privset->name);
sendto_one_notice(source_p, ":*** Oper privs are %s", oper_p->privset->privs);
Expand Down