|
Yate
|
General XMPP utilities. More...
#include <xmpputils.h>
Public Types | |
| enum | Presence { Probe, Subscribe, Subscribed, Unavailable, Unsubscribe, Unsubscribed, PresenceError, PresenceNone } |
| enum | MsgType { Chat, GroupChat, HeadLine, Normal, MsgError } |
| enum | IqType { IqSet, IqGet, IqResult, IqError, IqCount } |
| enum | CommandAction { CommExecute, CommCancel, CommPrev, CommNext, CommComplete } |
| enum | CommandStatus { CommExecuting, CommCompleted, CommCancelled } |
| enum | AuthMethod { AuthNone = 0x00, AuthSHA1 = 0x01, AuthMD5 = 0x02, AuthPlain = 0x04, AuthDialback = 0x08 } |
Static Public Member Functions | |
| static bool | isResponse (const XmlElement &xml) |
| static XmlElement * | createElement (const char *name, const char *text=0, const String &ns=String::empty()) |
| static XmlElement * | createElement (int type, const char *text=0) |
| static XmlElement * | createElement (const char *name, int ns, const char *text=0) |
| static XmlElement * | createElement (int type, int ns, const char *text=0) |
| static XmlElement * | createElement (const XmlElement &src, bool response, bool result) |
| static XmlElement * | createIq (IqType type, const char *from=0, const char *to=0, const char *id=0) |
| static XmlElement * | createIqResult (const char *from, const char *to, const char *id, XmlElement *child=0) |
| static XmlElement * | createIqError (const char *from, const char *to, XmlElement *&xml, int type, int error, const char *text=0) |
| static XmlElement * | createVCard (bool get, const char *from, const char *to, const char *id) |
| static XmlElement * | createCommand (CommandAction action, const char *node, const char *sessionId=0) |
| static XmlElement * | createIqDisco (bool info, bool req, const char *from, const char *to, const char *id, const char *node=0, const char *cap=0) |
| static XmlElement * | createIqVersionRes (const char *from, const char *to, const char *id, const char *name, const char *version, const char *os=0) |
| static XmlElement * | createError (int type, int error, const char *text=0) |
| static XmlElement * | createError (XmlElement *xml, int type, int error, const char *text=0) |
| static XmlElement * | createStreamError (int error, const char *text=0) |
| static XmlElement * | createRegisterQuery (IqType type, const char *from, const char *to, const char *id, XmlElement *child1=0, XmlElement *child2=0, XmlElement *child3=0) |
| static XmlElement * | createIqAuthGet (const char *id) |
| static XmlElement * | createIqAuthSet (const char *id, const char *username, const char *resource, const char *authStr, bool digest) |
| static XmlElement * | createIqAuthOffer (const char *id, bool digest=true, bool plain=false) |
| static XmlElement * | createRegisterQuery (const char *from, const char *to, const char *id, const char *username, const char *password) |
| static XmlElement * | createFailure (XMPPNamespace::Type ns, XMPPError::Type error=XMPPError::NoError) |
| static XmlElement * | createXOobUrl (const char *url, const char *desc=0) |
| static XmlElement * | createDelay (unsigned int timeSec, const char *from=0, unsigned int fractions=0, const char *text=0) |
| static bool | remove (XmlElement &xml) |
| static bool | required (XmlElement &xml) |
| static int | priority (XmlElement &xml, int defVal=0) |
| static void | setPriority (XmlElement &xml, const char *prio) |
| static int | xmlns (XmlElement &xml) |
| static bool | hasDefaultXmlns (const XmlElement &xml, int ns) |
| static bool | hasXmlns (const XmlElement &xml, int ns) |
| static bool | setXmlns (XmlElement &xml, const String &name=String::empty(), bool addAttr=false, int ns=XMPPNamespace::Count) |
| static bool | setStreamXmlns (XmlElement &xml, bool addAttr=true) |
| static bool | setDbXmlns (XmlElement &xml) |
| static XmlElement * | findFirstChild (const XmlElement &xml, int t=XmlTag::Count, int ns=XMPPNamespace::Count) |
| static XmlElement * | findNextChild (const XmlElement &xml, XmlElement *start, int t=XmlTag::Count, int ns=XMPPNamespace::Count) |
| static void | decodeError (XmlElement *xml, int ns=XMPPNamespace::Count, String *error=0, String *text=0) |
| static void | decodeError (XmlElement *xml, String &error, String &text) |
| static void | encodeDateTimeSec (String &buf, unsigned int timeSec, unsigned int fractions=0) |
| static unsigned int | decodeDateTimeSec (const String &time, unsigned int *fractions=0) |
| static unsigned int | decodeDateTimeSecXDelay (const String &time) |
| static void | print (String &xmlStr, XmlChild &xml, bool verbose) |
| static void | toList (XmlElement &xml, NamedList &dest, const char *prefix) |
| static bool | split (NamedList &dest, const char *src, const char sep, bool nameFirst) |
| static int | decodeFlags (const String &src, const TokenDict *dict) |
| static void | buildFlags (String &dest, int src, const TokenDict *dict) |
| static bool | addChidren (XmlElement *dest, ObjList &list) |
| static XmlElement * | createEntityCaps (const String &hash, const char *node) |
| static XmlElement * | createEntityCapsGTalkV1 (const char *node=0, bool muc=false) |
| static XmlElement * | createPresence (const char *from, const char *to, Presence type=PresenceNone) |
| static XmlElement * | createMessage (const char *type, const char *from, const char *to, const char *id, const char *body) |
| static XmlElement * | createMessage (MsgType type, const char *from, const char *to, const char *id, const char *body) |
| static XmlElement * | createDialbackKey (const char *from, const char *to, const char *key) |
| static XmlElement * | createDialbackResult (const char *from, const char *to, XMPPError::Type rsp=XMPPError::NoError) |
| static XmlElement * | createDialbackVerify (const char *from, const char *to, const char *id, const char *key) |
| static XmlElement * | createDialbackVerifyRsp (const char *from, const char *to, const char *id, XMPPError::Type rsp=XMPPError::NoError) |
| static int | decodeDbRsp (XmlElement *xml) |
| static XmlElement * | createSubject (const char *subject) |
| static const String & | subject (XmlElement &xml) |
| static XmlElement * | createBody (const char *body, int ns=XMPPNamespace::Count) |
| static const String & | body (XmlElement &xml, int ns=XMPPNamespace::Count) |
| static XmlElement * | createParameter (const char *name, const char *value, const char *tag="parameter") |
| static XmlElement * | createParameter (const NamedString &pair, const char *tag="parameter") |
| static int | ns (const XmlElement &xml) |
| static int | tag (const XmlElement &xml) |
| static bool | getTag (const XmlElement &xml, int &tag, int &ns) |
| static bool | isTag (const XmlElement &xml, int tag, int ns) |
| static bool | isUnprefTag (const XmlElement &xml, int tag) |
| static bool | isStanza (const XmlElement &xml) |
| static XmlElement * | getXml (GenObject *gen) |
| static XmlElement * | getXml (const String &data) |
| static XmlElement * | getXml (NamedList &list, const char *param="xml", const char *extra="data") |
| static XmlElement * | getPresenceXml (NamedList &list, const char *param="xml", const char *extra="data", Presence type=PresenceNone, bool build=true) |
| static XmlElement * | getChatXml (NamedList &list, const char *param="xml", const char *extra="data", bool build=true) |
| static int | cmpBytes (const String &s1, const String &s2) |
| static Presence | presenceType (const char *text) |
| static const char * | presenceText (Presence presence) |
| static MsgType | msgType (const char *text) |
| static const char * | msgText (MsgType msg) |
| static IqType | iqType (const char *text) |
| static int | authMeth (const char *text, int defVal=AuthNone) |
Static Public Attributes | |
| static XMPPNamespace | s_ns |
| static XMPPError | s_error |
| static XmlTag | s_tag |
| static const TokenDict | s_presence [] |
| static const TokenDict | s_msg [] |
| static const TokenDict | s_iq [] |
| static const TokenDict | s_commandAction [] |
| static const TokenDict | s_commandStatus [] |
| static const TokenDict | s_authMeth [] |
General XMPP utilities.
This class is a general XMPP utilities
| enum AuthMethod |
Authentication methods
| enum CommandAction |
Command action enumeration
| enum CommandStatus |
Command status enumeration
| enum IqType |
Iq type enumeration
| enum Presence |
Presence type enumeration
| static bool addChidren | ( | XmlElement * | dest, |
| ObjList & | list | ||
| ) | [static] |
Add child elements from a list to a destination element
| dest | Destination XmlElement |
| list | A list containing XML elements |
| static int authMeth | ( | const char * | text, |
| int | defVal = AuthNone |
||
| ) | [inline, static] |
Get the authentication method associated with a given text
| text | The text to check |
| defVal | Default value to return if not found |
References TelEngine::lookup().
| static const String& body | ( | XmlElement & | xml, |
| int | ns = XMPPNamespace::Count |
||
| ) | [static] |
Retrieve the text of an element's body child
| xml | The element |
| ns | Optional body namespace to match (default: match parent's namespace) |
| static void buildFlags | ( | String & | dest, |
| int | src, | ||
| const TokenDict * | dict | ||
| ) | [static] |
Encode a mask of flags to a comma separated list of names
| dest | Destination string |
| src | Source mask |
| dict | Dictionary containing flag names and values |
Byte compare 2 strings.
| s1 | The first string |
| s2 | The second string |
| static XmlElement* createBody | ( | const char * | body, |
| int | ns = XMPPNamespace::Count |
||
| ) | [inline, static] |
Build a 'body' xml element
| body | Element text |
| ns | Optional namespace |
| static XmlElement* createCommand | ( | CommandAction | action, |
| const char * | node, | ||
| const char * | sessionId = 0 |
||
| ) | [static] |
Create a 'command' element
| action | The command action |
| node | The command |
| sessionId | Optional session ID for the command |
| static XmlElement* createDelay | ( | unsigned int | timeSec, |
| const char * | from = 0, |
||
| unsigned int | fractions = 0, |
||
| const char * | text = 0 |
||
| ) | [static] |
Create a 'delay' element as defined in XEP-0203
| timeSec | The time to encode (in seconds) |
| from | Optional 'from' attribute |
| fractions | Optional second fractions |
| text | Optional xml element text |
| static XmlElement* createDialbackKey | ( | const char * | from, |
| const char * | to, | ||
| const char * | key | ||
| ) | [static] |
Build a dialback 'db:result' xml element used to send a dialback key
| from | The sender |
| to | The recipient |
| key | The dialback key |
| static XmlElement* createDialbackResult | ( | const char * | from, |
| const char * | to, | ||
| XMPPError::Type | rsp = XMPPError::NoError |
||
| ) | [static] |
Build a dialback 'db:result' xml element used to send a dialback key response
| from | The sender |
| to | The recipient |
| rsp | The response as enumeration: set it to NoError if valid, NotAuthorized if invalid or any other error to send a db:result error type |
| static XmlElement* createDialbackVerify | ( | const char * | from, |
| const char * | to, | ||
| const char * | id, | ||
| const char * | key | ||
| ) | [static] |
Build a dialback 'db:verify' xml element
| from | The sender |
| to | The recipient |
| id | The 'id' attribute (stream id) |
| key | The dialback key |
| static XmlElement* createDialbackVerifyRsp | ( | const char * | from, |
| const char * | to, | ||
| const char * | id, | ||
| XMPPError::Type | rsp = XMPPError::NoError |
||
| ) | [static] |
Build a dialback 'db:verify' response xml element
| from | The sender |
| to | The recipient |
| id | The 'id' attribute (stream id) |
| rsp | The response as enumeration: set it to NoError if valid, NotAuthorized if invalid or any other error to send a db:verify error type |
| static XmlElement* createElement | ( | const char * | name, |
| const char * | text = 0, |
||
| const String & | ns = String::empty() |
||
| ) | [inline, static] |
Create an XML element
| name | Element's name |
| text | Optional text for the element |
| ns | Optional element namespace |
References XmlElement::addText(), String::empty(), TelEngine::null(), and XmlElement::setXmlns().
| static XmlElement* createElement | ( | int | type, |
| const char * | text = 0 |
||
| ) | [inline, static] |
Create an XML element
| type | Element's type |
| text | Optional text for the element |
References XMPPUtils::createElement().
Referenced by XMPPUtils::createElement().
| static XmlElement* createElement | ( | const char * | name, |
| int | ns, | ||
| const char * | text = 0 |
||
| ) | [inline, static] |
Create an XML element with an 'xmlns' attribute
| name | Element's name |
| ns | Optional 'xmlns' attribute as enumeration |
| text | Optional text for the element |
References String::empty().
| static XmlElement* createElement | ( | int | type, |
| int | ns, | ||
| const char * | text = 0 |
||
| ) | [inline, static] |
Create an XML element with an 'xmlns' attribute
| type | Element's type |
| ns | 'xmlns' attribute as enumeration |
| text | Optional text for the element |
References XMPPUtils::createElement().
Referenced by XMPPUtils::createElement().
| static XmlElement* createElement | ( | const XmlElement & | src, |
| bool | response, | ||
| bool | result | ||
| ) | [static] |
Partially build an XML element from another one. Copy tag and 'to', 'from', 'type', 'id' attributes
| src | Source element |
| response | True to reverse 'to' and 'from' attributes |
| result | True to set type to "result", false to set it to "error". Ignored if response is false |
| static XmlElement* createEntityCaps | ( | const String & | hash, |
| const char * | node | ||
| ) | [static] |
Create a 'c' entity capability element as defined in XEP 0115
| hash | The 'ver' attribute |
| node | The 'node' attribute |
| static XmlElement* createEntityCapsGTalkV1 | ( | const char * | node = 0, |
| bool | muc = false |
||
| ) | [static] |
Create a 'c' entity capability element as defined by GTalk
| node | Optional node attribute, defaults to GTalk's node |
| muc | Advertise MUC capability |
| static XmlElement* createError | ( | int | type, |
| int | error, | ||
| const char * | text = 0 |
||
| ) | [static] |
Create a 'error' element
| type | Error type |
| error | The error |
| text | Optional text to add to the error element |
| static XmlElement* createError | ( | XmlElement * | xml, |
| int | type, | ||
| int | error, | ||
| const char * | text = 0 |
||
| ) | [static] |
Create an error from a received element. Consume the received element. Reverse 'to' and 'from' attributes
| xml | Received element |
| type | Error type |
| error | The error |
| text | Optional text to add to the error element |
| static XmlElement* createFailure | ( | XMPPNamespace::Type | ns, |
| XMPPError::Type | error = XMPPError::NoError |
||
| ) | [inline, static] |
Create a failure element
| ns | Element namespace |
| error | Optional error |
References XmlElement::addChild().
| static XmlElement* createIq | ( | IqType | type, |
| const char * | from = 0, |
||
| const char * | to = 0, |
||
| const char * | id = 0 |
||
| ) | [static] |
Create an 'iq' element
| type | Iq type as enumeration |
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| static XmlElement* createIqAuthGet | ( | const char * | id | ) | [inline, static] |
Build a jabber:iq:auth 'iq' get element
| id | Element 'id' attribute |
References XmlElement::addChild().
| static XmlElement* createIqAuthOffer | ( | const char * | id, |
| bool | digest = true, |
||
| bool | plain = false |
||
| ) | [static] |
Build a jabber:iq:auth 'iq' offer in response to a 'get' request
| id | Element 'id' attribute |
| digest | Offer digest authentication |
| plain | Offer plain password authentication |
| static XmlElement* createIqAuthSet | ( | const char * | id, |
| const char * | username, | ||
| const char * | resource, | ||
| const char * | authStr, | ||
| bool | digest | ||
| ) | [static] |
Build a jabber:iq:auth 'iq' set element
| id | Element 'id' attribute |
| username | The username |
| resource | The resource |
| authStr | Authentication string |
| digest | True if authentication string is a digest, false if it's a plain password |
| static XmlElement* createIqDisco | ( | bool | info, |
| bool | req, | ||
| const char * | from, | ||
| const char * | to, | ||
| const char * | id, | ||
| const char * | node = 0, |
||
| const char * | cap = 0 |
||
| ) | [static] |
Create a disco info/items 'iq' element with a 'query' child
| info | True to create a query info request. False to create a query items request |
| req | True to create a request (type=get), false to create a response (type=result) |
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| node | Optional 'node' attribute |
| cap | Optional capability to be set as 'node' suffix |
| static XmlElement* createIqError | ( | const char * | from, |
| const char * | to, | ||
| XmlElement *& | xml, | ||
| int | type, | ||
| int | error, | ||
| const char * | text = 0 |
||
| ) | [static] |
Create an 'iq' error from a received element. Consume the received element. Add the given element to the error stanza if the 'id' attribute is missing
| from | The 'from' attribute |
| to | The 'to' attribute |
| xml | Received element |
| type | Error type |
| error | The error |
| text | Optional text to add to the error element |
| static XmlElement* createIqResult | ( | const char * | from, |
| const char * | to, | ||
| const char * | id, | ||
| XmlElement * | child = 0 |
||
| ) | [inline, static] |
Create an 'iq' result element
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| child | Optional element child (will be consumed) |
References XmlElement::addChild().
| static XmlElement* createIqVersionRes | ( | const char * | from, |
| const char * | to, | ||
| const char * | id, | ||
| const char * | name, | ||
| const char * | version, | ||
| const char * | os = 0 |
||
| ) | [static] |
Create a version 'iq' result as defined in XEP-0092
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| name | Program name |
| version | Program version |
| os | Optional operating system |
| static XmlElement* createMessage | ( | const char * | type, |
| const char * | from, | ||
| const char * | to, | ||
| const char * | id, | ||
| const char * | body | ||
| ) | [static] |
Create a 'message' element
| type | Message type string |
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| body | The message body |
| static XmlElement* createMessage | ( | MsgType | type, |
| const char * | from, | ||
| const char * | to, | ||
| const char * | id, | ||
| const char * | body | ||
| ) | [inline, static] |
Create a 'message' element
| type | Message type as enumeration |
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| body | The message body |
References XMPPUtils::createMessage().
Referenced by XMPPUtils::createMessage().
| static XmlElement* createParameter | ( | const char * | name, |
| const char * | value, | ||
| const char * | tag = "parameter" |
||
| ) | [inline, static] |
Build a name/value parameter xml element
| name | The 'name' attribute |
| value | The value parameter |
| tag | Optional element tag (defaults to 'parameter') |
References XmlElement::setAttributeValid().
| static XmlElement* createParameter | ( | const NamedString & | pair, |
| const char * | tag = "parameter" |
||
| ) | [inline, static] |
Build a name/value parameter xml element
| pair | The name/value pair |
| tag | Optional element tag (defaults to 'parameter') |
References XMPPUtils::createParameter(), and NamedString::name().
Referenced by XMPPUtils::createParameter().
| static XmlElement* createPresence | ( | const char * | from, |
| const char * | to, | ||
| Presence | type = PresenceNone |
||
| ) | [static] |
Create an 'presence' element
| from | The 'from' attribute |
| to | The 'to' attribute |
| type | Presence type as enumeration |
| static XmlElement* createRegisterQuery | ( | IqType | type, |
| const char * | from, | ||
| const char * | to, | ||
| const char * | id, | ||
| XmlElement * | child1 = 0, |
||
| XmlElement * | child2 = 0, |
||
| XmlElement * | child3 = 0 |
||
| ) | [static] |
Build a register query element
| type | Iq type as enumeration |
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| child1 | Optional child of query element |
| child2 | Optional child of query element |
| child3 | Optional child of query element |
| static XmlElement* createRegisterQuery | ( | const char * | from, |
| const char * | to, | ||
| const char * | id, | ||
| const char * | username, | ||
| const char * | password | ||
| ) | [inline, static] |
Build an register query element used to create/set username/password
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| username | The username |
| password | The password |
| static XmlElement* createStreamError | ( | int | error, |
| const char * | text = 0 |
||
| ) | [static] |
Create a 'stream:error' element
| error | The XMPP defined condition |
| text | Optional text to add to the error |
| static XmlElement* createSubject | ( | const char * | subject | ) | [inline, static] |
| static XmlElement* createVCard | ( | bool | get, |
| const char * | from, | ||
| const char * | to, | ||
| const char * | id | ||
| ) | [static] |
Create an 'iq' element with a 'vcard' child
| get | True to set the iq's type to 'get', false to set it to 'set' |
| from | The 'from' attribute |
| to | The 'to' attribute |
| id | The 'id' attribute |
| static XmlElement* createXOobUrl | ( | const char * | url, |
| const char * | desc = 0 |
||
| ) | [inline, static] |
Create an 'x' jabber:x:oob url element as described in XEP-0066
| url | The URL |
| desc | Optional description |
References XmlElement::addChild().
| static unsigned int decodeDateTimeSec | ( | const String & | time, |
| unsigned int * | fractions = 0 |
||
| ) | [static] |
Decode a date/time profile as defined in XEP-0082 and XML Schema Part 2: Datatypes Second Edition to EPOCH time
| time | The date/time string |
| fractions | Pointer to integer to be filled with second fractions, if present |
| static unsigned int decodeDateTimeSecXDelay | ( | const String & | time | ) | [static] |
Decode a date/time stamp as defined in XEP-0091 (jabber:x:delay)
| time | The date/time string |
| static int decodeDbRsp | ( | XmlElement * | xml | ) | [static] |
Decode a dialback verify or result response element
| xml | The element |
| static void decodeError | ( | XmlElement * | xml, |
| int | ns = XMPPNamespace::Count, |
||
| String * | error = 0, |
||
| String * | text = 0 |
||
| ) | [static] |
Find an error child of a given element and decode it
| xml | The element |
| ns | Expected error condition namespace. If not set, defaults to stream error namespace if the element is a stream error or to stanza error namespace otherwise |
| error | Optional string to be filled with error tag |
| text | Optional string to be filled with error text |
| static void decodeError | ( | XmlElement * | xml, |
| String & | error, | ||
| String & | text | ||
| ) | [static] |
Decode a stream error or stanza error
| xml | The element |
| error | The error condition |
| text | The stanza's error or error text |
| static int decodeFlags | ( | const String & | src, |
| const TokenDict * | dict | ||
| ) | [static] |
Decode a comma separated list of flags and put them into an integer mask
| src | Source string |
| dict | Dictionary containing flag names and values |
Referenced by XMPPDirVal::replace().
| static void encodeDateTimeSec | ( | String & | buf, |
| unsigned int | timeSec, | ||
| unsigned int | fractions = 0 |
||
| ) | [static] |
Encode EPOCH time given in seconds to a date/time profile as defined in XEP-0082 and XML Schema Part 2: Datatypes Second Edition
| buf | Destination string |
| timeSec | The time to encode (in seconds) |
| fractions | Optional second fractions |
| static XmlElement* findFirstChild | ( | const XmlElement & | xml, |
| int | t = XmlTag::Count, |
||
| int | ns = XMPPNamespace::Count |
||
| ) | [static] |
Find an element's first child element in a given namespace
| xml | Element |
| t | Optional element tag as enumeration |
| ns | Optional element namespace as enumeration |
| static XmlElement* findNextChild | ( | const XmlElement & | xml, |
| XmlElement * | start, | ||
| int | t = XmlTag::Count, |
||
| int | ns = XMPPNamespace::Count |
||
| ) | [static] |
Find an element's next child element
| xml | Element |
| start | Starting child |
| t | Optional element tag as enumeration |
| ns | Optional element namespace as enumeration |
| static XmlElement* getChatXml | ( | NamedList & | list, |
| const char * | param = "xml", |
||
| const char * | extra = "data", |
||
| bool | build = true |
||
| ) | [static] |
Retrieve a chat (message) xml element from a list parameter. Clear the given parameter from list if an XmlElement is found. Try to build (parse) from an extra parameter if not found. Build a message stanza from parameters if an element is not found
| list | The list of parameters |
| param | The name of the parameter with the xml element |
| extra | Optional parameter containing xml string data |
| build | True to build a message stanza if an element is not found |
| static XmlElement* getPresenceXml | ( | NamedList & | list, |
| const char * | param = "xml", |
||
| const char * | extra = "data", |
||
| Presence | type = PresenceNone, |
||
| bool | build = true |
||
| ) | [static] |
Retrieve a presence xml element from a list parameter. Clear the given parameter from list if an XmlElement is found. Try to build (parse) from an extra parameter if not found. Build a presence stanza from parameters if an element is not found
| list | The list of parameters |
| param | The name of the parameter with the xml element |
| extra | Optional parameter containing xml string data |
| type | Presence type to build |
| build | True to build a message stanza if an element is not found |
| static bool getTag | ( | const XmlElement & | xml, |
| int & | tag, | ||
| int & | ns | ||
| ) | [inline, static] |
Get an XML element's tag and namespace
| xml | The element to check |
| tag | Element tag as enumeration |
| ns | Element namespace as enumeration |
References XmlElement::getTag().
| static XmlElement* getXml | ( | GenObject * | gen | ) | [static] |
Retrieve an xml element from a NamedPointer. Release NamedPointer ownership if found
| gen | The object to be processed |
| static XmlElement* getXml | ( | const String & | data | ) | [static] |
Parse a string to an XmlElement
| data | XML data to parse |
| static XmlElement* getXml | ( | NamedList & | list, |
| const char * | param = "xml", |
||
| const char * | extra = "data" |
||
| ) | [static] |
Retrieve an xml element from a list parameter. Clear the given parameter from list if an XmlElement is found Try to build (parse) from an extra parameter if not found
| list | The list of parameters |
| param | The name of the parameter with the xml element |
| extra | Optional parameter containing xml string data |
| static bool hasDefaultXmlns | ( | const XmlElement & | xml, |
| int | ns | ||
| ) | [inline, static] |
Check if the given element has a given default namespace
| xml | Element to check |
| ns | Namespace value to check |
References XmlElement::s_ns, and XmlElement::xmlnsAttribute().
| static bool hasXmlns | ( | const XmlElement & | xml, |
| int | ns | ||
| ) | [inline, static] |
Check if the given element has a given namespace
| xml | Element to check |
| ns | Namespace value to check |
References XmlElement::hasXmlns().
Get the type of an 'iq' stanza as enumeration
| text | The text to check |
References TelEngine::lookup().
| static bool isResponse | ( | const XmlElement & | xml | ) | [inline, static] |
Check if an xml element has type 'result' or 'error'
| xml | The element to check |
References XmlElement::getAttribute().
| static bool isStanza | ( | const XmlElement & | xml | ) | [inline, static] |
Check if a given element is a stanza one ('iq', 'message' or 'presence')
| xml | The element to check |
| static bool isTag | ( | const XmlElement & | xml, |
| int | tag, | ||
| int | ns | ||
| ) | [inline, static] |
Check if an xml element has a given tag (without prefix) and namespace
| xml | The element to check |
| tag | Tag to check |
| ns | Namespace to check |
| static bool isUnprefTag | ( | const XmlElement & | xml, |
| int | tag | ||
| ) | [inline, static] |
Check if an xml element has a given tag (without prefix)
| xml | The element to check |
| tag | Tag to check |
References XmlElement::unprefixedTag().
Get the text from a message type
| msg | The message type |
References TelEngine::lookup().
Get the type of a 'message' stanza
| text | The text to check |
References TelEngine::lookup().
| static int ns | ( | const XmlElement & | xml | ) | [inline, static] |
Get an element's namespace
| xml | The element |
References XmlElement::xmlns().
| static const char* presenceText | ( | Presence | presence | ) | [inline, static] |
Get the text from a presence type
| presence | The presence type |
References TelEngine::lookup().
| static Presence presenceType | ( | const char * | text | ) | [inline, static] |
Get the type of a 'presence' stanza as enumeration
| text | The text to check |
References TelEngine::lookup().
Print an XmlElement to a string
| xmlStr | The destination string |
| xml | The xml to print |
| verbose | True to print XML data on multiple lines |
| static int priority | ( | XmlElement & | xml, |
| int | defVal = 0 |
||
| ) | [static] |
Check if an element has a child with 'priority' tag
| xml | The element to check |
| defVal | Default value to return if not found or invalid integer |
| static bool remove | ( | XmlElement & | xml | ) | [inline, static] |
Check if an element has a child with 'remove' tag
| xml | The element to check |
| static bool required | ( | XmlElement & | xml | ) | [inline, static] |
Check if an element has a child with 'required' tag
| xml | The element to check |
| static bool setDbXmlns | ( | XmlElement & | xml | ) | [inline, static] |
Set the 'db' namespace to an element
| xml | Element |
| static void setPriority | ( | XmlElement & | xml, |
| const char * | prio | ||
| ) | [inline, static] |
Add a 'priority' child to an element
| xml | The element to set |
| prio | Priority text |
References XmlElement::addChild().
| static bool setStreamXmlns | ( | XmlElement & | xml, |
| bool | addAttr = true |
||
| ) | [inline, static] |
Set the 'stream' namespace to an element
| xml | Element |
| addAttr | True to add the xmlns attribute |
| static bool setXmlns | ( | XmlElement & | xml, |
| const String & | name = String::empty(), |
||
| bool | addAttr = false, |
||
| int | ns = XMPPNamespace::Count |
||
| ) | [inline, static] |
Set an element's namespace
| xml | Element |
| name | Namespace attribute name |
| addAttr | True to add the namespace attribute value |
| ns | Namespace value as enumeration |
References XmlElement::setXmlns().
Split a string at a delimiter character and fills a named list with its parts Skip empty parts
| dest | The destination NamedList |
| src | Pointer to the string |
| sep | The delimiter |
| nameFirst | True to add the parts as name and index as value. False to do the other way |
| static const String& subject | ( | XmlElement & | xml | ) | [inline, static] |
Get an element's subject (the text of the first 'subject' child)
| xml | The element |
References String::empty(), and XmlElement::getText().
| static int tag | ( | const XmlElement & | xml | ) | [inline, static] |
Get an XML tag enumeration value associated with an element's tag
| xml | The element to check |
References XmlElement::getTag().
| static void toList | ( | XmlElement & | xml, |
| NamedList & | dest, | ||
| const char * | prefix | ||
| ) | [static] |
Put an element's name, text and attributes to a list of parameters
| xml | The element |
| dest | Destination list |
| prefix | Prefix to add to parameters |
| static int xmlns | ( | XmlElement & | xml | ) | [inline, static] |
Get an element's namespace
| xml | Element |
References XmlElement::xmlns().
const TokenDict s_authMeth[] [static] |
Authentication methods names
const TokenDict s_commandAction[] [static] |
Keep the command actions
const TokenDict s_commandStatus[] [static] |
Keep the command status
XMPPNamespace s_ns [static] |
Namespaces
const TokenDict s_presence[] [static] |
Keep the types of 'presence' stanzas
1.7.6.1