Changeset 36e9f62 for protocols


Ignore:
Timestamp:
2006-10-07T17:46:28Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
038d17f
Parents:
090f1cb
Message:

Added SRV lookups to automatically find out the correct server for a
domain.

Location:
protocols/jabber
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r090f1cb r36e9f62  
    5959        struct gaim_connection *gc = new_gaim_conn( acc );
    6060        struct jabber_data *jd = g_new0( struct jabber_data, 1 );
     61        struct ns_srv_reply *srv = NULL;
     62        char *connect_to;
    6163       
    6264        jd->gc = gc;
     
    7981        jd->node_cache = xt_new_node( "cache", NULL, NULL );
    8082       
     83        /* Figure out the hostname to connect to. */
     84        if( acc->server )
     85                connect_to = acc->server;
     86        else if( ( srv = srv_lookup( "xmpp-client", "tcp", jd->server ) ) ||
     87                 ( srv = srv_lookup( "jabber-client", "tcp", jd->server ) ) )
     88                connect_to = srv->name;
     89        else
     90                connect_to = jd->server;
     91       
     92        /* For non-SSL connections we can try to use the port # from the SRV
     93           reply, but let's not do that when using SSL, SSL usually runs on
     94           non-standard ports... */
    8195        if( set_getbool( &acc->set, "ssl" ) )
    8296        {
    83                 jd->ssl = ssl_connect( acc->server ? acc->server : jd->server, set_getint( &acc->set, "port" ), jabber_connected_ssl, gc );
     97                jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, gc );
    8498                jd->fd = ssl_getfd( jd->ssl );
    8599        }
    86100        else
    87101        {
    88                 jd->fd = proxy_connect( acc->server ? acc->server : jd->server, set_getint( &acc->set, "port" ), jabber_connected_plain, gc );
    89         }
     102                jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, gc );
     103        }
     104       
     105        g_free( srv );
    90106}
    91107
  • protocols/jabber/presence.c

    r090f1cb r36e9f62  
    3838                *s = 0;
    3939       
     40        /* Will implement better parsing of away states/msgs when we
     41           finally do those API changes. Which will probably be after
     42           merging this module into the main tree. */
    4043        if( type == NULL )
    4144                serv_got_update( gc, from, 1, 0, 0, 0, 0, 0 );
     
    8487       
    8588        node = jabber_make_packet( "presence", NULL, NULL, NULL );
     89        xt_add_child( node, xt_new_node( "priority", set_getstr( &gc->acc->set, "priority" ), NULL ) );
    8690        if( show && *show )
    8791                xt_add_child( node, xt_new_node( "show", show, NULL ) );
    8892        if( status )
    8993                xt_add_child( node, xt_new_node( "status", status, NULL ) );
    90         /* if( set_getint( &gc->acc->set, "priority" ) != 0 ) */
    91         /* Let's just send this every time... */
    92                 xt_add_child( node, xt_new_node( "priority", set_getstr( &gc->acc->set, "priority" ), NULL ) );
    9394       
    9495        st = jabber_write_packet( gc, node );
Note: See TracChangeset for help on using the changeset viewer.