1 |
adx |
30 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* m_cburst.c: Bursts a channel to a lazy-link from the hub. |
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 "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" /* captab, send_channel_burst */ |
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 |
|
|
|
43 |
|
|
|
44 |
|
|
static void ms_cburst(struct Client*, struct Client*, int, char**); |
45 |
|
|
|
46 |
|
|
struct Message cburst_msgtab = { |
47 |
|
|
"CBURST", 0, 0, 1, 0, MFLG_SLOW | MFLG_UNREG, 0L, |
48 |
|
|
{m_unregistered, m_ignore, ms_cburst, m_ignore, m_ignore, m_ignore} |
49 |
|
|
}; |
50 |
|
|
#ifndef STATIC_MODULES |
51 |
|
|
void |
52 |
|
|
_modinit(void) |
53 |
|
|
{ |
54 |
|
|
mod_add_cmd(&cburst_msgtab); |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
void |
58 |
|
|
_moddeinit(void) |
59 |
|
|
{ |
60 |
|
|
mod_del_cmd(&cburst_msgtab); |
61 |
|
|
} |
62 |
|
|
|
63 |
knight |
31 |
const char *_version = "$Revision$"; |
64 |
adx |
30 |
#endif |
65 |
|
|
|
66 |
|
|
/* |
67 |
|
|
** m_cburst |
68 |
|
|
** parv[0] = sender prefix |
69 |
|
|
** parv[1] = channel |
70 |
|
|
** parv[2] = nick if present (!nick indicates cjoin) |
71 |
|
|
** parv[3] = channel key (EVENTUALLY) |
72 |
|
|
*/ |
73 |
|
|
/* |
74 |
|
|
* This function will "burst" the given channel onto |
75 |
|
|
* the given LL capable server. |
76 |
|
|
*/ |
77 |
|
|
|
78 |
|
|
static void |
79 |
|
|
ms_cburst(struct Client *client_p, struct Client *source_p, |
80 |
|
|
int parc, char *parv[]) |
81 |
|
|
{ |
82 |
|
|
char *name; |
83 |
|
|
char *nick; |
84 |
|
|
const char *key; |
85 |
|
|
struct Channel *chptr; |
86 |
|
|
|
87 |
|
|
if (parc < 2 || *parv[1] == '\0' ) |
88 |
|
|
return; |
89 |
|
|
|
90 |
|
|
name = parv[1]; |
91 |
|
|
|
92 |
|
|
if (parc > 2) |
93 |
|
|
nick = parv[2]; |
94 |
|
|
else |
95 |
|
|
nick = NULL; |
96 |
|
|
|
97 |
|
|
if (parc > 3) |
98 |
|
|
key = parv[3]; |
99 |
|
|
else |
100 |
|
|
key = ""; |
101 |
|
|
|
102 |
|
|
#ifdef DEBUGLL |
103 |
|
|
sendto_realops_flags(UMODE_ALL, L_ALL, "CBURST called by %s for %s %s %s", |
104 |
|
|
client_p->name, name, nick ? nick : "", key ? key : ""); |
105 |
|
|
#endif |
106 |
|
|
if ((chptr = hash_find_channel(name)) == NULL) |
107 |
|
|
{ |
108 |
|
|
if ((!nick) || (nick && *nick != '!')) |
109 |
|
|
{ |
110 |
|
|
chptr = get_or_create_channel(source_p, name, NULL); |
111 |
|
|
chptr->channelts = (time_t)(-1); /* highest possible TS so its always |
112 |
|
|
* over-ruled |
113 |
|
|
*/ |
114 |
|
|
} |
115 |
|
|
else if(nick && *nick=='!') |
116 |
|
|
{ |
117 |
|
|
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), |
118 |
|
|
me.name, nick+1, name); |
119 |
|
|
return; |
120 |
|
|
} |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
if (IsCapable(client_p,CAP_LL)) |
124 |
|
|
{ |
125 |
|
|
burst_channel(client_p,chptr); |
126 |
|
|
|
127 |
|
|
if (nick) |
128 |
|
|
sendto_one(client_p, ":%s LLJOIN %s %s %s", |
129 |
|
|
me.name, name, nick, key); |
130 |
|
|
} |
131 |
|
|
else |
132 |
|
|
{ |
133 |
|
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
134 |
|
|
"*** CBURST request received from non LL capable server! [%s]", |
135 |
|
|
client_p->name); |
136 |
|
|
} |
137 |
|
|
} |