forked from jshiffer/matterbridge
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>
This commit is contained in:
parent
6dcc23ebb6
commit
61bab22dde
@ -138,6 +138,7 @@ type Protocol struct {
|
|||||||
QuoteDisable bool // telegram
|
QuoteDisable bool // telegram
|
||||||
QuoteFormat string // telegram
|
QuoteFormat string // telegram
|
||||||
QuoteLengthLimit int // telegram
|
QuoteLengthLimit int // telegram
|
||||||
|
RealName string // IRC
|
||||||
RejoinDelay int // IRC
|
RejoinDelay int // IRC
|
||||||
ReplaceMessages [][]string // all protocols
|
ReplaceMessages [][]string // all protocols
|
||||||
ReplaceNicks [][]string // all protocols
|
ReplaceNicks [][]string // all protocols
|
||||||
@ -169,6 +170,7 @@ type Protocol struct {
|
|||||||
UseFirstName bool // telegram
|
UseFirstName bool // telegram
|
||||||
UseUserName bool // discord, matrix
|
UseUserName bool // discord, matrix
|
||||||
UseInsecureURL bool // telegram
|
UseInsecureURL bool // telegram
|
||||||
|
UserName string // IRC
|
||||||
VerboseJoinPart bool // IRC
|
VerboseJoinPart bool // IRC
|
||||||
WebhookBindAddress string // mattermost, slack
|
WebhookBindAddress string // mattermost, slack
|
||||||
WebhookURL string // mattermost, slack
|
WebhookURL string // mattermost, slack
|
||||||
|
@ -271,8 +271,11 @@ func (b *Birc) getClient() (*girc.Client, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
user := b.GetString("UserName")
|
||||||
|
if user == "" {
|
||||||
|
user = b.GetString("Nick")
|
||||||
|
}
|
||||||
// fix strict user handling of girc
|
// fix strict user handling of girc
|
||||||
user := b.GetString("Nick")
|
|
||||||
for !girc.IsValidUser(user) {
|
for !girc.IsValidUser(user) {
|
||||||
if len(user) == 1 || len(user) == 0 {
|
if len(user) == 1 || len(user) == 0 {
|
||||||
user = "matterbridge"
|
user = "matterbridge"
|
||||||
@ -280,6 +283,10 @@ func (b *Birc) getClient() (*girc.Client, error) {
|
|||||||
}
|
}
|
||||||
user = user[1:]
|
user = user[1:]
|
||||||
}
|
}
|
||||||
|
realName := b.GetString("RealName")
|
||||||
|
if realName == "" {
|
||||||
|
realName = b.GetString("Nick")
|
||||||
|
}
|
||||||
|
|
||||||
debug := ioutil.Discard
|
debug := ioutil.Discard
|
||||||
if b.GetInt("DebugLevel") == 2 {
|
if b.GetInt("DebugLevel") == 2 {
|
||||||
@ -299,7 +306,7 @@ func (b *Birc) getClient() (*girc.Client, error) {
|
|||||||
Port: port,
|
Port: port,
|
||||||
Nick: b.GetString("Nick"),
|
Nick: b.GetString("Nick"),
|
||||||
User: user,
|
User: user,
|
||||||
Name: b.GetString("Nick"),
|
Name: realName,
|
||||||
SSL: b.GetBool("UseTLS"),
|
SSL: b.GetBool("UseTLS"),
|
||||||
TLSConfig: &tls.Config{InsecureSkipVerify: b.GetBool("SkipTLSVerify"), ServerName: server}, //nolint:gosec
|
TLSConfig: &tls.Config{InsecureSkipVerify: b.GetBool("SkipTLSVerify"), ServerName: server}, //nolint:gosec
|
||||||
PingDelay: pingDelay,
|
PingDelay: pingDelay,
|
||||||
|
@ -55,6 +55,14 @@ Charset=""
|
|||||||
#REQUIRED
|
#REQUIRED
|
||||||
Nick="matterbot"
|
Nick="matterbot"
|
||||||
|
|
||||||
|
#Real name/gecos displayed in e.g. /WHOIS and /WHO
|
||||||
|
#OPTIONAL (defaults to the nick)
|
||||||
|
RealName="Matterbridge instance on IRC"
|
||||||
|
|
||||||
|
#IRC username/ident preceding the hostname in hostmasks and /WHOIS
|
||||||
|
#OPTIONAL (defaults to the nick)
|
||||||
|
UserName="bridge"
|
||||||
|
|
||||||
#If you registered your bot with a service like Nickserv on libera.
|
#If you registered your bot with a service like Nickserv on libera.
|
||||||
#Also being used when UseSASL=true
|
#Also being used when UseSASL=true
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user