diff --git a/README.md b/README.md index ef33ed3..90c2f4f 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,6 @@ The config file is a yaml formatted file with the following fields: | `no_tls`, | Yes | false | Yes | turns off TLS | | `cooldown_duration` | No | 86400 (24 hours) | Yes | time in seconds for a discord user to be offline before it's puppet disconnects from irc | | `show_joinquit` | No | false | yes | displays JOIN, PART, QUIT, KICK on discord | -| `max_nick_length` | No | 30 | yes | Maximum allowed nick length | | `ignored_irc_hostmasks` | No | | Yes | A list of IRC users identified by hostmask to not relay to Discord, uses matching syntax as in [glob](https://github.com/gobwas/glob) | | `connection_limit` | Yes | 0 | Yes | How many connections to IRC (including our listener) to spawn (limit of 0 or less means unlimited) | diff --git a/bridge/bridge.go b/bridge/bridge.go index ab660fb..d7084a4 100644 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -64,9 +64,6 @@ type Config struct { // ShowJoinQuit determines whether or not to show JOIN, QUIT, KICK messages on Discord ShowJoinQuit bool - // Maximum Nicklength for irc server - MaxNickLength int - Debug bool DebugPresence bool } diff --git a/bridge/irc_manager.go b/bridge/irc_manager.go index 6d5b5a1..5a032ba 100644 --- a/bridge/irc_manager.go +++ b/bridge/irc_manager.go @@ -303,7 +303,7 @@ func (m *IRCManager) generateNickname(discord DiscordUser) string { suffix := m.bridge.Config.Suffix newNick := nick + suffix - useFallback := len(newNick) > m.bridge.Config.MaxNickLength || m.bridge.ircListener.DoesUserExist(newNick) + useFallback := len(newNick) > int(m.bridge.ircListener.NickLength()) || m.bridge.ircListener.DoesUserExist(newNick) // log.WithFields(log.Fields{ // "length": len(newNick) > ircnick.MAXLENGTH, // "useFallback": useFallback, diff --git a/config.yml b/config.yml index f8d823b..4a328c2 100644 --- a/config.yml +++ b/config.yml @@ -24,7 +24,6 @@ webirc_pass: abcdef.ghijk.lmnop show_joinquit: false # displays JOIN, PART, QUIT, KICK on discord cooldown_duration: 86400 # optional, default 86400 (24 hours), time in seconds for a discord user to be offline before it's puppet disconnects from irc -max_nick_length: 30 # Maximum Length of a nick allowed # You definitely should restart the bridge after changing the following: insecure: false diff --git a/main.go b/main.go index a89eda8..4861726 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,6 @@ import ( "github.com/gobwas/glob" "github.com/pkg/errors" "github.com/qaisjp/go-discord-irc/bridge" - ircnick "github.com/qaisjp/go-discord-irc/irc/nick" log "github.com/sirupsen/logrus" "github.com/spf13/viper" ) @@ -119,9 +118,10 @@ func main() { // viper.SetDefault("show_joinquit", false) showJoinQuit := viper.GetBool("show_joinquit") - // Maximum length of user nicks aloud - viper.SetDefault("max_nick_length", ircnick.MAXLENGTH) - maxNickLength := viper.GetInt("max_nick_length") + + if viper.GetInt("max_nick_length") != 0 { + log.Println("This field should be removed from your configuration - go-discord-irc now detects the proper max accepted nick length at runtime.") + } if webIRCPass == "" { log.Warnln("webirc_pass is empty") @@ -167,7 +167,6 @@ func main() { ChannelMappings: channelMappings, CooldownDuration: time.Second * time.Duration(cooldownDuration), ShowJoinQuit: showJoinQuit, - MaxNickLength: maxNickLength, Debug: *debugMode, DebugPresence: *debugPresence,