JSDoc: Namespace: jsxc

# Namespace: jsxc

## jsxc

JavaScript Xmpp Chat namespace

Source:
  - jsxc.lib.js, line 1

### Classes

Message
Message

### Namespaces

fileTransfer
gui
muc
notification
options
otr
storage
tab
webrtc
xmpp

### Members

#### (static) bid

My bar id

Source:
  - jsxc.lib.js, line 56

#### (static) CONST

Some constants

Source:
  - jsxc.lib.js, line 65

#### (static) currentState

Current state

Source:
  - jsxc.lib.js, line 59

#### (static) currentUIState

Current UI state

Source:
  - jsxc.lib.js, line 62

#### (static) keepaliveInterval

Interval for keep-alive

Source:
  - jsxc.lib.js, line 29

#### (static) log

debug log

Source:
  - jsxc.lib.js, line 192

#### (static) ls

last values which we wrote into localstorage (IE workaround)

Source:
  - jsxc.lib.js, line 44

#### (static) master

True if i'm the master

Source:
  - jsxc.lib.js, line 11

#### (static) notice

This namespace handle the notice system.

Source:
  - jsxc.lib.notice.js, line 7

#### (static) restoreCompleted

True if restore is complete

Source:
  - jsxc.lib.js, line 32

#### (static) role_allocation

True if the role allocation is finished

Source:
  - jsxc.lib.js, line 14

#### (static) storageNotConform

storage event is even fired if I write something into storage (IE workaround) 0: conform, 1: not conform, 2: not shure

Source:
  - jsxc.lib.js, line 50

#### (static) to

Timeout for keepalive

Source:
  - jsxc.lib.js, line 17

#### (static) toBusy

Timeout after normal keepalive starts

Source:
  - jsxc.lib.js, line 20

#### (static) toNotification

Timeout for notification

Source:
  - jsxc.lib.js, line 23

#### (static) toNotificationDelay

Timeout delay for notification

Source:
  - jsxc.lib.js, line 26

#### (static) toSNC

Timeout for storageNotConform test

Source:
  - jsxc.lib.js, line 53

#### (static) triggeredFromBox

True if login through box

Source:
  - jsxc.lib.js, line 35

#### (static) triggeredFromElement

True if logout through element click

Source:
  - jsxc.lib.js, line 38

#### (static) triggeredFromLogout

True if logout through logout click

Source:
  - jsxc.lib.js, line 41

#### (static) version

Version of jsxc

Source:
  - jsxc.lib.js, line 8

### Methods

#### (static) checkMaster(cbopt)

Checks if there is a master

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`cb` | function | <optional> | Called if no master was found.

Source:
  - jsxc.lib.js, line 757

#### (static) debug(msg, data, Could)

Write debug message to console and to log.

##### Parameters:

Name | Type | Description
--- | --- | ---
`msg` | String | Debug message
`data` | Object |
`Could` | String | be warn|error|null

Source:
  - jsxc.lib.js, line 139

#### (static) el_exists(selector) → {Boolean}

Checks if there is a element with the given selector

##### Parameters:

Name | Type | Description
--- | --- | ---
`selector` | String | jQuery selector

Source:
  - jsxc.lib.js, line 848

##### Returns:

Type
  Boolean

#### (static) error(msg, data)

Write error message.

##### Parameters:

Name | Type | Description
--- | --- | ---
`msg` | String | Error message
`data` | Object |

Source:
  - jsxc.lib.js, line 187

#### (static) escapeHTML()

Escapes some characters to HTML character

Source:
  - jsxc.lib.js, line 955

#### (static) exec(fnName, fnParams)

