From 30a5cdc2a3088995a6ab1521d6b97715ec0a36f5 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 28 Feb 2020 10:18:47 +0100 Subject: Refactor connector creation logic --- connector/irc/config.go | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'connector/irc') diff --git a/connector/irc/config.go b/connector/irc/config.go index 26d9a63..33469ed 100644 --- a/connector/irc/config.go +++ b/connector/irc/config.go @@ -5,28 +5,31 @@ import ( ) func init() { - Register("irc", ConfigSchema{ - &ConfigEntry{ - Name: "nick", - Description: "Nickname", - Required: true, - }, - &ConfigEntry{ - Name: "server", - Description: "Server", - Required: true, - }, - &ConfigEntry{ - Name: "port", - Description: "Port", - IsNumeric: true, - Default: "6667", - }, - &ConfigEntry{ - Name: "ssl", - Description: "Use SSL", - IsBoolean: true, - Default: "false", + Register("irc", Protocol{ + NewConnector: func() Connector { return &IRC{} }, + Schema: ConfigSchema{ + &ConfigEntry{ + Name: "nick", + Description: "Nickname", + Required: true, + }, + &ConfigEntry{ + Name: "server", + Description: "Server", + Required: true, + }, + &ConfigEntry{ + Name: "port", + Description: "Port", + IsNumeric: true, + Default: "6667", + }, + &ConfigEntry{ + Name: "ssl", + Description: "Use SSL", + IsBoolean: true, + Default: "false", + }, }, }) } -- cgit v1.2.3