action.js

CandyChats are not dead yet.

Authors

Copyright

© 2011 Amiado Group AG.  All rights reserved.  © 2012-2014 Patrick Stadler & Michael Weibel.  All rights reserved.

Summary
action.js
Candy.Core.ActionChat Actions (basicly a abstraction of Jabber commands)
Candy.Core.Action.JabberJabber actions
Functions
VersionReplies to a version request
SetNicknameSets the supplied nickname for all rooms (if parameter “room” is not specified) or sets it only for the specified rooms
RosterSends a request for a roster
PresenceSends a request for presence
ServicesSends a request for disco items
Events
candy:core.autojoin-missingTriggered when no autojoin information has been found
Functions
ResetIgnoreListCreate new ignore privacy list (and reset the previous one, if it exists).
RemoveIgnoreListRemove an existing ignore list.
GetIgnoreListGet existing ignore privacy list when connecting.
SetIgnoreListActiveSet ignore privacy list active
GetJidIfAnonymousOn anonymous login, initially we don’t know the jid and as a result, Candy.Core._user doesn’t have a jid.
Candy.Core.Action.Jabber.RoomRoom-specific commands
Functions
JoinRequests disco of specified room and joins afterwards.
LeaveLeaves a room.
DiscoRequests disco info of a room.
MessageSend message
InviteSends an invite stanza to multiple JIDs
IgnoreUnignoreChecks if the user is already ignoring the target user, if yes: unignore him, if no: ignore him.
UpdatePrivacyListUpdates privacy list according to the privacylist in the currentUser
Candy.Core.Action.Jabber.Room.AdminRoom administration commands
Functions
UserActionKick or ban a user
SetSubjectSets subject (topic) of a room.

Candy.Core.Action

Chat Actions (basicly a abstraction of Jabber commands)

Parameters

(Candy.Core.Action) selfitself
(Strophe) StropheStrophe
(jQuery) $jQuery

Candy.Core.Action.Jabber

Jabber actions

Summary
Functions
VersionReplies to a version request
SetNicknameSets the supplied nickname for all rooms (if parameter “room” is not specified) or sets it only for the specified rooms
RosterSends a request for a roster
PresenceSends a request for presence
ServicesSends a request for disco items
Events
candy:core.autojoin-missingTriggered when no autojoin information has been found
Functions
ResetIgnoreListCreate new ignore privacy list (and reset the previous one, if it exists).
RemoveIgnoreListRemove an existing ignore list.
GetIgnoreListGet existing ignore privacy list when connecting.
SetIgnoreListActiveSet ignore privacy list active
GetJidIfAnonymousOn anonymous login, initially we don’t know the jid and as a result, Candy.Core._user doesn’t have a jid.

Functions

Version

Version: function(msg)

Replies to a version request

Parameters

(jQuery.element) msgjQuery element

SetNickname

SetNickname: function(nickname,
rooms)

Sets the supplied nickname for all rooms (if parameter “room” is not specified) or sets it only for the specified rooms

Parameters

(String) nicknameNew nickname
(Array) roomsRooms

Roster

Roster: function()

Sends a request for a roster

Presence

Presence: function(attr,
el)

Sends a request for presence

Parameters

(Object) attrOptional attributes
(Strophe.Builder) elOptional element to include in presence stanza

Services

Services: function()

Sends a request for disco items

Events

candy:core.autojoin-missing

Triggered when no autojoin information has been found

Functions

ResetIgnoreList

ResetIgnoreList: function()

Create new ignore privacy list (and reset the previous one, if it exists).

RemoveIgnoreList

RemoveIgnoreList: function()

Remove an existing ignore list.

GetIgnoreList

GetIgnoreList: function()

Get existing ignore privacy list when connecting.

SetIgnoreListActive

SetIgnoreListActive: function()

Set ignore privacy list active

GetJidIfAnonymous

GetJidIfAnonymous: function()

On anonymous login, initially we don’t know the jid and as a result, Candy.Core._user doesn’t have a jid.  Check if user doesn’t have a jid and get it if necessary from the connection.

Candy.Core.Action.Jabber.Room

Room-specific commands

