ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_user.c
Revision: 2189
Committed: Tue Jun 4 12:45:38 2013 UTC (13 years, 1 month ago) by michael
Content type: text/x-csrc
File size: 3325 byte(s)
Log Message:
- Removed Client::client_host and Client::client_server members

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_user.c: Sends username information.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "client.h"
27 #include "irc_string.h"
28 #include "ircd.h"
29 #include "numeric.h"
30 #include "s_user.h"
31 #include "send.h"
32 #include "parse.h"
33 #include "modules.h"
34 #include "listener.h"
35
36
37 /* do_local_user()
38 *
39 * inputs -
40 * output - NONE
41 * side effects -
42 */
43 static void
44 do_local_user(struct Client *source_p,
45 const char *username, const char *host, const char *server,
46 const char *realname)
47 {
48 assert(source_p != NULL);
49 assert(source_p->username != username);
50 assert(IsUnknown(source_p));
51
52 source_p->localClient->registration &= ~REG_NEED_USER;
53
54 /*
55 * don't take the clients word for it, ever
56 */
57 source_p->servptr = &me;
58
59 strlcpy(source_p->info, realname, sizeof(source_p->info));
60
61 if (!IsGotId(source_p))
62 strlcpy(source_p->username, username, sizeof(source_p->username));
63
64 if (!source_p->localClient->registration)
65 register_local_user(source_p);
66 }
67
68 /*
69 ** mr_user
70 ** parv[0] = sender prefix
71 ** parv[1] = username (login name, account)
72 ** parv[2] = client host name (used only from other servers)
73 ** parv[3] = server host name (used only from other servers)
74 ** parv[4] = users real name info
75 */
76 static void
77 mr_user(struct Client *client_p, struct Client *source_p,
78 int parc, char *parv[])
79 {
80 char *p = NULL;
81
82 if (source_p->localClient->listener->flags & LISTENER_SERVER)
83 {
84 exit_client(source_p, &me, "Use a different port");
85 return;
86 }
87
88 if ((p = strchr(parv[1], '@')) != NULL)
89 *p = '\0';
90
91 if (EmptyString(parv[4]))
92 {
93 sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name,
94 source_p->name[0] ? source_p->name : "*", "USER");
95 return;
96 }
97
98 do_local_user(source_p,
99 parv[1], /* username */
100 parv[2], /* host */
101 parv[3], /* server */
102 parv[4] /* users real name */ );
103 }
104
105 static struct Message user_msgtab = {
106 "USER", 0, 0, 5, MAXPARA, MFLG_SLOW, 0,
107 { mr_user, m_registered, m_ignore, m_ignore, m_registered, m_ignore }
108 };
109
110 static void
111 module_init(void)
112 {
113 mod_add_cmd(&user_msgtab);
114 }
115
116 static void
117 module_exit(void)
118 {
119 mod_del_cmd(&user_msgtab);
120 }
121
122 struct module module_entry = {
123 .node = { NULL, NULL, NULL },
124 .name = NULL,
125 .version = "$Revision$",
126 .handle = NULL,
127 .modinit = module_init,
128 .modexit = module_exit,
129 .flags = 0
130 };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision