action.js

CandyChats are not dead yet.

Authors

Copyright

© 2011 Amiado Group AG.  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
RosterSends a request for a roster
PresenceSends a request for presence
ServicesSends a request for disco items
AutojoinWhen Candy.Core.getOptions().autojoin is true, request autojoin bookmarks (OpenFire)
ResetIgnoreListCreate new ignore privacy list (and reset the old 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
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
RosterSends a request for a roster
PresenceSends a request for presence
ServicesSends a request for disco items
AutojoinWhen Candy.Core.getOptions().autojoin is true, request autojoin bookmarks (OpenFire)
ResetIgnoreListCreate new ignore privacy list (and reset the old 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

Roster

Roster: function()

Sends a request for a roster

Presence

Presence: function(attr)

Sends a request for presence

Parameters

(Object) attrOptional attributes

Services

Services: function()

Sends a request for disco items

Autojoin

Autojoin: function()

When Candy.Core.getOptions().autojoin is true, request autojoin bookmarks (OpenFire)

Otherwise, if Candy.Core.getOptions().autojoin is an array, join each channel specified.

ResetIgnoreList

ResetIgnoreList: function()

Create new ignore privacy list (and reset the old 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
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)

Send message

Parameters

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

Returns

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

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
Roster: function()
Sends a request for a roster
Presence: function(attr)
Sends a request for presence
Services: function()
Sends a request for disco items
Autojoin: function()
When Candy.Core.getOptions().autojoin is true, request autojoin bookmarks (OpenFire)
ResetIgnoreList: function()
Create new ignore privacy list (and reset the old 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)
Send message
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