Changeset 47d3ac4


Ignore:
Timestamp:
2006-10-31T08:25:41Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
0d3f30f
Parents:
abbd8ed
Message:

Added #defines for XML namespaces.

Location:
protocols/jabber
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/io.c

    rabbd8ed r47d3ac4  
    307307                {
    308308                        reply = xt_new_node( "starttls", NULL, NULL );
    309                         xt_add_attr( reply, "xmlns", "urn:ietf:params:xml:ns:xmpp-tls" );
     309                        xt_add_attr( reply, "xmlns", XMLNS_TLS );
    310310                        if( !jabber_write_packet( gc, reply ) )
    311311                        {
     
    355355        {
    356356                reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
    357                 xt_add_attr( reply, "xmlns", "urn:ietf:params:xml:ns:xmpp-bind" );
     357                xt_add_attr( reply, "xmlns", XMLNS_BIND );
    358358                reply = jabber_make_packet( "iq", "set", NULL, reply );
    359359                jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
     
    368368        {
    369369                reply = xt_new_node( "session", NULL, NULL );
    370                 xt_add_attr( reply, "xmlns", "urn:ietf:params:xml:ns:xmpp-session" );
     370                xt_add_attr( reply, "xmlns", XMLNS_SESSION );
    371371                reply = jabber_make_packet( "iq", "set", NULL, reply );
    372372                jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
     
    400400        /* Just ignore it when it doesn't seem to be TLS-related (is that at
    401401           all possible??). */
    402         if( !xmlns || strcmp( xmlns, "urn:ietf:params:xml:ns:xmpp-tls" ) != 0 )
     402        if( !xmlns || strcmp( xmlns, XMLNS_TLS ) != 0 )
    403403                return XT_HANDLED;
    404404       
     
    433433        {
    434434                if( !( s = xt_find_attr( c, "xmlns" ) ) ||
    435                     strcmp( s, "urn:ietf:params:xml:ns:xmpp-streams" ) != 0 )
     435                    strcmp( s, XMLNS_STREAM_ERROR ) != 0 )
    436436                        continue;
    437437               
  • protocols/jabber/iq.c

    rabbd8ed r47d3ac4  
    7777               
    7878                /* Of course this is a very essential query to support. ;-) */
    79                 if( strcmp( s, "jabber:iq:version" ) == 0 )
     79                if( strcmp( s, XMLNS_VERSION ) == 0 )
    8080                {
    8181                        xt_add_child( reply, xt_new_node( "name", "BitlBee", NULL ) );
     
    8383                        xt_add_child( reply, xt_new_node( "os", ARCH, NULL ) );
    8484                }
    85                 else if( strcmp( s, "jabber:iq:time" ) == 0 )
     85                else if( strcmp( s, XMLNS_TIME ) == 0 )
    8686                {
    8787                        time_t time_ep;
     
    9797                        xt_add_child( reply, xt_new_node( "tz", buf, NULL ) );
    9898                }
    99                 else if( strcmp( s, "http://jabber.org/protocol/disco#info" ) == 0 )
     99                else if( strcmp( s, XMLNS_DISCOVER ) == 0 )
    100100                {
    101101                        c = xt_new_node( "identity", NULL, NULL );
     
    106106                       
    107107                        c = xt_new_node( "feature", NULL, NULL );
    108                         xt_add_attr( c, "var", "jabber:iq:version" );
     108                        xt_add_attr( c, "var", XMLNS_VERSION );
    109109                        xt_add_child( reply, c );
    110110                       
    111111                        c = xt_new_node( "feature", NULL, NULL );
    112                         xt_add_attr( c, "var", "jabber:iq:time" );
     112                        xt_add_attr( c, "var", XMLNS_TIME );
    113113                        xt_add_child( reply, c );
    114114                       
    115115                        c = xt_new_node( "feature", NULL, NULL );
    116                         xt_add_attr( c, "var", "http://jabber.org/protocol/chatstates" );
     116                        xt_add_attr( c, "var", XMLNS_CHATSTATES );
    117117                        xt_add_child( reply, c );
    118118                       
     
    136136                }
    137137               
    138                 if( strcmp( s, "jabber:iq:roster" ) == 0 )
     138                if( strcmp( s, XMLNS_ROSTER ) == 0 )
    139139                {
    140140                        int bare_len = strlen( gc->acc->user );
     
    198198       
    199199        node = xt_new_node( "query", NULL, xt_new_node( "username", jd->username, NULL ) );
    200         xt_add_attr( node, "xmlns", "jabber:iq:auth" );
     200        xt_add_attr( node, "xmlns", XMLNS_AUTH );
    201201        node = jabber_make_packet( "iq", "get", NULL, node );
    202202       
     
    218218        /* Time to authenticate ourselves! */
    219219        reply = xt_new_node( "query", NULL, NULL );
    220         xt_add_attr( reply, "xmlns", "jabber:iq:auth" );
     220        xt_add_attr( reply, "xmlns", XMLNS_AUTH );
    221221        xt_add_child( reply, xt_new_node( "username", jd->username, NULL ) );
    222222        xt_add_child( reply, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
     
    322322       
    323323        node = xt_new_node( "query", NULL, NULL );
    324         xt_add_attr( node, "xmlns", "jabber:iq:roster" );
     324        xt_add_attr( node, "xmlns", XMLNS_ROSTER );
    325325        node = jabber_make_packet( "iq", "get", NULL, node );
    326326       
     
    391391       
    392392        node = xt_new_node( "vCard", NULL, NULL );
    393         xt_add_attr( node, "xmlns", "vcard-temp" );
     393        xt_add_attr( node, "xmlns", XMLNS_VCARD );
    394394        node = jabber_make_packet( "iq", "get", bare_jid, node );
    395395       
     
    536536        /* And pack it into a roster-add packet */
    537537        node = xt_new_node( "query", NULL, node );
    538         xt_add_attr( node, "xmlns", "jabber:iq:roster" );
     538        xt_add_attr( node, "xmlns", XMLNS_ROSTER );
    539539        node = jabber_make_packet( "iq", "set", NULL, node );
    540540       
     
    557557        /* And pack it into a roster-add packet */
    558558        node = xt_new_node( "query", NULL, node );
    559         xt_add_attr( node, "xmlns", "jabber:iq:roster" );
     559        xt_add_attr( node, "xmlns", XMLNS_ROSTER );
    560560        node = jabber_make_packet( "iq", "set", NULL, node );
    561561       
  • protocols/jabber/jabber.c

    rabbd8ed r47d3ac4  
    235235                   we guess when s/he pressed Enter...). */
    236236                act = xt_new_node( "active", NULL, NULL );
    237                 xt_add_attr( act, "xmlns", "http://jabber.org/protocol/chatstates" );
     237                xt_add_attr( act, "xmlns", XMLNS_CHATSTATES );
    238238                xt_add_child( node, act );
    239239               
     
    353353               
    354354                node = xt_new_node( type, NULL, NULL );
    355                 xt_add_attr( node, "xmlns", "http://jabber.org/protocol/chatstates" );
     355                xt_add_attr( node, "xmlns", XMLNS_CHATSTATES );
    356356                node = jabber_make_packet( "message", "chat", bud->full_jid, node );
    357357               
  • protocols/jabber/jabber.h

    rabbd8ed r47d3ac4  
    114114#define JABBER_CACHED_ID "BeeC"
    115115
     116/* RFC 392[01] stuff */
     117#define XMLNS_TLS          "urn:ietf:params:xml:ns:xmpp-tls"
     118#define XMLNS_SASL         "urn:ietf:params:xml:ns:xmpp-sasl"
     119#define XMLNS_BIND         "urn:ietf:params:xml:ns:xmpp-bind"
     120#define XMLNS_SESSION      "urn:ietf:params:xml:ns:xmpp-session"
     121#define XMLNS_STANZA_ERROR "urn:ietf:params:xml:ns:xmpp-stanzas"
     122#define XMLNS_STREAM_ERROR "urn:ietf:params:xml:ns:xmpp-streams"
     123#define XMLNS_ROSTER       "jabber:iq:roster"
     124
     125/* Some supported extensions/legacy stuff */
     126#define XMLNS_AUTH         "jabber:iq:auth"                     /* XEP-0078 */
     127#define XMLNS_VERSION      "jabber:iq:version"                  /* XEP-0092 */
     128#define XMLNS_TIME         "jabber:iq:time"                     /* XEP-0090 */
     129#define XMLNS_VCARD        "vcard-temp"                         /* XEP-0054 */
     130#define XMLNS_CHATSTATES   "http://jabber.org/protocol/chatstates"  /* 0085 */
     131#define XMLNS_DISCOVER     "http://jabber.org/protocol/disco#info"  /* 0030 */
     132
    116133/* iq.c */
    117134xt_status jabber_pkt_iq( struct xt_node *node, gpointer data );
  • protocols/jabber/jabber_util.c

    rabbd8ed r47d3ac4  
    104104        /* Create the "defined-condition" tag. */
    105105        c = xt_new_node( err_cond, NULL, NULL );
    106         xt_add_attr( c, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas" );
     106        xt_add_attr( c, "xmlns", XMLNS_STANZA_ERROR );
    107107       
    108108        /* Put it in an <error> tag. */
  • protocols/jabber/sasl.c

    rabbd8ed r47d3ac4  
    2424#include "jabber.h"
    2525#include "base64.h"
    26 
    27 #define SASL_NS "urn:ietf:params:xml:ns:xmpp-sasl"
    2826
    2927xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
     
    4543       
    4644        s = xt_find_attr( node, "xmlns" );
    47         if( !s || strcmp( s, SASL_NS ) != 0 )
     45        if( !s || strcmp( s, XMLNS_SASL ) != 0 )
    4846        {
    4947                signoff( gc );
     
    7068       
    7169        reply = xt_new_node( "auth", NULL, NULL );
    72         xt_add_attr( reply, "xmlns", SASL_NS );
     70        xt_add_attr( reply, "xmlns", XMLNS_SASL );
    7371       
    7472        if( sup_digest )
     
    272270       
    273271        reply = xt_new_node( "response", s, NULL );
    274         xt_add_attr( reply, "xmlns", SASL_NS );
     272        xt_add_attr( reply, "xmlns", XMLNS_SASL );
    275273       
    276274        if( !jabber_write_packet( gc, reply ) )
     
    303301       
    304302        s = xt_find_attr( node, "xmlns" );
    305         if( !s || strcmp( s, SASL_NS ) != 0 )
     303        if( !s || strcmp( s, XMLNS_SASL ) != 0 )
    306304        {
    307305                signoff( gc );
Note: See TracChangeset for help on using the changeset viewer.