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.presence triggerHandler #3

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
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
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
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
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