Class: JSJaCMessage

JSJaCMessage

Models the XMPP notion of an 'message' packet

new JSJaCMessage

A jabber/XMPP message packet
Source:
  • JSJaCPacket.js, line 620

Extends

Members

xml

Returns a string representation of the raw xml content of this packet.
Source:
  • JSJaCPacket.js, line 274

Methods

appendNode

Appends node created by buildNode to this packets parent node.
Parameters:
Name Type Description
element Node The node to append or
element string A name plus an object hash with attributes (optional) plus an array of childnodes (optional)
Source:
  • JSJaCPacket.js, line 418
See:
Returns:
This packet
Type
JSJaCPacket

buildNode

Builds a node using script.aculo.us' Dom Builder notation. This code is taken from script.aculo.us' Dom Builder and has been modified to suit our needs.
The original parts of the code do have the following copyright and license notice:
Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.acu lo.us)
script.aculo.us is freely distributable under the terms of an MIT-style licen se. // For details, see the script.aculo.us web site: http://script.aculo.us/
Author:
  • Thomas Fuchs
  • Stefan Strigler
Source:
  • JSJaCPacket.js, line 402
See:
Returns:
The newly created node
Type
Node

clone

Returns a copy of this node
Source:
  • JSJaCPacket.js, line 240
Returns:
a copy of this node
Type
JSJaCPacket

errorReply

Returns an error condition reply according to XEP-0086. Creates a clone of the calling packet with senders and recipient exchanged and error stanza appended.
Parameters:
Name Type Description
stanza_error STANZA_ERROR an error stanza containing error cody, type and condition of the error to be indicated
Source:
  • JSJaCPacket.js, line 257
Returns:
an error reply packet
Type
JSJaCPacket

getBody

Gets the body of this message
Source:
  • JSJaCPacket.js, line 668
Returns:
The body of this message
Type
string

getChild

Gets a child element of this packet. If no params given returns first child.
Parameters:
Name Type Description
name string Tagname of child to retrieve. Use '*' to match any tag. [optional]
ns string Namespace of child. Use '*' to match any ns.[optional]
Source:
  • JSJaCPacket.js, line 192
See:
Returns:
The child node, null if none found
Type
Node

getChildVal

Gets the node value of a child element of this packet.
Parameters:
Name Type Description
name string Tagname of child to retrieve.
ns string Namespace of child
Source:
  • JSJaCPacket.js, line 224
Returns:
The value of the child node, empty string if none found
Type
string

getDoc

Gets the associated Document for this packet.
Source:
  • JSJaCPacket.js, line 44
See:
Returns:
Type
Document

getFrom

Gets the 'from' attribute of this packet.
Source:
  • JSJaCPacket.js, line 139
Returns:
Type
string

getFromJID

Gets the 'from' attribute of this packet as a JSJaCJID object
Source:
  • JSJaCPacket.js, line 153
Returns:
Type
JSJaCJID

getID

Gets the 'id' of this packet
Source:
  • JSJaCPacket.js, line 160
Returns:
Type
string

getNode

Gets the root node of this packet
Source:
  • JSJaCPacket.js, line 52
See:
Returns:
Type
Node

getSubject

Gets the subject of this message
Source:
  • JSJaCPacket.js, line 675
Returns:
The subject of this message
Type
string

getThread

Gets the 'thread' identifier for this message
Source:
  • JSJaCPacket.js, line 661
Returns:
A thread identifier
Type
string

getTo

Gets the 'to' attribute of this packet
Source:
  • JSJaCPacket.js, line 132
Returns:
Type
string

getToJID

Gets the 'to' attribute of this packet as a JSJaCJID object
Source:
  • JSJaCPacket.js, line 146
Returns:
Type
JSJaCJID

getType

Gets the 'type' of this packet
Source:
  • JSJaCPacket.js, line 167
Returns:
Type
string

getXMLLang

Gets the 'xml:lang' of this packet
Source:
  • JSJaCPacket.js, line 174
Returns:
Type
string

getXMLNS

Gets the 'xmlns' (xml namespace) of the root node of this packet
Source:
  • JSJaCPacket.js, line 181
Returns:
Type
string

isError

Checks if packet is of type 'error'
Source:
  • JSJaCPacket.js, line 248
Returns:
'true' if this packet is of type 'error', 'false' otherwise
Type
boolean

pType

Gets the type (name of root element) of this packet, i.e. one of 'presence', 'message' or 'iq'
Source:
  • JSJaCPacket.js, line 37
Returns:
The top level tag name.
Type
string

setBody

Sets the body of the message
Parameters:
Name Type Description
body string Your message to be sent along
Source:
  • JSJaCPacket.js, line 634
Returns:
this message
Type
JSJaCMessage

setFrom

Sets the 'from' attribute of the root node of this packet. Usually this is not needed as the server will take care of this automatically.
Parameters:
Name Type Argument Description
from string <optional>
A string representing the jid of the sender of this packet.
Deprecated:
  • Yes
Source:
  • JSJaCPacket.js, line 81
Returns:
this
Type
JSJaCPacket

setID

Sets 'id' attribute of the root node of this packet.
Parameters:
Name Type Description
id string The id of the packet.
Source:
  • JSJaCPacket.js, line 96
Returns:
this
Type
JSJaCPacket

setSubject

Sets the subject of the message
Parameters:
Name Type Description
subject string Your subject to be sent along
Source:
  • JSJaCPacket.js, line 643
Returns:
this message
Type
JSJaCMessage

setThread

Sets the 'tread' attribute for this message. This is used to identify threads in chat conversations
Parameters:
Name Type Description
thread string Usually a somewhat random hash.
Source:
  • JSJaCPacket.js, line 653
Returns:
this message
Type
JSJaCMessage

setTo

Sets the 'to' attribute of the root node of this packet
Parameters:
Name Type Argument Description
to String <optional>
A string representing a jid sending this packet to. If omitted the property will be deleted thus sending to service rather than dedicated recipient.
Source:
  • JSJaCPacket.js, line 64
Returns:
this
Type
JSJaCPacket

setType

Sets the 'type' attribute of the root node of this packet.
Parameters:
Name Type Description
type string The type of the packet.
Source:
  • JSJaCPacket.js, line 108
Returns:
this
Type
JSJaCPacket

setXMLLang

Sets 'xml:lang' for this packet
Parameters:
Name Type Description
xmllang string The xml:lang of the packet.
Source:
  • JSJaCPacket.js, line 120
Returns:
this
Type
JSJaCPacket