summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@irssi.org>2007-07-08 16:44:35 +0000
committerjilles <jilles@dbcabf3a-b0e7-0310-adc4-f8d773084564>2007-07-08 16:44:35 +0000
commit3b72b51257803ec7cfd87e4120ac04823d9c6fd9 (patch)
treecab255a44556cdebe15d84c6b2b56d4134ed5371
parent131d92c4d36fb7d0a89150c65ea87f5274876c26 (diff)
downloadirssi-3b72b51257803ec7cfd87e4120ac04823d9c6fd9.zip
Update channel forwarding code.
This is now on numeric 470 instead of 379. It works with hyperion and charybdis, and puts the channel you were forwarded to in the window the original channel would be in. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4575 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/irc/fe-events-numeric.c2
-rw-r--r--src/fe-common/irc/fe-irc-channels.c17
2 files changed, 12 insertions, 7 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index 2bb9471c..40d05a75 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -666,6 +666,7 @@ void fe_events_numeric_init(void)
signal_add("event 438", (SIGNAL_FUNC) event_received);
signal_add("event 465", (SIGNAL_FUNC) event_received);
signal_add("event 439", (SIGNAL_FUNC) event_received);
+ signal_add("event 470", (SIGNAL_FUNC) event_received);
signal_add("event 479", (SIGNAL_FUNC) event_received);
signal_add("event 344", (SIGNAL_FUNC) event_target_received); /* reop list */
@@ -751,6 +752,7 @@ void fe_events_numeric_deinit(void)
signal_remove("event 438", (SIGNAL_FUNC) event_received);
signal_remove("event 465", (SIGNAL_FUNC) event_received);
signal_remove("event 439", (SIGNAL_FUNC) event_received);
+ signal_remove("event 470", (SIGNAL_FUNC) event_received);
signal_remove("event 479", (SIGNAL_FUNC) event_received);
signal_remove("event 344", (SIGNAL_FUNC) event_target_received);
diff --git a/src/fe-common/irc/fe-irc-channels.c b/src/fe-common/irc/fe-irc-channels.c
index 56efe9dd..e884aef4 100644
--- a/src/fe-common/irc/fe-irc-channels.c
+++ b/src/fe-common/irc/fe-irc-channels.c
@@ -39,16 +39,19 @@ static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec)
IRCTXT_CHANNEL_REJOIN, rec->channel);
}
-static void sig_event_forward(SERVER_REC *server, const char *data)
+static void sig_event_forward(SERVER_REC *server, const char *data,
+ const char *nick)
{
IRC_CHANNEL_REC *channel;
char *params, *from, *to;
params = event_get_params(data, 3, NULL, &from, &to);
- channel = irc_channel_find(server, from);
- if (channel != NULL) {
- window_bind_add(window_item_window(channel),
- server->tag, to);
+ if (from != NULL && to != NULL && ischannel(*from) && ischannel(*to)) {
+ 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);
+ }
}
g_free(params);
}
@@ -56,11 +59,11 @@ static void sig_event_forward(SERVER_REC *server, const char *data)
void fe_irc_channels_init(void)
{
signal_add("channel rejoin new", (SIGNAL_FUNC) sig_channel_rejoin);
- signal_add_first("event 379", (SIGNAL_FUNC) sig_event_forward);
+ signal_add_first("event 470", (SIGNAL_FUNC) sig_event_forward);
}
void fe_irc_channels_deinit(void)
{
signal_remove("channel rejoin new", (SIGNAL_FUNC) sig_channel_rejoin);
- signal_remove("event 379", (SIGNAL_FUNC) sig_event_forward);
+ signal_remove("event 470", (SIGNAL_FUNC) sig_event_forward);
}