ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/releases/8.1.0beta5/modules/m_user.c
Revision: 2052
Committed: Wed May 15 18:37:38 2013 UTC (12 years, 3 months ago) by michael
Content type: text/x-csrc
File size: 3550 byte(s)
Log Message:
RELEASE TAG 8.1.0beta5

File Contents

# User Rev Content
1 adx 30 /*
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 knight 31 * $Id$
23 adx 30 */
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 michael 900 #include "listener.h"
35 adx 30
36    
37 michael 1082 /* 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     /* stash for later */
62 michael 1113 strlcpy(source_p->localClient->client_host, host, sizeof(source_p->localClient->client_host));
63     strlcpy(source_p->localClient->client_server, server, sizeof(source_p->localClient->client_server));
64 michael 1082
65     if (!IsGotId(source_p))
66     strlcpy(source_p->username, username, sizeof(source_p->username));
67    
68     if (!source_p->localClient->registration)
69     register_local_user(source_p);
70     }
71    
72 adx 30 /*
73     ** mr_user
74     ** parv[0] = sender prefix
75     ** parv[1] = username (login name, account)
76     ** parv[2] = client host name (used only from other servers)
77     ** parv[3] = server host name (used only from other servers)
78     ** parv[4] = users real name info
79     */
80     static void
81     mr_user(struct Client *client_p, struct Client *source_p,
82     int parc, char *parv[])
83     {
84 michael 1113 char *p = NULL;
85 adx 30
86 michael 900 if (source_p->localClient->listener->flags & LISTENER_SERVER)
87     {
88     exit_client(source_p, &me, "Use a different port");
89     return;
90     }
91    
92     if ((p = strchr(parv[1], '@')) != NULL)
93 adx 30 *p = '\0';
94    
95 michael 900 if (EmptyString(parv[4]))
96 adx 30 {
97 michael 1834 sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name,
98 michael 900 source_p->name[0] ? source_p->name : "*", "USER");
99 adx 30 return;
100     }
101    
102 michael 1080 do_local_user(source_p,
103 adx 30 parv[1], /* username */
104     parv[2], /* host */
105     parv[3], /* server */
106     parv[4] /* users real name */ );
107     }
108 michael 1230
109     static struct Message user_msgtab = {
110     "USER", 0, 0, 5, MAXPARA, MFLG_SLOW, 0,
111     { mr_user, m_registered, m_ignore, m_ignore, m_registered, m_ignore }
112     };
113    
114     static void
115     module_init(void)
116     {
117     mod_add_cmd(&user_msgtab);
118     }
119    
120     static void
121     module_exit(void)
122     {
123     mod_del_cmd(&user_msgtab);
124     }
125    
126     struct module module_entry = {
127     .node = { NULL, NULL, NULL },
128     .name = NULL,
129     .version = "$Revision$",
130     .handle = NULL,
131     .modinit = module_init,
132     .modexit = module_exit,
133     .flags = 0
134     };

Properties

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