ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/modules/m_llnick.c
Revision: 98
Committed: Sun Oct 9 10:15:07 2005 UTC (20 years, 10 months ago) by michael
Content type: text/x-csrc
File size: 3397 byte(s)
Log Message:
- Moved llname to LocalUser struct

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3     * m_llnick.c: Used to introduce a client on a lazy-link.
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 "hash.h"
28     #include "common.h"
29     #include "hash.h"
30     #include "ircd.h"
31     #include "numeric.h"
32     #include "s_serv.h"
33     #include "send.h"
34     #include "handlers.h"
35     #include "msg.h"
36     #include "parse.h"
37     #include "modules.h"
38    
39    
40     static void ms_llnick(struct Client*, struct Client*, int, char**);
41    
42     struct Message llnick_msgtab = {
43     "LLNICK", 0, 0, 3, 0, MFLG_SLOW | MFLG_UNREG, 0L,
44     {m_unregistered, m_ignore, ms_llnick, m_ignore, m_ignore, m_ignore}
45     };
46     #ifndef STATIC_MODULES
47    
48     void
49     _modinit(void)
50     {
51     mod_add_cmd(&llnick_msgtab);
52     }
53    
54     void
55     _moddeinit(void)
56     {
57     mod_del_cmd(&llnick_msgtab);
58     }
59    
60 knight 31 const char *_version = "$Revision$";
61 adx 30 #endif
62     /*
63     * m_llnick
64     * parv[0] = sender prefix
65     * parv[1] = status
66     * parv[2] = nick
67     * parv[3] = old nick
68     *
69     */
70     static void
71     ms_llnick(struct Client *client_p, struct Client *source_p,
72     int parc, char *parv[])
73     {
74     char *nick;
75     char *nick_old = NULL;
76     struct Client *target_p = NULL;
77     int exists = 0;
78     int new = 0;
79     dlink_node *ptr;
80    
81     if(!IsCapable(client_p,CAP_LL) || !IsCapable(client_p, CAP_HUB))
82     {
83     sendto_realops_flags(UMODE_ALL, L_ALL,
84     "*** LLNICK requested from non LL server %s",
85     client_p->name);
86     return;
87     }
88    
89     if (parc < 4)
90     return;
91    
92     if (*parv[1] == 'Y')
93     exists = 1;
94    
95     nick = parv[2];
96     nick_old = parv[3];
97    
98     if (*nick_old == '!')
99     new = 1;
100    
101     if (new)
102     {
103     nick_old++; /* skip '!' */
104     /* New user -- find them */
105     DLINK_FOREACH(ptr, unknown_list.head)
106     {
107 michael 98 if (!strcmp(nick_old, ((struct Client *)ptr->data)->localClient->llname))
108 adx 30 {
109     target_p = ptr->data;
110 michael 98 target_p->localClient->llname[0] = '\0'; /* unset their temp-nick */
111 adx 30 break;
112     }
113     }
114 michael 98
115 adx 30 if (!target_p) /* Can't find them -- maybe they got a different nick */
116     return;
117     }
118     else
119     {
120     /* Existing user changing nickname */
121     target_p = find_client(nick_old);
122    
123     if (!target_p) /* Can't find them -- maybe they got a different nick */
124     return;
125     }
126    
127     /* Don't try this on a remote client... */
128     if (!MyConnect(target_p))
129     return;
130    
131     if(find_client(nick) || exists)
132     {
133     /* The nick they want is in use. complain */
134     sendto_one(target_p, form_str(ERR_NICKNAMEINUSE), me.name,
135     new ? "*" : nick_old,
136     nick);
137     return;
138     }
139    
140     if(new)
141     set_initial_nick(target_p, target_p, nick);
142     else
143     change_local_nick(target_p, target_p, nick);
144     }

Properties

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