1 |
/* |
2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
* m_nburst.c: Requests that a nick be burst to a lazylink. |
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 "tools.h" |
27 |
#include "channel.h" |
28 |
#include "client.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 "s_user.h" |
37 |
#include "send.h" |
38 |
#include "msg.h" |
39 |
#include "handlers.h" |
40 |
#include "parse.h" |
41 |
#include "modules.h" |
42 |
#include "s_conf.h" |
43 |
|
44 |
|
45 |
static void ms_nburst(struct Client*, struct Client*, int, char**); |
46 |
|
47 |
struct Message nburst_msgtab = { |
48 |
"NBURST", 0, 0, 1, 0, MFLG_SLOW | MFLG_UNREG, 0L, |
49 |
{m_unregistered, m_ignore, ms_nburst, m_ignore, m_ignore, m_ignore} |
50 |
}; |
51 |
#ifndef STATIC_MODULES |
52 |
|
53 |
void |
54 |
_modinit(void) |
55 |
{ |
56 |
mod_add_cmd(&nburst_msgtab); |
57 |
} |
58 |
|
59 |
void |
60 |
_moddeinit(void) |
61 |
{ |
62 |
mod_del_cmd(&nburst_msgtab); |
63 |
} |
64 |
|
65 |
const char *_version = "$Revision$"; |
66 |
#endif |
67 |
/* |
68 |
** m_nburst |
69 |
** parv[0] = sender prefix |
70 |
** parv[1] = nickname to burst |
71 |
** parv[2] = new nick (optional) |
72 |
** parv[3] = old nick (optional) |
73 |
*/ |
74 |
/* |
75 |
* This function will "burst" the given channel onto |
76 |
* the given LL capable server. |
77 |
*/ |
78 |
|
79 |
static void |
80 |
ms_nburst(struct Client *client_p, struct Client *source_p, |
81 |
int parc, char *parv[]) |
82 |
{ |
83 |
char *nick; |
84 |
char *nick_new = NULL; |
85 |
char *nick_old = NULL; |
86 |
struct Client *target_p; |
87 |
char status; |
88 |
|
89 |
if (parc < 2 || *parv[1] == '\0') |
90 |
return; |
91 |
|
92 |
nick = parv[1]; |
93 |
|
94 |
if (parc > 2) |
95 |
nick_new = parv[2]; |
96 |
|
97 |
if (parc > 3) |
98 |
nick_old = parv[3]; |
99 |
|
100 |
if (!ServerInfo.hub && IsCapable(client_p, CAP_LL)) |
101 |
return; |
102 |
#ifdef DEBUGLL |
103 |
sendto_realops_flags(UMODE_ALL, L_ALL, "NBURST called by %s for %s %s %s", |
104 |
client_p->name, |
105 |
nick, |
106 |
nick_new ? nick_new : "", |
107 |
nick_old ? nick_old : "" ); |
108 |
#endif |
109 |
|
110 |
status = 'N'; |
111 |
if ((target_p = find_client(nick)) != NULL) |
112 |
{ |
113 |
/* nick exists. burst nick back to leaf */ |
114 |
status = 'Y'; |
115 |
client_burst_if_needed(client_p, target_p); |
116 |
} |
117 |
|
118 |
/* Send back LLNICK, if wanted */ |
119 |
if (parc > 2) |
120 |
sendto_one(client_p, ":%s LLNICK %c %s %s", me.name, status, nick_new, |
121 |
(nick_old ? nick_old : "")); |
122 |
} |