summaryrefslogtreecommitdiffstats
path: root/bridge/irc/irc.go
diff options
context:
space:
mode:
authorIris Morelle <shadowm@wesnoth.org>2021-10-16 18:59:39 -0300
committerGitHub <noreply@github.com>2021-10-16 23:59:39 +0200
commit61bab22dde8e3abd2e1cbeb57d1f7a8d28ef95f8 (patch)
treef3540819575e7e37385cf427563bbd4591e8bffb /bridge/irc/irc.go
parent6dcc23ebb6db970994cc26ad805b7d30a037ca14 (diff)
downloadmatterbridge-msglm-61bab22dde8e3abd2e1cbeb57d1f7a8d28ef95f8.tar.gz
matterbridge-msglm-61bab22dde8e3abd2e1cbeb57d1f7a8d28ef95f8.tar.bz2
matterbridge-msglm-61bab22dde8e3abd2e1cbeb57d1f7a8d28ef95f8.zip
Add UserName and RealName options for IRC (#1590)
This allows setting custom values for the IRC username/ident and real name (gecos) fields at server registration time with gIRC. Co-authored-by: Wim <wim@42.be>
Diffstat (limited to 'bridge/irc/irc.go')
-rw-r--r--bridge/irc/irc.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index e54f8030..ac8222c6 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -271,8 +271,11 @@ func (b *Birc) getClient() (*girc.Client, error) {
if err != nil {
return nil, err
}
+ user := b.GetString("UserName")
+ if user == "" {
+ user = b.GetString("Nick")
+ }
// fix strict user handling of girc
- user := b.GetString("Nick")
for !girc.IsValidUser(user) {
if len(user) == 1 || len(user) == 0 {
user = "matterbridge"
@@ -280,6 +283,10 @@ func (b *Birc) getClient() (*girc.Client, error) {
}
user = user[1:]
}
+ realName := b.GetString("RealName")
+ if realName == "" {
+ realName = b.GetString("Nick")
+ }
debug := ioutil.Discard
if b.GetInt("DebugLevel") == 2 {
@@ -299,7 +306,7 @@ func (b *Birc) getClient() (*girc.Client, error) {
Port: port,
Nick: b.GetString("Nick"),
User: user,
- Name: b.GetString("Nick"),
+ Name: realName,
SSL: b.GetBool("UseTLS"),
TLSConfig: &tls.Config{InsecureSkipVerify: b.GetBool("SkipTLSVerify"), ServerName: server}, //nolint:gosec
PingDelay: pingDelay,