+ 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);