ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/modules/m_llnick.c
Revision: 32
Committed: Sun Oct 2 20:41:23 2005 UTC (20 years, 10 months ago) by knight
Content type: text/x-csrc
Original Path: ircd-hybrid/modules/m_llnick.c
File size: 3430 byte(s)
Log Message:
- svn:keywords

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

Properties

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