Executes the given function in jsxc namespace.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fnName` | string | Function name
`fnParams` | array | Function parameters

Source:
  - jsxc.lib.js, line 1050

##### Returns:

Function return value

#### (static) getFormattedTime(unixtime)

Parse a unix timestamp and return a formatted time string

##### Parameters:

Name | Type | Description
--- | --- | ---
`unixtime` | Object |

Source:
  - jsxc.lib.js, line 109

##### Returns:

time of day and/or date

#### (static) hasFocus() → {boolean}

Checks if tab has focus.

Source:
  - jsxc.lib.js, line 1026

##### Returns:

True if tabs has focus

Type
  boolean

#### (static) hashStr(str) → {integer}

Hash string into 32-bit signed integer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`str` | string | input string

Source:
  - jsxc.lib.js, line 1070

##### Returns:

32-bit signed integer

Type
  integer

#### (static) init(options)

This function initializes important core functions and event handlers. Afterwards it performs the following actions in the given order:

1. If (loginForm.ifFound = 'force' and form was found) or (jid or rid or sid was not found) intercept form, and listen for credentials.
2. Attach with jid, rid and sid from storage, if no form was found or loginForm.ifFound = 'attach'
3. Attach with jid, rid and sid from options.xmpp, if no form was found or loginForm.ifFound = 'attach'

##### Parameters:

Name | Type | Description
--- | --- | ---
`options` | object | See jsxc.options

Source:
  - jsxc.lib.js, line 210

#### (static) isHidden() → {boolean}

Checks if tab is hidden.

Source:
  - jsxc.lib.js, line 998

##### Returns:

True if tab is hidden

Type
  boolean

#### (static) isLoginForm() → {boolean}

Returns true if login form is found.

Source:
  - jsxc.lib.js, line 595

##### Returns:

True if login form was found.

Type
  boolean

#### (static) jidToBid(jid)

Create comparable bar jid.

##### Parameters:

Name | Type | Description
--- | --- | ---
`jid` |  |

Source:
  - jsxc.lib.js, line 873

##### Returns:

comparable bar jid

#### (static) jidToCid(jid) → {String}

Creates a CSS compatible string from a JID

##### Parameters:

Name | Type | Description
--- | --- | ---
`jid` | type | Valid Jabber ID

Source:
  - jsxc.lib.js, line 858

##### Returns:

css Compatible string

Type
  String

#### (static) keepAlive()

Sends the keep-alive signal to signal that the master is still there.

Source:
  - jsxc.lib.js, line 808

#### (static) keepBusyAlive()

Send one keep-alive signal with higher timeout, and than resume with normal signal

Source:
  - jsxc.lib.js, line 819

#### (static) onMaster()

Called if the script is the master

Source:
  - jsxc.lib.js, line 735

#### (static) onSlave()

Called if the script is a slave

Source:
  - jsxc.lib.js, line 717

#### (static) prepareLogin(username, password, cb)

Load settings and prepare jid.

##### Parameters:

Name | Type | Description
--- | --- | ---
`username` | string |
`password` | string |
`cb` | function | Called after login is prepared with result as param

Source:
  - jsxc.lib.js, line 607

#### (static) random(max) → {Integer}

Generates a random integer number between 0 and max

##### Parameters:

Name | Type | Description
--- | --- | ---
`max` | Integer |

Source:
  - jsxc.lib.js, line 838

##### Returns:

random integer between 0 and max

Type
  Integer

#### (static) removeHTML(text)

Removes all html tags.

##### Parameters:

Name | Type | Description
--- | --- | ---
`text` |  |

Source:
  - jsxc.lib.js, line 967

##### Returns:

stripped text

#### (static) restoreRoster()

Restore roster

Source:
  - jsxc.lib.js, line 880

#### (static) restoreWindows()

Restore all windows

Source:
  - jsxc.lib.js, line 902

#### (static) start(jid, sid, rid)

Attach to new chat session with jid, sid and rid.

##### Parameters:

Name | Type | Description
--- | --- | ---
`jid` | string | Jabber Id
`sid` | string | Session Id
`rid` | string | Request Id

Source:
  - jsxc.lib.js, line 460

#### (static) startKeepAlive()

Start sending keep-alive signal

Source:
  - jsxc.lib.js, line 801

#### (static) submitLoginForm()

This method submits the specified login form.

Source:
  - jsxc.lib.js, line 932

#### (static) switchEvents() → {string}

Executes only one of the given events

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj.key` | string | event name
`obj.value` | function | function to execute

Source:
  - jsxc.lib.js, line 978

##### Returns:

namespace of all events

Type
  string

#### (static) warn(msg, data)

Write warn message.

##### Parameters:

Name | Type | Description
--- | --- | ---
`msg` | String | Warn message
`data` | Object |

Source:
  - jsxc.lib.js, line 176