static void ns_cmd_status(sourceinfo_t *si, int parc, char *parv[]) { logcommand(si, CMDLOG_GET, "STATUS"); if (!si->smu) command_success_nodata(si, _("You are not logged in.")); else { command_success_nodata(si, _("You are logged in as \2%s\2."), entity(si->smu)->name); if (is_soper(si->smu)) { soper_t *soper = si->smu->soper; command_success_nodata(si, _("You are a services operator of class %s."), soper->operclass ? soper->operclass->name : soper->classname); } } if (si->su != NULL) { mynick_t *mn; mn = mynick_find(si->su->nick); if (mn != NULL && mn->owner != si->smu && myuser_access_verify(si->su, mn->owner)) command_success_nodata(si, _("You are recognized as \2%s\2."), entity(mn->owner)->name); } if (si->su != NULL && is_admin(si->su)) command_success_nodata(si, _("You are a server administrator.")); if (si->su != NULL && is_ircop(si->su)) command_success_nodata(si, _("You are an IRC operator.")); }
static chanacs_t *dummy_match_user(chanacs_t *ca, user_t *u) { if (is_ircop(u)) return ca; return NULL; }
static void ns_cmd_status(char *origin) { user_t *u = user_find_named(origin); logcommand(nicksvs.me, u, CMDLOG_GET, "STATUS"); if (!u->myuser) { notice(nicksvs.nick, origin, "You are not logged in."); return; } notice(nicksvs.nick, origin, "You are logged in as \2%s\2.", u->myuser->name); if (is_soper(u->myuser)) { operclass_t *operclass; operclass = u->myuser->soper->operclass; if (operclass == NULL) notice(nicksvs.nick, origin, "You are a services root administrator."); else notice(nicksvs.nick, origin, "You are a services operator of class %s.", operclass->name); } if (is_admin(u)) notice(nicksvs.nick, origin, "You are a server administrator."); if (is_ircop(u)) notice(nicksvs.nick, origin, "You are an IRC operator."); }
/* i'm putting usermode in here too */ void user_mode(user_t *user, char *modes) { boolean_t toadd = FALSE; if (!user) { slog(LG_DEBUG, "user_mode(): called for nonexistant user"); return; } while (*modes != '\0') { switch (*modes) { case '+': toadd = TRUE; break; case '-': toadd = FALSE; break; case 'o': if (toadd) { if (!is_ircop(user)) { user->flags |= UF_IRCOP; slog(LG_DEBUG, "user_mode(): %s is now an IRCop", user->nick); snoop("OPER: %s (%s)", user->nick, user->server->name); } } else { if (is_ircop(user)) { user->flags &= ~UF_IRCOP; slog(LG_DEBUG, "user_mode(): %s is no longer an IRCop", user->nick); snoop("DEOPER: %s (%s)", user->nick, user->server->name); } } default: break; } modes++; } }
static void plexus_introduce_nick(user_t *u) { const char *omode = is_ircop(u) ? "o" : ""; if (ircd->uses_uid) sts(":%s UID %s 1 %lu +i%s%s %s %s 127.0.0.1 %s 0 %s :%s", me.numeric, u->nick, (unsigned long)u->ts, omode, chansvs.fantasy ? "" : "D", u->user, u->host, u->uid, u->host, u->gecos); else sts("NICK %s 1 %lu +i%s%s %s %s %s :%s", u->nick, (unsigned long)u->ts, omode, chansvs.fantasy ? "" : "D", u->user, u->host, me.name, u->gecos); }
static mowgli_node_t *charybdis_next_matching_ban(channel_t *c, user_t *u, int type, mowgli_node_t *first) { chanban_t *cb; mowgli_node_t *n; char hostbuf[NICKLEN+USERLEN+HOSTLEN]; char realbuf[NICKLEN+USERLEN+HOSTLEN]; char ipbuf[NICKLEN+USERLEN+HOSTLEN]; char strippedmask[NICKLEN+USERLEN+HOSTLEN+CHANNELLEN+2]; char *p; bool negate, matched; int exttype; channel_t *target_c; snprintf(hostbuf, sizeof hostbuf, "%s!%s@%s", u->nick, u->user, u->vhost); snprintf(realbuf, sizeof realbuf, "%s!%s@%s", u->nick, u->user, u->host); /* will be nick!user@ if ip unknown, doesn't matter */ snprintf(ipbuf, sizeof ipbuf, "%s!%s@%s", u->nick, u->user, u->ip); MOWGLI_ITER_FOREACH(n, first) { cb = n->data; if (cb->type != type) continue; /* * strip any banforwards from the mask. (SRV-73) * charybdis itself doesn't support banforward but i don't feel like copying * this stuff into ircd-seven and it is possible that charybdis may support them * one day. * --nenolod */ mowgli_strlcpy(strippedmask, cb->mask, sizeof strippedmask); p = strrchr(strippedmask, '$'); if (p != NULL && p != strippedmask) *p = 0; if ((!match(strippedmask, hostbuf) || !match(strippedmask, realbuf) || !match(strippedmask, ipbuf) || !match_cidr(strippedmask, ipbuf))) return n; if (strippedmask[0] == '$') { p = strippedmask + 1; negate = *p == '~'; if (negate) p++; exttype = *p++; if (exttype == '\0') continue; /* check parameter */ if (*p++ != ':') p = NULL; switch (exttype) { case 'a': matched = u->myuser != NULL && !(u->myuser->flags & MU_WAITAUTH) && (p == NULL || !match(p, entity(u->myuser)->name)); break; case 'c': if (p == NULL) continue; target_c = channel_find(p); if (target_c == NULL || (target_c->modes & (CMODE_PRIV | CMODE_SEC))) continue; matched = chanuser_find(target_c, u) != NULL; break; case 'o': matched = is_ircop(u); break; case 'r': if (p == NULL) continue; matched = !match(p, u->gecos); break; case 's': if (p == NULL) continue; matched = !match(p, u->server->name); break; case 'x': if (p == NULL) continue; matched = extgecos_match(p, u); break; default: continue; } if (negate ^ matched) return n; } }
static void cs_cmd_status(sourceinfo_t *si, int parc, char *parv[]) { char *chan = parv[0]; if (chan) { mychan_t *mc = mychan_find(chan); unsigned int flags; if (*chan != '#') { command_fail(si, fault_badparams, STR_INVALID_PARAMS, "STATUS"); return; } if (!mc) { command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan); return; } logcommand(si, CMDLOG_GET, "STATUS: \2%s\2", mc->name); if (metadata_find(mc, "private:close:closer")) { command_fail(si, fault_noprivs, _("\2%s\2 is closed."), chan); return; } flags = chanacs_source_flags(mc, si); if (flags & CA_AKICK && !(flags & CA_EXEMPT)) command_success_nodata(si, _("You are banned from \2%s\2."), mc->name); else if (flags != 0) { command_success_nodata(si, _("You have access flags \2%s\2 on \2%s\2."), bitmask_to_flags(flags), mc->name); } else command_success_nodata(si, _("You have no special access to \2%s\2."), mc->name); return; } logcommand(si, CMDLOG_GET, "STATUS"); if (!si->smu) command_success_nodata(si, _("You are not logged in.")); else { command_success_nodata(si, _("You are logged in as \2%s\2."), entity(si->smu)->name); if (is_soper(si->smu)) { soper_t *soper = si->smu->soper; command_success_nodata(si, _("You are a services operator of class %s."), soper->operclass ? soper->operclass->name : soper->classname); } } if (si->su != NULL) { mynick_t *mn; mn = mynick_find(si->su->nick); if (mn != NULL && mn->owner != si->smu && myuser_access_verify(si->su, mn->owner)) command_success_nodata(si, _("You are recognized as \2%s\2."), entity(mn->owner)->name); } if (si->su != NULL && is_admin(si->su)) command_success_nodata(si, _("You are a server administrator.")); if (si->su != NULL && is_ircop(si->su)) command_success_nodata(si, _("You are an IRC operator.")); }