-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,6 +264,7 @@ Candy.Core.Event = (function(self, Strophe, $) { | |
}, | ||
|
||
_addRosterItem: function(item) { | ||
item.inRoster = true; | ||
var user = new Candy.Core.Contact(item); | ||
Candy.Core.getRoster().add(user); | ||
return user; | ||
|
@@ -457,13 +458,21 @@ Candy.Core.Event = (function(self, Strophe, $) { | |
directInvite = msg.find('x[xmlns="jabber:x:conference"]'), | ||
invite; | ||
|
||
var fromUser; | ||
|
||
if(mediatedInvite.length > 0) { | ||
var passwordNode = msg.find('password'), | ||
password, | ||
reasonNode = mediatedInvite.find('reason'), | ||
reason, | ||
continueNode = mediatedInvite.find('continue'); | ||
|
||
if (!fromUser = Candy.Core.getRoster().get(mediatedInvite.attr('from'))) { | ||
var fromUser = new Candy.Core.Contact; | ||
fromUser.data.jid = mediatedInvite.attr('from'); | ||
fromUser.data.inRoster = false; | ||
} | ||
|
||
if(passwordNode.text() !== '') { | ||
password = passwordNode.text(); | ||
} | ||
|
@@ -474,23 +483,35 @@ Candy.Core.Event = (function(self, Strophe, $) { | |
|
||
invite = { | ||
roomJid: msg.attr('from'), | ||
from: mediatedInvite.attr('from'), | ||
from: fromUser, | ||
reason: reason, | ||
password: password, | ||
continuedThread: continueNode.attr('thread') | ||
}; | ||
} | ||
|
||
if(directInvite.length > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok. Thanks. |
||
if (!fromUser = Candy.Core.getRoster().get(msg.attr('from'))) { | ||
var fromUser = new Candy.Core.Contact; | ||
fromUser.data.jid = msg.attr('from'); | ||
fromUser.data.inRoster = false; | ||
} | ||
invite = { | ||
roomJid: directInvite.attr('jid'), | ||
from: msg.attr('from'), | ||
from: fromUser, | ||
reason: directInvite.attr('reason'), | ||
password: directInvite.attr('password'), | ||
continuedThread: directInvite.attr('thread') | ||
}; | ||
} | ||
|
||
/* | ||
* (Candy.Core.Chatroom) room - | ||
* (Candy.Core.Contact) from - | ||
* (String) reason - | ||
* (String) password - | ||
* (String) continuedThread - | ||
*/ | ||
return invite; | ||
}, | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
item
here comes directly from a callback onCandy.Core.getConnection().roster
, so I'm making an assumption that if it's coming all the way to_addRosterItem()
that it's for someone who can be safely said to be in our roster. It can get here either through it's sibling_addRosterItems()
or through a direct callback created inCandy.Core.Action.Jabber.Roster()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