2000-09-02 18:53:58 +00:00
|
|
|
/*
|
|
|
|
|
fe-irc-channels.c : irssi
|
|
|
|
|
|
|
|
|
|
Copyright (C) 1999-2000 Timo Sirainen
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
2007-05-08 18:41:10 +00:00
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-09-02 18:53:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "module.h"
|
2000-10-14 00:45:16 +00:00
|
|
|
#include "module-formats.h"
|
2000-09-02 18:53:58 +00:00
|
|
|
#include "signals.h"
|
2000-10-14 00:45:16 +00:00
|
|
|
#include "levels.h"
|
2000-09-02 18:53:58 +00:00
|
|
|
|
2001-12-20 02:14:49 +00:00
|
|
|
#include "irc-servers.h"
|
2001-12-09 17:13:10 +00:00
|
|
|
#include "irc-channels.h"
|
2000-10-14 00:45:16 +00:00
|
|
|
#include "channel-rejoin.h"
|
|
|
|
|
|
2000-10-28 20:14:19 +00:00
|
|
|
#include "printtext.h"
|
2001-12-09 17:13:10 +00:00
|
|
|
#include "fe-windows.h"
|
|
|
|
|
#include "window-items.h"
|
2000-10-28 20:14:19 +00:00
|
|
|
|
2001-11-02 01:05:14 +00:00
|
|
|
static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec)
|
2000-10-14 00:45:16 +00:00
|
|
|
{
|
|
|
|
|
g_return_if_fail(rec != NULL);
|
|
|
|
|
|
|
|
|
|
printformat(server, NULL, MSGLEVEL_CLIENTNOTICE,
|
|
|
|
|
IRCTXT_CHANNEL_REJOIN, rec->channel);
|
|
|
|
|
}
|
2000-09-02 18:53:58 +00:00
|
|
|
|
2007-07-08 16:44:35 +00:00
|
|
|
static void sig_event_forward(SERVER_REC *server, const char *data,
|
|
|
|
|
const char *nick)
|
2001-12-09 17:13:10 +00:00
|
|
|
{
|
|
|
|
|
IRC_CHANNEL_REC *channel;
|
|
|
|
|
char *params, *from, *to;
|
|
|
|
|
|
|
|
|
|
params = event_get_params(data, 3, NULL, &from, &to);
|
2015-05-15 16:42:51 +02:00
|
|
|
if (from != NULL && to != NULL && server_ischannel(server, *from) && server_ischannel(server, *to)) {
|
2007-07-08 16:44:35 +00:00
|
|
|
channel = irc_channel_find(server, from);
|
|
|
|
|
if (channel != NULL && irc_channel_find(server, to) == NULL) {
|
|
|
|
|
window_bind_add(window_item_window(channel),
|
|
|
|
|
server->tag, to);
|
|
|
|
|
}
|
2001-12-09 17:13:10 +00:00
|
|
|
}
|
|
|
|
|
g_free(params);
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-02 18:53:58 +00:00
|
|
|
void fe_irc_channels_init(void)
|
|
|
|
|
{
|
2000-10-14 00:45:16 +00:00
|
|
|
signal_add("channel rejoin new", (SIGNAL_FUNC) sig_channel_rejoin);
|
2007-07-08 16:44:35 +00:00
|
|
|
signal_add_first("event 470", (SIGNAL_FUNC) sig_event_forward);
|
2000-09-02 18:53:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void fe_irc_channels_deinit(void)
|
|
|
|
|
{
|
2000-10-14 00:45:16 +00:00
|
|
|
signal_remove("channel rejoin new", (SIGNAL_FUNC) sig_channel_rejoin);
|
2007-07-08 16:44:35 +00:00
|
|
|
signal_remove("event 470", (SIGNAL_FUNC) sig_event_forward);
|
2000-09-02 18:53:58 +00:00
|
|
|
}
|