chatUser.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
chatUser.js
Candy.Core.ChatUserChat User
Constants
ROLE_MODERATORModerator role
AFFILIATION_OWNERAffiliation owner
Variables
data
Functions
getJidGets an unescaped user jid
getEscapedJidEscapes the user’s jid (node & resource get escaped)
setJidSets a user’s jid
getNickGets user nick
setNickSets a user’s nick
getRoleGets user role
setRoleSets user role
setAffiliationSets user affiliation
getAffiliationGets user affiliation
isModeratorCheck if user is moderator.
addToOrRemoveFromPrivacyListConvenience function for adding/removing users from ignore list.
getPrivacyListReturns the privacy list of the listname of the param.
setPrivacyListsSets privacy lists.
isInPrivacyListTests if this user ignores the user provided by jid.
setCustomDataStores custom data
getCustomDataRetrieve custom data
setPreviousNickIf user has nickname changed, set previous nickname.
hasNicknameChangedGets the previous nickname if available.

Candy.Core.ChatUser

Chat User

Summary
Constants
ROLE_MODERATORModerator role
AFFILIATION_OWNERAffiliation owner
Variables
data
Functions
getJidGets an unescaped user jid
getEscapedJidEscapes the user’s jid (node & resource get escaped)
setJidSets a user’s jid
getNickGets user nick
setNickSets a user’s nick
getRoleGets user role
setRoleSets user role
setAffiliationSets user affiliation
getAffiliationGets user affiliation
isModeratorCheck if user is moderator.
addToOrRemoveFromPrivacyListConvenience function for adding/removing users from ignore list.
getPrivacyListReturns the privacy list of the listname of the param.
setPrivacyListsSets privacy lists.
isInPrivacyListTests if this user ignores the user provided by jid.
setCustomDataStores custom data
getCustomDataRetrieve custom data
setPreviousNickIf user has nickname changed, set previous nickname.
hasNicknameChangedGets the previous nickname if available.

Constants

ROLE_MODERATOR

Moderator role

AFFILIATION_OWNER

Affiliation owner

Variables

data

this.data

User data containing

  • jid
  • nick
  • affiliation
  • role
  • privacyLists
  • customData to be used by e.g. plugins

Functions

getJid

this.getJid = function()

Gets an unescaped user jid

See

Candy.Util.unescapeJid

Returns

(String)jid

getEscapedJid

this.getEscapedJid = function()

Escapes the user’s jid (node & resource get escaped)

See

Candy.Util.escapeJid

Returns

(String)escaped jid

setJid

this.setJid = function(jid)

Sets a user’s jid

Parameters

(String) jidNew Jid

getNick

this.getNick = function()

Gets user nick

Returns

(String)nick

setNick

this.setNick = function(nick)

Sets a user’s nick

Parameters

(String) nickNew nick

getRole

this.getRole = function()

Gets user role

Returns

(String)role

setRole

this.setRole = function(role)

Sets user role

Parameters

(String) roleRole

setAffiliation

this.setAffiliation = function(affiliation)

Sets user affiliation

Parameters

(String) affiliationnew affiliation

getAffiliation

this.getAffiliation = function()

Gets user affiliation

Returns

(String)affiliation

isModerator

this.isModerator = function()

Check if user is moderator.  Depends on the room.

Returns

(Boolean)true if user has role moderator or affiliation owner

addToOrRemoveFromPrivacyList

this.addToOrRemoveFromPrivacyList = function(list,
jid)

Convenience function for adding/removing users from ignore list.

Check if user is already in privacy list.  If yes, remove it.  If no, add it.

Parameters

(String) listTo which privacy list the user should be added / removed from.  Candy supports curently only the “ignore” list.
(String) jidUser jid to add/remove

Returns

(Array)Current privacy list.

getPrivacyList

this.getPrivacyList = function(list)

Returns the privacy list of the listname of the param.

Parameters

(String) listTo which privacy list the user should be added / removed from.  Candy supports curently only the “ignore” list.

Returns

(Array)Privacy List

setPrivacyLists

this.setPrivacyLists = function(lists)

Sets privacy lists.

Parameters

(Object) listsList object

isInPrivacyList

this.isInPrivacyList = function(list,
jid)

Tests if this user ignores the user provided by jid.

Parameters

(String) listPrivacy list
(String) jidJid to test for

Returns

(Boolean)

setCustomData

this.setCustomData = function(data)

Stores custom data

Parameter

(Object) dataObject containing custom data

getCustomData

this.getCustomData = function()

Retrieve custom data

Returns

(Object)Object containing custom data

setPreviousNick

this.setPreviousNick = function(previousNick)

If user has nickname changed, set previous nickname.

Parameters

(String) previousNickthe previous nickname

hasNicknameChanged

Gets the previous nickname if available.

Returns

(String)previous nickname
this.data
this.getJid = function()
Gets an unescaped user jid
this.getEscapedJid = function()
Escapes the user’s jid (node & resource get escaped)
this.setJid = function(jid)
Sets a user’s jid
this.getNick = function()
Gets user nick
this.setNick = function(nick)
Sets a user’s nick
this.getRole = function()
Gets user role
this.setRole = function(role)
Sets user role
this.setAffiliation = function(affiliation)
Sets user affiliation
this.getAffiliation = function()
Gets user affiliation
this.isModerator = function()
Check if user is moderator.
this.addToOrRemoveFromPrivacyList = function(list,
jid)
Convenience function for adding/removing users from ignore list.
this.getPrivacyList = function(list)
Returns the privacy list of the listname of the param.
this.setPrivacyLists = function(lists)
Sets privacy lists.
this.isInPrivacyList = function(list,
jid)
Tests if this user ignores the user provided by jid.
this.setCustomData = function(data)
Stores custom data
this.getCustomData = function()
Retrieve custom data
this.setPreviousNick = function(previousNick)
If user has nickname changed, set previous nickname.
self.unescapeJid = function(jid)
Unescapes a jid (node & resource get unescaped)
self.escapeJid = function(jid)
Escapes a jid (node & resource get escaped)
Close