ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_user.c
(Generate patch)

Comparing:
ircd-hybrid/modules/m_user.c (file contents), Revision 33 by knight, Sun Oct 2 20:50:00 2005 UTC vs.
ircd-hybrid/trunk/modules/m_user.c (file contents), Revision 1592 by michael, Sat Oct 27 21:02:32 2012 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 – #include "handlers.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"
33 – #include "s_conf.h"
34 – #include "msg.h"
32   #include "parse.h"
33   #include "modules.h"
34 + #include "listener.h"
35  
36  
37 < static void mr_user(struct Client*, struct Client*, int, char**);
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 < 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}
44 < };
52 >  source_p->localClient->registration &= ~REG_NEED_USER;
53  
54 < #ifndef STATIC_MODULES
55 < void
56 < _modinit(void)
57 < {
50 <  mod_add_cmd(&user_msgtab);
51 < }
54 >  /*
55 >   * don't take the clients word for it, ever
56 >   */
57 >  source_p->servptr = &me;
58  
59 < void
60 < _moddeinit(void)
61 < {
62 <  mod_del_cmd(&user_msgtab);
63 < }
59 >  strlcpy(source_p->info, realname, sizeof(source_p->info));
60 >
61 >  /* stash for later */
62 >  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 >
65 >  if (!IsGotId(source_p))
66 >    strlcpy(source_p->username, username, sizeof(source_p->username));
67  
68 < const char *_version = "$Revision$";
69 < #endif
68 >  if (!source_p->localClient->registration)
69 >    register_local_user(source_p);
70 > }
71  
72   /*
73   ** mr_user
# Line 71 | Line 81 | static void
81   mr_user(struct Client *client_p, struct Client *source_p,
82          int parc, char *parv[])
83   {
84 <  char *p;
84 >  char *p = NULL;
85  
86 <  if ((p = strchr(parv[1],'@')) != NULL)
86 >  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      *p = '\0';
94  
95 <  if (*parv[4] == '\0')
95 >  if (EmptyString(parv[4]))
96    {
97 <    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
98 <               me.name, EmptyString(parv[0]) ? "*" : parv[0], "USER");
97 >    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name,
98 >               source_p->name[0] ? source_p->name : "*", "USER");
99      return;
100    }
101  
102 <  do_local_user(parv[0], client_p, source_p,
102 >  do_local_user(source_p,
103                  parv[1], /* username */
104                  parv[2], /* host     */
105                  parv[3], /* server   */
106                  parv[4]  /* users real name */ );
107   }
108 +
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 + };

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)