Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matterircd ignores server on login when DefaultServer is set in configuration #557

Open
kot0dama opened this issue Oct 24, 2023 · 1 comment · May be fixed by #558
Open

Matterircd ignores server on login when DefaultServer is set in configuration #557

kot0dama opened this issue Oct 24, 2023 · 1 comment · May be fixed by #558
Assignees

Comments

@kot0dama
Copy link

kot0dama commented Oct 24, 2023

Hi,

When using a matterircd instance for connecting to multiple Mattermost servers, if there is a DefaultServer in the configuration, it is impossible to connect to any other server even though they're listed in Restrict.

Is DefaultServer actually a forced server option? Or is it a way to define the default server when the user does not specify a specific server to log into in the mattermost /msg?

Steps to reproduce

  • Set up matterircd config with:
[mattermost]
DefaultServer = "whatever.com"
DefaultTeam = "myteam"
Restrict = ["whatever.com", "chat.charmhub.io"]
  • Connect to matterircd with an IRC client
  • Send /msg mattermost login chat.charmhub.io charmhub username token=....

This yields:

[2023-10-24T01:20:35Z] DEBUG matterircd: flushing buffer: &irc.Message{Prefix:(*irc.Prefix)(nil), Command:"PRIVMSG", Params:[]string{"mattermost"}, Trailing:"login chat.charmhub.io charmhub kotodama token=REDACTED
", EmptyTrailing:false
}
[2023-10-24T01:20:35Z] DEBUG matterircd: Executed &irc.Message{Prefix:(*irc.Prefix)(nil), Command:"PRIVMSG", Params:[]string{"mattermost"}, Trailing:"<redacted>", EmptyTrailing:false} <nil>
[2023-10-24T01:20:35Z] DEBUG matterircd: args_len: 4
[2023-10-24T01:20:35Z] DEBUG matterircd: team: myteam
[2023-10-24T01:20:35Z] DEBUG matterircd: server: .com
[2023-10-24T01:20:35Z] DEBUG matterircd: restrict: [whatever.com chat.charmhub.io]
loggerlevel: debug
[2023-10-24T01:20:36Z]  INFO bridge/mattermost: login as kotodama (team: myteam) on whatever.com
[2023-10-24T01:20:36Z]  INFO matterclient: Found version 7.8.0.7.8.0.1d38ab1b122bcd3de4a230cfc66281cd.true
[2023-10-24T01:20:36Z] DEBUG matterclient: trying login myteam kotodama whatever.com
[2023-10-24T01:20:36Z] DEBUG matterclient: trying login with personal token
[2023-10-24T01:20:36Z] ERROR bridge/mattermost: login failed: Invalid or expired session, please login again., 

Thank you!

@kot0dama kot0dama changed the title Matterircd ignores server when DefaultServer is set in configuration Matterircd ignores server on login when DefaultServer is set in configuration Oct 24, 2023
@hloeung
Copy link
Collaborator

hloeung commented Oct 24, 2023

Yeah, I think it's these bits of code:

https://github.com/42wim/matterircd/blame/master/mm-go-irckit/service.go#L122

https://github.com/42wim/matterircd/blame/master/mm-go-irckit/service.go#L147

So if either of DefaultServer or DefaultTeam, IIUC, they will be used instead of what team and server args are provided. I'll work on a fix when I get some spare cycles.

@hloeung hloeung linked a pull request Oct 24, 2023 that will close this issue
@hloeung hloeung self-assigned this Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants