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/xmpp/config.go | 59 +++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'connector/xmpp') diff --git a/connector/xmpp/config.go b/connector/xmpp/config.go index a5306b4..a6abfac 100644 --- a/connector/xmpp/config.go +++ b/connector/xmpp/config.go @@ -5,34 +5,37 @@ import ( ) func init() { - Register("xmpp", ConfigSchema{ - &ConfigEntry{ - Name: "jid", - Description: "JID", - Required: true, - }, - &ConfigEntry{ - Name: "password", - Description: "Password", - Required: true, - IsPassword: true, - }, - &ConfigEntry{ - Name: "nickname", - Description: "Nickname in MUCs", - Required: true, - }, - &ConfigEntry{ - Name: "port", - Description: "Port", - IsNumeric: true, - Default: "5222", - }, - &ConfigEntry{ - Name: "ssl", - Description: "Use SSL", - IsBoolean: true, - Default: "true", + Register("xmpp", Protocol{ + NewConnector: func() Connector { return &XMPP{} }, + Schema: ConfigSchema{ + &ConfigEntry{ + Name: "jid", + Description: "JID", + Required: true, + }, + &ConfigEntry{ + Name: "password", + Description: "Password", + Required: true, + IsPassword: true, + }, + &ConfigEntry{ + Name: "nickname", + Description: "Nickname in MUCs", + Required: true, + }, + &ConfigEntry{ + Name: "port", + Description: "Port", + IsNumeric: true, + Default: "5222", + }, + &ConfigEntry{ + Name: "ssl", + Description: "Use SSL", + IsBoolean: true, + Default: "true", + }, }, }) } -- cgit v1.2.3