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

[WIP] candy:core:chat:invite triggerHandler #4

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/core/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,19 @@ Candy.Core.Event = (function(self, Strophe, $) {
}

if(directInvite.length > 0) {
Copy link
Author

Choose a reason for hiding this comment

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

What's the difference between a mediated invite and a direct invite? Can we make any assumptions about whether the sender is in our global roster with one or the other?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we can assume that either will come from someone in our roster. A mediated invite will actually come from the MUC service itself.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, ok. Thanks.

fromUser = Candy.Core.getRoster().get(msg.attr('from'));
Copy link
Member

Choose a reason for hiding this comment

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

So, open question (including @bklang): how do we treat users who aren't in our roster? Do we pass through the JID instead of a Contact, or do we pass something API-compatible with Contact but which nevertheless indicates absence of full details from the roster and is scoped only to this event?

Copy link
Member

Choose a reason for hiding this comment

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

I am inclined to think something API-compatible with a Contact, but with the missing fields returning nil/undefined or empty strings. May also add a boolean for "in roster?"

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Author

Choose a reason for hiding this comment

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

Also 👍

room = Candy.Core.getRoom(directInvite.attr('jid'));
Copy link
Member

Choose a reason for hiding this comment

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

If this is an invite, we won't have the room object yet - is it useful to pre-load it into the collection (potential memory leak) or do we just go back to passing the JID forward (perhaps as a JID object rather than a string)?

Copy link
Author

Choose a reason for hiding this comment

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

Ah, right. What I've been doing in this case is just keeping the roomJid as a string and leaving as is.


/*
* (Candy.Core.Chatroom) room -
* (Candy.Core.Contact) from -
* (String) reason -
* (String) password -
* (String) continuedThread -
*/
invite = {
roomJid: directInvite.attr('jid'),
from: msg.attr('from'),
room: room,
from: fromUser,
reason: directInvite.attr('reason'),
password: directInvite.attr('password'),
continuedThread: directInvite.attr('thread')
Expand Down