2 * ircd-ratbox: A slightly useful ircd.
3 * m_user.c: Sends username information.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * $Id: m_user.c 26 2006-09-20 18:02:06Z spb $
29 #include "irc_string.h"
38 #include "sprintf_irc.h"
39 #include "blacklist.h"
41 #define UFLAGS (FLAGS_INVISIBLE|FLAGS_WALLOP|FLAGS_SERVNOTICE)
43 static int mr_user(struct Client
*, struct Client
*, int, const char **);
45 struct Message user_msgtab
= {
46 "USER", 0, 0, 0, MFLG_SLOW
,
47 {{mr_user
, 5}, mg_reg
, mg_ignore
, mg_ignore
, mg_ignore
, mg_reg
}
50 mapi_clist_av1 user_clist
[] = { &user_msgtab
, NULL
};
51 DECLARE_MODULE_AV1(user
, NULL
, NULL
, user_clist
, NULL
, NULL
, "$Revision: 26 $");
53 static int do_local_user(struct Client
*client_p
, struct Client
*source_p
,
54 const char *username
, const char *realname
);
57 * parv[1] = username (login name, account)
58 * parv[2] = client host name (ignored)
59 * parv[3] = server host name (ignored)
60 * parv[4] = users gecos
63 mr_user(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
65 static char buf
[BUFSIZE
];
68 if (strlen(client_p
->id
) == 3)
70 exit_client(client_p
, client_p
, client_p
, "Mixing client and server protocol");
74 if((p
= strchr(parv
[1], '@')))
77 ircsnprintf(buf
, sizeof(buf
), "%s %s", parv
[2], parv
[3]);
78 MyFree(source_p
->localClient
->fullcaps
);
79 DupString(source_p
->localClient
->fullcaps
, buf
);
81 do_local_user(client_p
, source_p
, parv
[1], parv
[4]);
86 do_local_user(struct Client
*client_p
, struct Client
*source_p
,
87 const char *username
, const char *realname
)
91 s_assert(NULL
!= source_p
);
92 s_assert(source_p
->username
!= username
);
94 user
= make_user(source_p
);
95 user
->server
= me
.name
;
97 if (!(source_p
->flags
& FLAGS_SENTUSER
))
99 lookup_blacklists(source_p
);
100 source_p
->flags
|= FLAGS_SENTUSER
;
103 strlcpy(source_p
->info
, realname
, sizeof(source_p
->info
));
105 if(!IsGotId(source_p
))
107 /* This is in this location for a reason..If there is no identd
108 * and ping cookies are enabled..we need to have a copy of this
110 strlcpy(source_p
->username
, username
, sizeof(source_p
->username
));
113 if(source_p
->name
[0])
115 /* NICK already received, now I have USER... */
116 return register_local_user(client_p
, source_p
, username
);