Changeset 36e9f62
- Timestamp:
- 2006-10-07T17:46:28Z (18 years ago)
- Branches:
- master
- Children:
- 038d17f
- Parents:
- 090f1cb
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r090f1cb r36e9f62 318 318 319 319 echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings 320 321 for i in /lib /usr/lib /usr/local/lib; do 322 if [ -e $i/libresolv.a ]; then 323 echo '#define HAVE_RESOLV_A' >> config.h 324 echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings 325 break 326 fi 327 done 320 328 321 329 STORAGES="text xml" -
lib/misc.c
r090f1cb r36e9f62 39 39 #include <glib.h> 40 40 #include <time.h> 41 42 #ifdef HAVE_RESOLV_A 43 #include <arpa/nameser.h> 44 #include <resolv.h> 45 #endif 41 46 42 47 void strip_linefeed(gchar *text) … … 488 493 return 0; 489 494 } 495 496 struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain ) 497 { 498 struct ns_srv_reply *reply = NULL; 499 #ifdef HAVE_RESOLV_A 500 char name[1024]; 501 unsigned char querybuf[1024]; 502 const unsigned char *buf; 503 ns_msg nsh; 504 ns_rr rr; 505 int i, len, size; 506 507 g_snprintf( name, sizeof( name ), "_%s._%s.%s", service, protocol, domain ); 508 509 if( ( size = res_query( name, ns_c_in, ns_t_srv, querybuf, sizeof( querybuf ) ) ) <= 0 ) 510 return NULL; 511 512 if( ns_initparse( querybuf, size, &nsh ) != 0 ) 513 return NULL; 514 515 if( ns_parserr( &nsh, ns_s_an, 0, &rr ) != 0 ) 516 return NULL; 517 518 size = ns_rr_rdlen( rr ); 519 buf = ns_rr_rdata( rr ); 520 521 len = 0; 522 for( i = 6; i < size && buf[i]; i += buf[i] + 1 ) 523 len += buf[i] + 1; 524 525 if( i > size ) 526 return NULL; 527 528 reply = g_malloc( sizeof( struct ns_srv_reply ) + len ); 529 memcpy( reply->name, buf + 7, len ); 530 531 for( i = buf[6]; i < len && buf[7+i]; i += buf[7+i] + 1 ) 532 reply->name[i] = '.'; 533 534 if( i > len ) 535 { 536 g_free( reply ); 537 return NULL; 538 } 539 540 reply->prio = ( buf[0] << 8 ) | buf[1]; 541 reply->weight = ( buf[2] << 8 ) | buf[3]; 542 reply->port = ( buf[4] << 8 ) | buf[5]; 543 #endif 544 545 return reply; 546 } -
lib/misc.h
r090f1cb r36e9f62 30 30 #include <time.h> 31 31 32 struct ns_srv_reply 33 { 34 int prio; 35 int weight; 36 int port; 37 char name[]; 38 }; 39 32 40 G_MODULE_EXPORT void strip_linefeed( gchar *text ); 33 41 G_MODULE_EXPORT char *add_cr( char *text ); … … 54 62 G_MODULE_EXPORT int bool2int( char *value ); 55 63 64 G_MODULE_EXPORT struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain ); 65 56 66 #endif -
protocols/jabber/jabber.c
r090f1cb r36e9f62 59 59 struct gaim_connection *gc = new_gaim_conn( acc ); 60 60 struct jabber_data *jd = g_new0( struct jabber_data, 1 ); 61 struct ns_srv_reply *srv = NULL; 62 char *connect_to; 61 63 62 64 jd->gc = gc; … … 79 81 jd->node_cache = xt_new_node( "cache", NULL, NULL ); 80 82 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... */ 81 95 if( set_getbool( &acc->set, "ssl" ) ) 82 96 { 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 ); 84 98 jd->fd = ssl_getfd( jd->ssl ); 85 99 } 86 100 else 87 101 { 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 ); 90 106 } 91 107 -
protocols/jabber/presence.c
r090f1cb r36e9f62 38 38 *s = 0; 39 39 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. */ 40 43 if( type == NULL ) 41 44 serv_got_update( gc, from, 1, 0, 0, 0, 0, 0 ); … … 84 87 85 88 node = jabber_make_packet( "presence", NULL, NULL, NULL ); 89 xt_add_child( node, xt_new_node( "priority", set_getstr( &gc->acc->set, "priority" ), NULL ) ); 86 90 if( show && *show ) 87 91 xt_add_child( node, xt_new_node( "show", show, NULL ) ); 88 92 if( status ) 89 93 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 ) );93 94 94 95 st = jabber_write_packet( gc, node );
Note: See TracChangeset
for help on using the changeset viewer.