From: Jochen Eisinger Date: Sun, 11 Mar 2007 16:44:12 +0000 (+0000) Subject: Sun Mar 11 17:43:18 CET 2007 Jochen Eisinger X-Git-Tag: 1.2.beta1~415 X-Git-Url: http://git.silcnet.org/gitweb/?p=crypto.git;a=commitdiff_plain;h=baca62b1660fbd8a2bf2aa9ee2f4e602794f86a6 Sun Mar 11 17:43:18 CET 2007 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 --- diff --git a/CHANGES b/CHANGES index 183039dd..e30615e3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +Sun Mar 11 17:43:18 CET 2007 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 Mar 11 15:22:42 CET 2007 Jochen Eisinger * Import perl script for sign_messages from silc-plugin. Affected diff --git a/apps/irssi/src/silc/core/silc-channels.c b/apps/irssi/src/silc/core/silc-channels.c index 5cc7807c..189b1c9a 100644 --- a/apps/irssi/src/silc/core/silc-channels.c +++ b/apps/irssi/src/silc/core/silc-channels.c @@ -111,7 +111,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++) { @@ -119,7 +122,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 && 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 b2317f8d..7f34ac9f 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" @@ -534,8 +535,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; + CHANNEL_SETUP_REC *schannel; - g_string_sprintfa(chans, "%s,", channel->name); + 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)