Skip to content

Unique message id#19

Open
oxoWrk wants to merge 1 commit intoredmine-xmpp:masterfrom
oxoWrk:unique_message_id
Open

Unique message id#19
oxoWrk wants to merge 1 commit intoredmine-xmpp:masterfrom
oxoWrk:unique_message_id

Conversation

@oxoWrk
Copy link

@oxoWrk oxoWrk commented Sep 7, 2017

must be

message = Message.new(jid, message_text).set_id(SecureRandom.uuid)
message.type = message_type
client.tap {|client|
client.send(message) unless client.nil?
Copy link

@cmrd-senya cmrd-senya Sep 28, 2017

Choose a reason for hiding this comment

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

I think that instead of explicitly setting the id we should use Jabber::Client#send_with_id method here, because it's better to rely on gem-provided methods when they are available.

Copy link
Author

Choose a reason for hiding this comment

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

send_with_id method does not generate a unique id

Choose a reason for hiding this comment

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

It relies on IdGenerator.generate_id where the documentation literally says

Generate an unique ID.

If there is something wrong with uniqueness there, maybe you can consider to make a PR for the xmpp4r gem?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants