Class jabberwerx.PrivateStorageController
Extends
jabberwerx.Controller.
Controller class for dealing with private storage functionality.
Constructor Attributes | Constructor Name and Description |
---|---|
Creates a new PrivateStorageController with the given client. |
- Fields borrowed from class jabberwerx.Controller:
- client, name
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroys private storage controller. |
|
fetch(ename, callback)
Fetches a private storage data and invokes the callback function passing it received xml element or error encountered. |
|
remove(ename)
Clears private storage data. |
|
update(private_elm)
Updates the server with new private storage data. |
- Methods borrowed from class jabberwerx.Controller:
- cleanupEntity, removeEntity, updateEntity
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event, shouldBeSavedWithGraph
- Methods borrowed from class jabberwerx.JWBase:
- getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, toString, wasUnserialized, willBeSerialized
Creates a new PrivateStorageController with the given client.
- Parameters:
- {jabberwerx.Client} client
- The client object to use for communicating to the server
- Throws:
- {TypeError}
- If {client} is not an instance of jabberwerx.Client
Destroys private storage controller.
Fetches a private storage data and invokes the callback function passing it received xml element or error encountered.
- Parameters:
- {String} ename
- Ename string for the privacy storage element.
- {function} callback
- The function called after the server response is processed. If a server error
occurs, the function will be passed the error stanza response.
The signature of the function is
callback(private_data, errorStanza)
.The callback will be invoked in the context of the PrivateStorageController e.g.
callback.call(this, private_data, errorStanza)
. Therefore in the callback methodthis
will refer to the instance of PrivateStorageController and sothis.client
will retrieve the jabberwerx.Client object.
- Throws:
- {TypeError}
- If {ename} is not a properly formatted ename element.
- {jabberwerx.Client.NotConnectedError}
- If the jabberwerx.Client is not connected
Clears private storage data.
- Parameters:
- {String} ename
- Ename string for the privacy storage element.
- Throws:
- {TypeError}
- If {ename} is not a properly formatted ename element.
Updates the server with new private storage data.
- Parameters:
- {Element} private_elm
- Document element.
- Throws:
- {TypeError}
- If {private_elm} is undefined or not a document element.