Skip to content
Open
Changes from all commits
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
10 changes: 7 additions & 3 deletions src/core/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,18 @@ Candy.Core.Event = (function(self, Strophe, $) {
self.Jabber.Room.Presence(msg);
}
} else {
// Find the proper contact for from:
var fromUser = Candy.Core.getRoster().get(msg.attr('from'));

/** Event: candy:core.presence
* Presence updates. Emitted only when not a muc presence.
*
* Parameters:
* (JID) from - From Jid
* (String) stanza - Stanza
* (Candy.Core.Contact) from - Contact user object
*/
$(Candy).triggerHandler('candy:core.presence', {'from': msg.attr('from'), 'stanza': msg});
$(Candy).triggerHandler('candy:core.presence', {
'from': fromUser
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's probably necessary to include the presence we received here as the state transition.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ok. This is the one that I was most unsure of since it just simply passes along the entire stanza for other part of the code to pick through.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should wrap that up into nicer accessors for the important bits for sure, but that can go lower priority.

}
return true;
},
Expand Down