Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
A mediated invite might be included in a normal message
Browse files Browse the repository at this point in the history
  • Loading branch information
benlangfeld committed Jul 10, 2014
1 parent df951c9 commit 1532df3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 34 deletions.
28 changes: 13 additions & 15 deletions candy.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion candy.bundle.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion candy.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion candy.min.map

Large diffs are not rendered by default.

31 changes: 15 additions & 16 deletions src/core/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ Candy.Core.Event = (function(self, Strophe, $) {

// Inspect the message type.
if (type === 'normal' || type === 'undefined') {
// It is an invite
if($(msg).find('invite').length > 0) {
/** Event: candy:core:chat:invite
* Incoming chat invite for a MUC.
Expand All @@ -268,22 +267,22 @@ Candy.Core.Event = (function(self, Strophe, $) {
from: $(msg).find('invite').attr('from') || 'undefined',
reason: $(msg).find('invite').find('reason').html() || ''
});
// It is not an invite
} else {
/** Event: candy:core:chat:message:normal
* Messages with the type attribute of normal or those
* that do not have the optional type attribute.
*
* Parameters:
* (String) type - Type of the message [default: message]
* (Object) message - Message object.
*/
// Detect message with type normal or with no type.
$(Candy).triggerHandler('candy:core:chat:message:normal', {
type: (type || 'normal'),
message: msg
});
}

/** Event: candy:core:chat:message:normal
* Messages with the type attribute of normal or those
* that do not have the optional type attribute.
*
* Parameters:
* (String) type - Type of the message [default: message]
* (Object) message - Message object.
*/
// Detect message with type normal or with no type.
$(Candy).triggerHandler('candy:core:chat:message:normal', {
type: (type || 'normal'),
message: msg
});

return true;
} else if (type !== 'groupchat' && type !== 'chat' && type !== 'error' && type !== 'headline') {
/** Event: candy:core:chat:message:other
Expand Down

0 comments on commit 1532df3

Please sign in to comment.