Source: jsxc.lib.options.js

  1. /**
  2. * Set some options for the chat.
  3. *
  4. * @namespace jsxc.options
  5. */
  6. jsxc.options = {
  7. /** name of container application (e.g. owncloud or SOGo) */
  8. app_name: 'web applications',
  9. /** Timeout for the keepalive signal */
  10. timeout: 3000,
  11. /** Timeout for the keepalive signal if the master is busy */
  12. busyTimeout: 15000,
  13. /** OTR options */
  14. otr: {
  15. enable: true,
  16. ERROR_START_AKE: false,
  17. debug: false,
  18. SEND_WHITESPACE_TAG: false,
  19. WHITESPACE_START_AKE: true
  20. },
  21. /** xmpp options */
  22. xmpp: {
  23. /** BOSH url */
  24. url: null,
  25. /** XMPP JID*/
  26. jid: null,
  27. /** XMPP domain */
  28. domain: null,
  29. /** XMPP password */
  30. password: null,
  31. /** session id */
  32. sid: null,
  33. /** request id */
  34. rid: null,
  35. /** True: Allow user to overwrite xmpp settings */
  36. overwrite: false,
  37. /** @deprecated since v2.1.0. Use now loginForm.enable. */
  38. onlogin: null
  39. },
  40. /** default xmpp priorities */
  41. priority: {
  42. online: 0,
  43. chat: 0,
  44. away: 0,
  45. xa: 0,
  46. dnd: 0
  47. },
  48. /**
  49. * This function is called if a login form was found, but before any
  50. * modification is done to it.
  51. *
  52. * @memberOf jsxc.options
  53. * @function
  54. */
  55. formFound: null,
  56. /** If all 3 properties are set and enable is true, the login form is used */
  57. loginForm: {
  58. /** False, disables login through login form */
  59. enable: true,
  60. /** jquery object from form */
  61. form: null,
  62. /** jquery object from input element which contains the jid */
  63. jid: null,
  64. /** jquery object from input element which contains the password */
  65. pass: null,
  66. /** manipulate JID from input element */
  67. preJid: function(jid) {
  68. return jid;
  69. },
  70. /**
  71. * Action after login was called: dialog [String] Show wait dialog, false [boolean] |
  72. * quiet [String] Do nothing
  73. */
  74. onConnecting: 'dialog',
  75. /**
  76. * Action after connected: submit [String] Submit form, false [boolean] Do
  77. * nothing, continue [String] Start chat
  78. */
  79. onConnected: 'submit',
  80. /**
  81. * Action after auth fail: submit [String] Submit form, false [boolean] | quiet [String] Do
  82. * nothing, ask [String] Show auth fail dialog
  83. */
  84. onAuthFail: 'submit',
  85. /**
  86. * True: Attach connection even is login form was found.
  87. *
  88. * @type {Boolean}
  89. * @deprecated since 3.0.0. Use now loginForm.ifFound (true => attach, false => pause)
  90. */
  91. attachIfFound: true,
  92. /**
  93. * Describes what we should do if login form was found:
  94. * - Attach connection
  95. * - Force new connection with loginForm.jid and loginForm.passed
  96. * - Pause connection and do nothing
  97. *
  98. * @type {(attach|force|pause)}
  99. */
  100. ifFound: 'attach',
  101. /**
  102. * True: Display roster minimized after first login. Afterwards the last
  103. * roster state will be used.
  104. */
  105. startMinimized: false
  106. },
  107. /** jquery object from logout element */
  108. logoutElement: null,
  109. /** How many messages should be logged? */
  110. numberOfMsg: 10,
  111. /** Default language */
  112. defaultLang: 'en',
  113. /** auto language detection */
  114. autoLang: true,
  115. /** Place for roster */
  116. rosterAppend: 'body',
  117. /** Should we use the HTML5 notification API? */
  118. notification: true,
  119. /** duration for notification */
  120. popupDuration: 6000,
  121. /** Absolute path root of JSXC installation */
  122. root: '',
  123. /**
  124. * This function decides wether the roster will be displayed or not if no
  125. * connection is found.
  126. */
  127. displayRosterMinimized: function() {
  128. return false;
  129. },
  130. /** Set to true if you want to hide offline buddies. */
  131. hideOffline: false,
  132. /** Mute notification sound? */
  133. muteNotification: false,
  134. /**
  135. * If no avatar is found, this function is called.
  136. *
  137. * @param jid Jid of that user.
  138. * @this {jQuery} Elements to update with probable .jsxc_avatar elements
  139. */
  140. defaultAvatar: null,
  141. /**
  142. * This callback processes all settings.
  143. * @callback loadSettingsCallback
  144. * @param settings {object} could be every jsxc option
  145. */
  146. /**
  147. * Returns permanent saved settings and overwrite default jsxc.options.
  148. *
  149. * @memberOf jsxc.options
  150. * @function
  151. * @param username {string} username
  152. * @param password {string} password
  153. * @param cb {loadSettingsCallback} Callback that handles the result
  154. */
  155. loadSettings: null,
  156. /**
  157. * Call this function to save user settings permanent.
  158. *
  159. * @memberOf jsxc.options
  160. * @param data Holds all data as key/value
  161. * @param cb Called with true on success, false otherwise
  162. */
  163. saveSettinsPermanent: function(data, cb) {
  164. cb(true);
  165. },
  166. carbons: {
  167. /** Enable carbon copies? */
  168. enable: true
  169. },
  170. /**
  171. * Processes user list.
  172. *
  173. * @callback getUsers-cb
  174. * @param {object} list List of users, key: username, value: alias
  175. */
  176. /**
  177. * Returns a list of usernames and aliases
  178. *
  179. * @function getUsers
  180. * @memberOf jsxc.options
  181. * @param {string} search Search token (start with)
  182. * @param {getUsers-cb} cb Called with list of users
  183. */
  184. getUsers: null,
  185. /** Options for info in favicon */
  186. favicon: {
  187. enable: true,
  188. /** Favicon info background color */
  189. bgColor: '#E59400',
  190. /** Favicon info text color */
  191. textColor: '#fff'
  192. },
  193. /** @deprecated since v2.1.0. Use now RTCPeerConfig.url. */
  194. turnCredentialsPath: null,
  195. /** RTCPeerConfiguration used for audio/video calls. */
  196. RTCPeerConfig: {
  197. /** Time-to-live for config from url */
  198. ttl: 3600,
  199. /** [optional] If set, jsxc requests and uses RTCPeerConfig from this url */
  200. url: null,
  201. /** If true, jsxc send cookies when requesting RTCPeerConfig from the url above */
  202. withCredentials: false,
  203. /** ICE servers like defined in http://www.w3.org/TR/webrtc/#idl-def-RTCIceServer */
  204. iceServers: [{
  205. urls: 'stun:stun.stunprotocol.org'
  206. }]
  207. },
  208. /** Link to an online user manual */
  209. onlineHelp: 'http://www.jsxc.org/manual.html',
  210. viewport: {
  211. getSize: function() {
  212. var w = $(window).width() - $('#jsxc_windowListSB').width();
  213. var h = $(window).height();
  214. if (jsxc.storage.getUserItem('roster') === 'shown') {
  215. w -= $('#jsxc_roster').outerWidth(true);
  216. }
  217. return {
  218. width: w,
  219. height: h
  220. };
  221. }
  222. },
  223. /** Maximal storage size for attachments received via data channels (webrtc). */
  224. maxStorableSize: 1000000,
  225. /** Options for file transfer. */
  226. fileTransfer: {
  227. httpUpload: {
  228. enable: true
  229. },
  230. // @TODO add option to enable/disable data channels
  231. },
  232. /** Default option for chat state notifications */
  233. chatState: {
  234. enable: true
  235. },
  236. /**
  237. * Download urls to screen media extensions.
  238. *
  239. * @type {Object}
  240. * @see example extensions {@link https://github.com/otalk/getScreenMedia}
  241. */
  242. screenMediaExtension: {
  243. firefox: '',
  244. chrome: ''
  245. },
  246. /**
  247. * Options for Message Archive Management (XEP-0313)
  248. */
  249. mam: {
  250. enable: false,
  251. max: null
  252. }
  253. };