summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-20 21:18:15 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-20 21:18:15 +0200
commit0260fcd02ef0ea7c7538099c398d2a2161f3d856 (patch)
tree141c1fc66b6760798b3958ed1c56925b50b30163
parent4016c387f805f7d5bf9917837d6ac6f3261bf358 (diff)
downloadxK-0260fcd02ef0ea7c7538099c398d2a2161f3d856.tar.gz
xK-0260fcd02ef0ea7c7538099c398d2a2161f3d856.tar.xz
xK-0260fcd02ef0ea7c7538099c398d2a2161f3d856.zip
degesch: add support for server passwords
-rw-r--r--degesch.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index b5fc556..021b5ed 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1319,6 +1319,10 @@ static struct config_schema g_config_server[] =
.comment = "Addresses of the IRC network (e.g. \"irc.net:6667\")",
.type = CONFIG_ITEM_STRING_ARRAY,
.validate = config_validate_addresses },
+ { .name = "password",
+ .comment = "Password to connect to the server, if any",
+ .type = CONFIG_ITEM_STRING,
+ .validate = config_validate_nonjunk_string },
{ .name = "ssl",
.comment = "Whether to use SSL/TLS",
@@ -3314,6 +3318,10 @@ irc_register (struct server *s)
const char *realname = get_config_string (s->config, "realname");
hard_assert (nickname && username && realname);
+ const char *password = get_config_string (s->config, "password");
+ if (password)
+ irc_send (s, "PASS :%s", password);
+
irc_send (s, "NICK %s", nickname);
// IRC servers may ignore the last argument if it's empty
irc_send (s, "USER %s 8 * :%s", username, *realname ? realname : " ");