Summary
Functions
JoinRequests disco of specified room and joins afterwards.
LeaveLeaves a room.
DiscoRequests disco info of a room.
MessageSend message
InviteSends an invite stanza to multiple JIDs
IgnoreUnignoreChecks if the user is already ignoring the target user, if yes: unignore him, if no: ignore him.
UpdatePrivacyListUpdates privacy list according to the privacylist in the currentUser

Functions

Join

Join: function(roomJid,
password)

Requests disco of specified room and joins afterwards.

TODO

maybe we should wait for disco and later join the room? but what if we send disco but don’t want/can join the room

Parameters

(String) roomJidRoom to join
(String) password[optional] Password for the room

Leave

Leave: function(roomJid)

Leaves a room.

Parameters

(String) roomJidRoom to leave

Disco

Disco: function(roomJid)

Requests disco info of a room.

Parameters

(String) roomJidRoom to get info for

Message

Message: function(roomJid,
msg,
type,
xhtmlMsg)

Send message

Parameters

(String) roomJidRoom to which send the message into
(String) msgMessage
(String) type”groupchat” or “chat” (“chat” is for private messages)
(String) xhtmlMsgXHTML formatted message [optional]

Returns

(Boolean)true if message is not empty after trimming, false otherwise.

Invite

Invite: function(roomJid,
invitees,
reason,
password)

Sends an invite stanza to multiple JIDs

Parameters

(String) roomJidRoom to which send the message into
(Array) inviteesArray of JIDs to be invited to the room
(String) reasonMessage to include with the invitation [optional]
(String) passwordPassword for the MUC, if required [optional]

IgnoreUnignore

IgnoreUnignore: function(userJid)

Checks if the user is already ignoring the target user, if yes: unignore him, if no: ignore him.

Uses the ignore privacy list set on connecting.

Parameters

(String) userJidTarget user jid

UpdatePrivacyList

UpdatePrivacyList: function()

Updates privacy list according to the privacylist in the currentUser

Candy.Core.Action.Jabber.Room.Admin

Room administration commands

Summary
Functions
UserActionKick or ban a user
SetSubjectSets subject (topic) of a room.

Functions

UserAction

UserAction: function(roomJid,
userJid,
type,
reason)

Kick or ban a user

Parameters

(String) roomJidRoom in which the kick/ban should be done
(String) userJidVictim
(String) type”kick” or “ban”
(String) msgReason

Returns

(Boolean)true if sent successfully, false if type is not one of “kick” or “ban”.

SetSubject

SetSubject: function(roomJid,
subject)

Sets subject (topic) of a room.

Parameters

(String) roomJidRoom
(String) subjectSubject to set
Version: function(msg)
Replies to a version request
SetNickname: function(nickname,
rooms)
Sets the supplied nickname for all rooms (if parameter “room” is not specified) or sets it only for the specified rooms
Roster: function()
Sends a request for a roster
Presence: function(attr,
el)
Sends a request for presence
Services: function()
Sends a request for disco items
ResetIgnoreList: function()
Create new ignore privacy list (and reset the previous one, if it exists).
RemoveIgnoreList: function()
Remove an existing ignore list.
GetIgnoreList: function()
Get existing ignore privacy list when connecting.
SetIgnoreListActive: function()
Set ignore privacy list active
GetJidIfAnonymous: function()
On anonymous login, initially we don’t know the jid and as a result, Candy.Core._user doesn’t have a jid.
Join: function(roomJid,
password)
Requests disco of specified room and joins afterwards.
Leave: function(roomJid)
Leaves a room.
Disco: function(roomJid)
Requests disco info of a room.
Message: function(roomJid,
msg,
type,
xhtmlMsg)
Send message
Invite: function(roomJid,
invitees,
reason,
password)
Sends an invite stanza to multiple JIDs
IgnoreUnignore: function(userJid)
Checks if the user is already ignoring the target user, if yes: unignore him, if no: ignore him.
UpdatePrivacyList: function()
Updates privacy list according to the privacylist in the currentUser
UserAction: function(roomJid,
userJid,
type,
reason)
Kick or ban a user
SetSubject: function(roomJid,
subject)
Sets subject (topic) of a room.
Close