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

Add DiscoverInfo() as thin wrapper around RawInformation() #151

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eleksir
Copy link
Contributor

@eleksir eleksir commented Jun 24, 2023

Just to make requests in conventional way.
In my case it is disco#info to MUC.

@Neustradamus

This comment was marked as off-topic.

@mattn
Copy link
Member

mattn commented Nov 12, 2023

@mdosch Could you please handle this?

@mdosch
Copy link
Collaborator

mdosch commented Nov 12, 2023

Will have a look when I find the time.

func (c *Client) DiscoverNodeInfo(node string) (string, error) {
query := fmt.Sprintf("<query xmlns='%s' node='%s'/>", XMPPNS_DISCO_INFO, node)
return c.RawInformation(c.jid, c.domain, "info3", IQTypeGet, query)
}

// Discover information about given item from given jid.
func (c *Client) DiscoverInfo(from string, to string) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason to be able to define the from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to do this. Query info about whether client is able to join muc or not, just before blindly try to join.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why not use c.Jid, e.g. as done here instead of making it configurable?

Is there any reason that you might have an connection of jid1 that would request this info claiming to be jid2? Actually I'd assume the server would not allow you to impersonate another JID, therefore I don't see why this should be made configurable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was about year ago, so i don't quite remember why, to be honest. But this mechanics works in conjunction with jabber.ru server and I have to use it this way, otherwise I did not suggest it as PR. If you see it questionable you can always close this PR.

@Neustradamus

This comment was marked as off-topic.

1 similar comment
@Neustradamus

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants