| Candy | Chats are not dead yet. |
© 2011 Amiado Group AG. All rights reserved. © 2012-2014 Patrick Stadler & Michael Weibel. All rights reserved.
| core.js | |
| Candy.Core | Candy Chat Core |
| Variables | |
| autojoin | If set to `true` try to get the bookmarks and autojoin the rooms (supported by ejabberd, Openfire). |
| presencePriority | Default priority for presence messages in order to receive messages across different resources |
| resource | JID resource to use when connecting to the server. |
| Private Functions | |
| _addNamespace | Adds a namespace. |
| _addNamespaces | Adds namespaces needed by Candy. |
| Functions | |
| init | Initialize Core. |
| registerEventHandlers | Adds listening handlers to the connection. |
| connect | Connect to the jabber host. |
| Events | |
| candy: | Triggered before a connection attempt is made. |
| Functions | |
| attach | Attach an already binded & connected session to the server |
| disconnect | Leave all rooms and disconnect |
| addHandler | Wrapper for Strophe.Connection.addHandler() to add a stanza handler for the connection. |
| getUser | Gets current user |
| setUser | Set current user. |
| getConnection | Gets Strophe connection |
| removeRoom | Removes a room from the rooms list |
| getRooms | Gets all joined rooms |
| getStropheStatus | Get the status set by Strophe. |
| setStropheStatus | Set the strophe status |
| isAnonymousConnection | Returns true if Candy.Core.connect was first called with a domain instead of a jid as the first param. |
| getOptions | Gets options |
| getRoom | Gets a specific room |
| onWindowUnload | window.onbeforeunload event which disconnects the client from the Jabber server. |
| rawInput | (Overridden from Strophe.Connection.rawInput) |
| log | Overridden to do something useful if debug is set to true. |
Candy Chat Core
| (Candy.Core) self | itself |
| (Strophe) Strophe | Strophe JS |
| (jQuery) $ | jQuery |
| Variables | |
| autojoin | If set to `true` try to get the bookmarks and autojoin the rooms (supported by ejabberd, Openfire). |
| presencePriority | Default priority for presence messages in order to receive messages across different resources |
| resource | JID resource to use when connecting to the server. |
| Private Functions | |
| _addNamespace | Adds a namespace. |
| _addNamespaces | Adds namespaces needed by Candy. |
| Functions | |
| init | Initialize Core. |
| registerEventHandlers | Adds listening handlers to the connection. |
| connect | Connect to the jabber host. |
| Events | |
| candy: | Triggered before a connection attempt is made. |
| Functions | |
| attach | Attach an already binded & connected session to the server |
| disconnect | Leave all rooms and disconnect |
| addHandler | Wrapper for Strophe.Connection.addHandler() to add a stanza handler for the connection. |
| getUser | Gets current user |
| setUser | Set current user. |
| getConnection | Gets Strophe connection |
| removeRoom | Removes a room from the rooms list |
| getRooms | Gets all joined rooms |
| getStropheStatus | Get the status set by Strophe. |
| setStropheStatus | Set the strophe status |
| isAnonymousConnection | Returns true if Candy.Core.connect was first called with a domain instead of a jid as the first param. |
| getOptions | Gets options |
| getRoom | Gets a specific room |
| onWindowUnload | window.onbeforeunload event which disconnects the client from the Jabber server. |
| rawInput | (Overridden from Strophe.Connection.rawInput) |
| log | Overridden to do something useful if debug is set to true. |
autojoin: undefined
If set to `true` try to get the bookmarks and autojoin the rooms (supported by ejabberd, Openfire). You may want to define an array of rooms to autojoin: `[‘room1@conference.host.tld’, ‘room2...]` (ejabberd, Openfire, ...)
self.connect = function( jidOrHost, password, nick )
Connect to the jabber host.
| connect(‘JID’, ‘password’) | Connect a registered user |
| connect(‘domain’) | Connect anonymously to the domain. The user should receive a random JID. |
| connect(‘domain’, null, ‘nick’) | Connect anonymously to the domain. The user should receive a random JID but with a nick set. |
| connect(‘JID’) | Show login form and prompt for password. JID input is hidden. |
| connect() | Show login form and prompt for JID and password. |
Candy.Core.attach() for attaching an already established session.
| (String) jidOrHost | JID or Host |
| (String) password | Password of the user |
| (String) nick | Nick of the user. Set one if you want to anonymously connect but preset a nick. If jidOrHost is a domain and this param is not set, Candy will prompt for a nick. |
Triggered before a connection attempt is made.
Plugins should register their stanza handlers using this event to ensure that they are set.
See also #84.
| (Strophe.Connection) conncetion | Strophe connection |
self.addHandler = function( handler, ns, name, type, id, from, options )
Wrapper for Strophe.Connection.addHandler() to add a stanza handler for the connection.
| (Function) handler | The user callback. |
| (String) ns | The namespace to match. |
| (String) name | The stanza name to match. |
| (String) type | The stanza type attribute to match. |
| (String) id | The stanza id attribute to match. |
| (String) from | The stanza from attribute to match. |
| (String) options | The handler options |
A reference to the handler that can be used to remove it.
self.isAnonymousConnection = function()
Returns true if Candy.Core.connect was first called with a domain instead of a jid as the first param.
(Boolean)
If set to `true` try to get the bookmarks and autojoin the rooms (supported by ejabberd, Openfire).
autojoin: undefined
Default priority for presence messages in order to receive messages across different resources
presencePriority: 1
JID resource to use when connecting to the server.
resource: Candy.about.name
Initialize Core.
self.init = function( service, options )
Adds listening handlers to the connection.
self.registerEventHandlers = function()
Connect to the jabber host.
self.connect = function( jidOrHost, password, nick )
Attach an already binded & connected session to the server
self.attach = function( jid, sid, rid )
Leave all rooms and disconnect
self.disconnect = function()
Wrapper for Strophe.Connection.addHandler() to add a stanza handler for the connection.
self.addHandler = function( handler, ns, name, type, id, from, options )
Gets current user
self.getUser = function()
Set current user.
self.setUser = function( user )
Gets Strophe connection
self.getConnection = function()
Removes a room from the rooms list
self.removeRoom = function( roomJid )
Gets all joined rooms
self.getRooms = function()
Get the status set by Strophe.
self.getStropheStatus = function()
Set the strophe status
self.setStropheStatus = function( status )
Returns true if Candy.Core.connect was first called with a domain instead of a jid as the first param.
self.isAnonymousConnection = function()
Gets options
self.getOptions = function()
Gets a specific room
self.getRoom = function( roomJid )
window.onbeforeunload event which disconnects the client from the Jabber server.
self.onWindowUnload = function()
(Overridden from Strophe.Connection.rawInput)
self.rawInput = function( data )
Overridden to do something useful if debug is set to true.
self.log = function()