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