From b78a12531828c2bc0f807a1da563eabd32276ff7 Mon Sep 17 00:00:00 2001 From: Jochen Eisinger Date: Tue, 3 Oct 2006 19:24:08 +0000 Subject: [PATCH] Tue Oct 3 21:22:00 CEST 2006 Jochen Eisinger * When joining channels with a password given in the config file, use it. Also use it when cycling (it would be better to get the password from the server, but this isn't possible in SILC). Affected files apps/irssi/src/silc/core/silc-servers.c, apps/irssi/src/silc/core/silc-channels.c --- CHANGES | 8 ++++++++ apps/irssi/src/silc/core/silc-channels.c | 23 ++++++++++++++++++++++- apps/irssi/src/silc/core/silc-servers.c | 11 +++++++++-- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index eb3f1721..cbd0df1c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +Tue Oct 3 21:22:00 CEST 2006 Jochen Eisinger + + * When joining channels with a password given in the config file, + use it. Also use it when cycling (it would be better to get + the password from the server, but this isn't possible in SILC). + Affected files apps/irssi/src/silc/core/silc-servers.c, + apps/irssi/src/silc/core/silc-channels.c + Sun Oct 1 20:39:34 CEST 2006 Jochen Eisinger * Always return a valid username. Affected file diff --git a/apps/irssi/src/silc/core/silc-channels.c b/apps/irssi/src/silc/core/silc-channels.c index 9c8028b5..160e86cb 100644 --- a/apps/irssi/src/silc/core/silc-channels.c +++ b/apps/irssi/src/silc/core/silc-channels.c @@ -113,7 +113,10 @@ static void silc_channels_join(SILC_SERVER_REC *server, const char *channels, int automatic) { char **list, **tmp; + char *channel, *key; SILC_CHANNEL_REC *chanrec; + CHANNEL_SETUP_REC *schannel; + GString *tmpstr; list = g_strsplit(channels, ",", -1); for (tmp = list; *tmp != NULL; tmp++) { @@ -121,7 +124,25 @@ static void silc_channels_join(SILC_SERVER_REC *server, if (chanrec) continue; - silc_command_exec(server, "JOIN", *tmp); + channel = *tmp; + key = strchr(channel, ' '); + if (key != NULL) { + *key = '\0'; + key++; + } + tmpstr = g_string_new(NULL); + + schannel = channel_setup_find(channel, server->connrec->chatnet); + if (key && *key != '\0') + g_string_sprintfa(tmpstr, "%s %s", channel, key); + else if (schannel->password && schannel->password[0] != '\0') + g_string_sprintfa(tmpstr, "%s %s", channel, schannel->password); + else + g_string_sprintfa(tmpstr, "%s", channel); + + silc_command_exec(server, "JOIN", tmpstr->str); + + g_string_free(tmpstr, FALSE); } g_strfreev(list); diff --git a/apps/irssi/src/silc/core/silc-servers.c b/apps/irssi/src/silc/core/silc-servers.c index 476205d4..dcaf1d65 100644 --- a/apps/irssi/src/silc/core/silc-servers.c +++ b/apps/irssi/src/silc/core/silc-servers.c @@ -33,6 +33,7 @@ #include "settings.h" #include "servers-setup.h" +#include "channels-setup.h" #include "client_ops.h" #include "silc-servers.h" @@ -399,8 +400,14 @@ char *silc_server_get_channels(SILC_SERVER_REC *server) chans = g_string_new(NULL); for (tmp = server->channels; tmp != NULL; tmp = tmp->next) { CHANNEL_REC *channel = tmp->data; - - g_string_sprintfa(chans, "%s,", channel->name); + CHANNEL_SETUP_REC *schannel; + + if ((schannel = channel_setup_find(channel->name, server->connrec->chatnet)) && + schannel->password) + g_string_sprintfa(chans, "%s %s,", channel->name, + schannel->password); + else + g_string_sprintfa(chans, "%s,", channel->name); } if (chans->len > 0) -- 2.24.0