X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_user.c;h=2ef132058735e44ffa1a1284f3cd829310c748f7;hb=refs%2Fheads%2Fupstream-ssl;hp=38f50267610af300a524dfa6649a45b9409bf7e7;hpb=fda0e2796ececf42f7a36f8066cc63fa1ef736fc;p=ircu2.10.12-pk.git diff --git a/ircd/m_user.c b/ircd/m_user.c index 38f5026..2ef1320 100644 --- a/ircd/m_user.c +++ b/ircd/m_user.c @@ -79,49 +79,43 @@ * note: it is guaranteed that parv[0]..parv[parc-1] are all * non-NULL pointers. */ -#if 0 -/* - * No need to include handlers.h here the signatures must match - * and we don't need to force a rebuild of all the handlers everytime - * we add a new one to the list. --Bleep - */ +#include "config.h" + #include "handlers.h" -#endif /* 0 */ #include "client.h" #include "ircd.h" #include "ircd_chattr.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "numeric.h" #include "numnicks.h" +#include "s_auth.h" #include "s_debug.h" #include "s_misc.h" #include "s_user.h" #include "send.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include #include #include -#define UFLAGS (FLAGS_INVISIBLE|FLAGS_SERVNOTICE) - /* * m_user * * parv[0] = sender prefix * parv[1] = username (login name, account) - * parv[2] = umode mask (host name) - * parv[3] = server notice mask (server name) + * parv[2] = host name (ignored) + * parv[3] = server name (ignored) * parv[4] = users real name info */ int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) { char* username; - const char* umode; - const char* snomask; + char* term; const char* info; - struct User* user; + unsigned int mode_request; assert(0 != cptr); assert(cptr == sptr); @@ -145,32 +139,31 @@ int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) else username = "NoUser"; - umode = (EmptyString(parv[2])) ? "." : parv[2]; - snomask = (EmptyString(parv[3])) ? "." : parv[3]; - info = (EmptyString(parv[4])) ? "No Info" : parv[4]; - - user = make_user(cptr); - - if (!strchr(umode, '.')) /* Not an IP# as hostname ? */ - cli_flags(cptr) |= (UFLAGS & atoi(umode)); - - if ((cli_flags(cptr) & FLAGS_SERVNOTICE)) - set_snomask(cptr, (IsDigit(*snomask) && !strchr(snomask, '.')) ? - (atoi(snomask) & SNO_USER) : SNO_DEFAULT, SNO_SET); - - user->server = &me; - ircd_strncpy(cli_info(cptr), info, REALLEN); - - if ((cli_name(cptr))[0] && cli_cookie(cptr) == COOKIE_VERIFIED) { - /* - * NICK and PONG already received, now we have USER... + if ((mode_request = strtoul(parv[2], &term, 10)) != 0 + && term != NULL && *term == '\0') + { + char *invisible[4] = { NULL, NULL, "+i", NULL }; + char *wallops[4] = { NULL, NULL, "+w" , NULL }; + /* These bitmask values are codified in RFC 2812, showing + * ... well, something that is probably best not said. */ - return register_user(cptr, sptr, cli_name(sptr), username, 0); + if (mode_request & 8) + set_user_mode(cptr, sptr, 3, invisible, ALLOWMODES_ANY); + if (mode_request & 4) + set_user_mode(cptr, sptr, 3, wallops, ALLOWMODES_ANY); } - else { - ircd_strncpy(user->username, username, USERLEN); - ircd_strncpy(user->host, cli_sockhost(cptr), HOSTLEN); + else if (parv[2][0] == '+') + { + char *user_modes[4]; + user_modes[0] = NULL; + user_modes[1] = NULL; + user_modes[2] = parv[2]; + user_modes[3] = NULL; + set_user_mode(cptr, sptr, 3, user_modes, ALLOWMODES_ANY); } - return 0; + + info = (EmptyString(parv[4])) ? "No Info" : parv[4]; + + return auth_set_user(cli_auth(cptr), username, parv[2], parv[3], info); }