| 30 |
|
#include "numeric.h" |
| 31 |
|
#include "s_user.h" |
| 32 |
|
#include "send.h" |
| 33 |
– |
#include "s_conf.h" |
| 33 |
|
#include "msg.h" |
| 34 |
|
#include "parse.h" |
| 35 |
|
#include "modules.h" |
| 36 |
+ |
#include "listener.h" |
| 37 |
|
|
| 38 |
|
|
| 39 |
< |
static void mr_user(struct Client*, struct Client*, int, char**); |
| 39 |
> |
static void mr_user(struct Client *, struct Client *, int, char *[]); |
| 40 |
|
|
| 41 |
|
struct Message user_msgtab = { |
| 42 |
|
"USER", 0, 0, 5, 0, MFLG_SLOW, 0L, |
| 43 |
< |
{mr_user, m_registered, m_ignore, m_ignore, m_registered, m_ignore} |
| 43 |
> |
{ mr_user, m_registered, m_ignore, m_ignore, m_registered, m_ignore } |
| 44 |
|
}; |
| 45 |
|
|
| 46 |
|
#ifndef STATIC_MODULES |
| 59 |
|
const char *_version = "$Revision$"; |
| 60 |
|
#endif |
| 61 |
|
|
| 62 |
+ |
|
| 63 |
+ |
/* do_local_user() |
| 64 |
+ |
* |
| 65 |
+ |
* inputs - |
| 66 |
+ |
* output - NONE |
| 67 |
+ |
* side effects - |
| 68 |
+ |
*/ |
| 69 |
+ |
static void |
| 70 |
+ |
do_local_user(struct Client *source_p, |
| 71 |
+ |
const char *username, const char *host, const char *server, |
| 72 |
+ |
const char *realname) |
| 73 |
+ |
{ |
| 74 |
+ |
assert(source_p != NULL); |
| 75 |
+ |
assert(source_p->username != username); |
| 76 |
+ |
assert(IsUnknown(source_p)); |
| 77 |
+ |
|
| 78 |
+ |
source_p->localClient->registration &= ~REG_NEED_USER; |
| 79 |
+ |
|
| 80 |
+ |
/* |
| 81 |
+ |
* don't take the clients word for it, ever |
| 82 |
+ |
*/ |
| 83 |
+ |
source_p->servptr = &me; |
| 84 |
+ |
|
| 85 |
+ |
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
| 86 |
+ |
|
| 87 |
+ |
/* stash for later */ |
| 88 |
+ |
strlcpy(source_p->localClient->client_host, host, sizeof(source_p->localClient->client_host)); |
| 89 |
+ |
strlcpy(source_p->localClient->client_server, server, sizeof(source_p->localClient->client_server)); |
| 90 |
+ |
|
| 91 |
+ |
if (!IsGotId(source_p)) |
| 92 |
+ |
strlcpy(source_p->username, username, sizeof(source_p->username)); |
| 93 |
+ |
|
| 94 |
+ |
if (!source_p->localClient->registration) |
| 95 |
+ |
register_local_user(source_p); |
| 96 |
+ |
} |
| 97 |
+ |
|
| 98 |
|
/* |
| 99 |
|
** mr_user |
| 100 |
|
** parv[0] = sender prefix |
| 107 |
|
mr_user(struct Client *client_p, struct Client *source_p, |
| 108 |
|
int parc, char *parv[]) |
| 109 |
|
{ |
| 110 |
< |
char *p; |
| 110 |
> |
char *p = NULL; |
| 111 |
> |
|
| 112 |
> |
if (source_p->localClient->listener->flags & LISTENER_SERVER) |
| 113 |
> |
{ |
| 114 |
> |
exit_client(source_p, &me, "Use a different port"); |
| 115 |
> |
return; |
| 116 |
> |
} |
| 117 |
|
|
| 118 |
< |
if ((p = strchr(parv[1],'@')) != NULL) |
| 118 |
> |
if ((p = strchr(parv[1], '@')) != NULL) |
| 119 |
|
*p = '\0'; |
| 120 |
|
|
| 121 |
< |
if (*parv[4] == '\0') |
| 121 |
> |
if (EmptyString(parv[4])) |
| 122 |
|
{ |
| 123 |
< |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
| 124 |
< |
me.name, EmptyString(parv[0]) ? "*" : parv[0], "USER"); |
| 123 |
> |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, |
| 124 |
> |
source_p->name[0] ? source_p->name : "*", "USER"); |
| 125 |
|
return; |
| 126 |
|
} |
| 127 |
|
|
| 128 |
< |
do_local_user(parv[0], client_p, source_p, |
| 128 |
> |
do_local_user(source_p, |
| 129 |
|
parv[1], /* username */ |
| 130 |
|
parv[2], /* host */ |
| 131 |
|
parv[3], /* server */ |