Changes in / [cdca30b:4ff0966]
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
rcdca30b r4ff0966 169 169 fi 170 170 171 GLIB=0172 173 171 if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then 174 172 cat<<EOF>>Makefile.settings … … 176 174 CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` 177 175 EOF 178 echo '#define GLIB2' >> config.h 179 GLIB=2 180 elif type glib-config > /dev/null 2> /dev/null; then 181 cat<<EOF>>Makefile.settings 182 EFLAGS+=`glib-config --libs` 183 CFLAGS+=`glib-config --cflags` 184 EOF 185 echo '#define GLIB1' >> config.h 186 GLIB=1 187 else 188 echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)' 176 else 177 echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' 189 178 exit 1; 190 179 fi 191 192 if [ GLIB = 1 -o -r /usr/include/iconv.h ]; then193 :;194 elif [ -r /usr/local/include/iconv.h ]; then195 echo CFLAGS+=-I/usr/local/include >> Makefile.settings196 else197 echo198 echo 'Warning: Could not find iconv.h, you might have to install it and/or modify'199 echo 'Makefile.settings to tell where this file is.'200 fi201 202 180 203 181 if [ "$events" = "libevent" ]; then … … 223 201 fi 224 202 echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings 225 226 203 227 204 detect_gnutls() … … 420 397 ;; 421 398 *BSD ) 422 echo 'EFLAGS+=-liconv' >> Makefile.settings; 399 ;; 400 Darwin ) 401 ;; 402 IRIX ) 423 403 ;; 424 404 SunOS ) 425 405 echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings 426 406 echo 'STRIP=\# skip strip' >> Makefile.settings 427 echo 'EFLAGS+=-liconv' >> Makefile.settings;428 ;;429 Darwin )430 echo 'EFLAGS+=-liconv' >> Makefile.settings;431 ;;432 IRIX )433 407 ;; 434 408 CYGWIN* ) -
doc/README
rcdca30b r4ff0966 47 47 48 48 BitlBee's only real dependency is GLib. This is available on virtually every 49 platform. Any recent version of GLib ( including 1.x versions) will work.49 platform. Any recent version of GLib (2.0 or higher) will work. 50 50 51 51 These days, MSN Messenger clients have to connect to the MS Passport servers -
irc_commands.c
rcdca30b r4ff0966 321 321 { 322 322 user_t *u; 323 char buff[IRC_MAX_LINE] ;323 char buff[IRC_MAX_LINE], *s; 324 324 int lenleft, i; 325 325 … … 331 331 for( i = 1; cmd[i]; i ++ ) 332 332 { 333 if( ( u = user_find( irc, cmd[i] ) ) && u->online ) 334 { 335 /* [SH] Make sure we don't use too much buffer space. */ 336 lenleft -= strlen( u->nick ) + 1; 337 338 if( lenleft < 0 ) 333 char *this, *next; 334 335 this = cmd[i]; 336 while( *this ) 337 { 338 if( ( next = strchr( this, ' ' ) ) ) 339 *next = 0; 340 341 if( ( u = user_find( irc, this ) ) && u->online ) 342 { 343 lenleft -= strlen( u->nick ) + 1; 344 345 if( lenleft < 0 ) 346 break; 347 348 strcat( buff, u->nick ); 349 strcat( buff, " " ); 350 } 351 352 if( next ) 353 { 354 *next = ' '; 355 this = next + 1; 356 } 357 else 339 358 { 340 359 break; 341 } 342 343 /* [SH] Add the nick to the buffer. Note 344 * that an extra space is always added. Even 345 * if it's the last nick in the list. Who 346 * cares? 347 */ 348 349 strcat( buff, u->nick ); 350 strcat( buff, " " ); 351 } 352 } 353 354 /* [WvG] Well, maybe someone cares, so why not remove it? */ 360 } 361 } 362 363 /* *sigh* */ 364 if( lenleft < 0 ) 365 break; 366 } 367 355 368 if( strlen( buff ) > 0 ) 356 369 buff[strlen(buff)-1] = '\0'; -
protocols/http_client.c
rcdca30b r4ff0966 157 157 158 158 error: 159 req->status_string = g_strdup( "Error while writing HTTP request" ); 160 159 161 req->func( req ); 160 162 … … 216 218 if( !sockerr_again() ) 217 219 { 220 req->status_string = g_strdup( strerror( errno ) ); 218 221 goto cleanup; 219 222 } … … 243 246 support... */ 244 247 if( req->bytes_read == 0 ) 248 { 249 req->status_string = g_strdup( "Empty HTTP reply" ); 245 250 goto cleanup; 251 } 246 252 247 253 /* Zero termination is very convenient. */ … … 264 270 else 265 271 { 272 req->status_string = g_strdup( "Malformed HTTP reply" ); 266 273 goto cleanup; 267 274 } … … 279 286 { 280 287 if( sscanf( end1 + 1, "%d", &req->status_code ) != 1 ) 288 { 289 req->status_string = g_strdup( "Can't parse status code" ); 281 290 req->status_code = -1; 282 } 283 else 284 { 291 } 292 else 293 { 294 char *eol; 295 296 if( evil_server ) 297 eol = strchr( end1, '\n' ); 298 else 299 eol = strchr( end1, '\r' ); 300 301 req->status_string = g_strndup( end1 + 1, eol - end1 - 1 ); 302 303 /* Just to be sure... */ 304 if( ( eol = strchr( req->status_string, '\r' ) ) ) 305 *eol = 0; 306 if( ( eol = strchr( req->status_string, '\n' ) ) ) 307 *eol = 0; 308 } 309 } 310 else 311 { 312 req->status_string = g_strdup( "Can't locate status code" ); 285 313 req->status_code = -1; 286 314 } … … 291 319 int error = 0, new_port, new_proto; 292 320 321 /* We might fill it again, so let's not leak any memory. */ 322 g_free( req->status_string ); 323 req->status_string = NULL; 324 293 325 loc = strstr( req->reply_headers, "\nLocation: " ); 294 326 if( loc == NULL ) /* We can't handle this redirect... */ 327 { 328 req->status_string = g_strdup( "Can't locate Location: header" ); 295 329 goto cleanup; 330 } 296 331 297 332 loc += 11; … … 310 345 don't need this yet anyway, I won't implement it. */ 311 346 347 req->status_string = g_strdup( "Can't handle recursive redirects" ); 348 312 349 goto cleanup; 313 350 } … … 327 364 if( !url_set( url, loc ) ) 328 365 { 366 req->status_string = g_strdup( "Malformed redirect URL" ); 329 367 g_free( url ); 330 368 goto cleanup; … … 337 375 going to use strcat(), whether you like it or not. :-) */ 338 376 339 /* First, find the GET/POST/whatever from the original request. */ 340 s = strchr( req->request, ' ' ); 377 sprintf( new_request, "GET %s HTTP/1.0", url->file ); 378 379 s = strstr( req->request, "\r\n" ); 341 380 if( s == NULL ) 342 381 { 382 req->status_string = g_strdup( "Error while rebuilding request string" ); 343 383 g_free( new_request ); 344 384 g_free( url ); … … 346 386 } 347 387 348 *s = 0; 349 sprintf( new_request, "%s %s HTTP/1.0\r\n", req->request, url->file ); 350 *s = ' '; 351 352 s = strstr( req->request, "\r\n" ); 353 if( s == NULL ) 354 { 355 g_free( new_request ); 356 g_free( url ); 357 goto cleanup; 358 } 359 360 strcat( new_request, s + 2 ); 388 strcat( new_request, s ); 361 389 new_host = g_strdup( url->host ); 362 390 new_port = url->port; … … 372 400 373 401 req->fd = -1; 374 req->ssl = 0;402 req->ssl = NULL; 375 403 376 404 if( new_proto == PROTO_HTTPS ) … … 390 418 if( error ) 391 419 { 420 req->status_string = g_strdup( "Connection problem during redirect" ); 392 421 g_free( new_request ); 393 422 goto cleanup; … … 418 447 g_free( req->request ); 419 448 g_free( req->reply_headers ); 449 g_free( req->status_string ); 420 450 g_free( req ); 421 451 -
protocols/http_client.h
rcdca30b r4ff0966 37 37 int request_length; 38 38 int status_code; 39 char *status_string; 39 40 char *reply_headers; 40 41 char *reply_body; -
protocols/msn/ns.c
rcdca30b r4ff0966 656 656 if( key == NULL ) 657 657 { 658 hide_login_progress( gc, "Error during Passport authentication" ); 658 char *err; 659 660 err = g_strdup_printf( "Error during Passport authentication (%s)", 661 rep->error_string ? rep->error_string : "Unknown error" ); 662 663 hide_login_progress( gc, err ); 659 664 signoff( gc ); 665 666 g_free( err ); 660 667 } 661 668 else -
protocols/msn/passport.c
rcdca30b r4ff0966 69 69 } 70 70 71 reqs = g_malloc( strlen( header ) + strlen( dummy ) + 128 ); 72 sprintf( reqs, "GET %s HTTP/1.0\r\n%s\r\n\r\n", dummy, header ); 71 reqs = g_strdup_printf( "GET %s HTTP/1.0\r\n%s\r\n\r\n", dummy, header ); 73 72 74 73 *dummy = 0; … … 88 87 struct passport_reply *rep = req->data; 89 88 90 if( !g_slist_find( msn_connections, rep->data ) || !req->finished || !req->reply_headers)89 if( !g_slist_find( msn_connections, rep->data ) ) 91 90 { 92 91 destroy_reply( rep ); … … 94 93 } 95 94 96 if( req-> status_code == 200 )95 if( req->finished && req->reply_headers && req->status_code == 200 ) 97 96 { 98 97 char *dummy; … … 109 108 rep->result = g_strdup( dummy ); 110 109 } 110 else 111 { 112 rep->error_string = g_strdup( "Could not parse Passport server response" ); 113 } 114 } 115 else 116 { 117 rep->error_string = g_strdup_printf( "HTTP error: %s", 118 req->status_string ? req->status_string : "Unknown error" ); 111 119 } 112 120 … … 145 153 } 146 154 147 #define PPR_REQUEST "GET /rdr/pprdr.asp HTTP/1.0\r\n\r\n"148 155 static int passport_retrieve_dalogin( gpointer func, gpointer data, char *header ) 149 156 { … … 155 162 rep->header = header; 156 163 157 req = http_dorequest ( "nexus.passport.com", 443, 1, PPR_REQUEST, passport_retrieve_dalogin_ready, rep );164 req = http_dorequest_url( "https://nexus.passport.com/rdr/pprdr.asp", passport_retrieve_dalogin_ready, rep ); 158 165 159 166 if( !req ) … … 169 176 char *urlend; 170 177 171 if( !g_slist_find( msn_connections, rep->data ) || !req->finished || !req->reply_headers)178 if( !g_slist_find( msn_connections, rep->data ) ) 172 179 { 173 180 destroy_reply( rep ); … … 175 182 } 176 183 184 if( !req->finished || !req->reply_headers || req->status_code != 200 ) 185 { 186 rep->error_string = g_strdup_printf( "HTTP error while fetching DALogin: %s", 187 req->status_string ? req->status_string : "Unknown error" ); 188 goto failure; 189 } 190 177 191 dalogin = strstr( req->reply_headers, "DALogin=" ); 178 192 179 193 if( !dalogin ) 194 { 195 rep->error_string = g_strdup( "Parse error while fetching DALogin" ); 180 196 goto failure; 197 } 181 198 182 199 dalogin += strlen( "DALogin=" ); … … 208 225 g_free( rep->result ); 209 226 g_free( rep->header ); 227 g_free( rep->error_string ); 210 228 g_free( rep ); 211 229 } -
protocols/msn/passport.h
rcdca30b r4ff0966 39 39 char *result; 40 40 char *header; 41 char *error_string; 41 42 }; 42 43 -
protocols/msn/sb.c
rcdca30b r4ff0966 529 529 { 530 530 msn_sb_destroy( sb ); 531 return ( 0 );532 } 533 if( err->flags & STATUS_FATAL )531 return 0; 532 } 533 else if( err->flags & STATUS_FATAL ) 534 534 { 535 535 signoff( gc ); 536 return ( 0 );537 } 538 if( err->flags & STATUS_SB_IM_SPARE )536 return 0; 537 } 538 else if( err->flags & STATUS_SB_IM_SPARE ) 539 539 { 540 540 if( sb->who ) … … 559 559 sb->msgq = NULL; 560 560 } 561 562 /* Do NOT return 0 here, we want to keep this sb. */ 561 563 } 562 564 } -
protocols/msn/tables.c
rcdca30b r4ff0966 127 127 128 128 { 910, "Server is busy", STATUS_FATAL }, 129 { 911, "Authentication failed", STATUS_ FATAL },129 { 911, "Authentication failed", STATUS_SB_FATAL | STATUS_FATAL }, 130 130 { 912, "Server is busy", STATUS_FATAL }, 131 131 { 913, "Not allowed when hiding", 0 }, -
util.c
rcdca30b r4ff0966 39 39 #include <glib.h> 40 40 #include <time.h> 41 #ifdef GLIB242 #define iconv_t GIConv43 #define iconv_open g_iconv_open44 #define iconv_close g_iconv_close45 #define iconv g_iconv46 #else47 #include <iconv.h>48 #endif49 41 50 42 void strip_linefeed(gchar *text) … … 465 457 signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ) 466 458 { 467 iconv_tcd;459 GIConv cd; 468 460 size_t res; 469 461 size_t inbytesleft, outbytesleft; … … 471 463 char *outbuf = dst; 472 464 473 cd = iconv_open( to_cs, from_cs );474 if( cd == ( iconv_t) -1 )465 cd = g_iconv_open( to_cs, from_cs ); 466 if( cd == (GIConv) -1 ) 475 467 return( -1 ); 476 468 477 469 inbytesleft = size ? size : strlen( src ); 478 470 outbytesleft = maxbuf - 1; 479 res = iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft );471 res = g_iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft ); 480 472 *outbuf = '\0'; 481 iconv_close( cd );473 g_iconv_close( cd ); 482 474 483 475 if( res == (size_t) -1 ) … … 489 481 char *set_eval_charset( irc_t *irc, set_t *set, char *value ) 490 482 { 491 iconv_tcd;483 GIConv cd; 492 484 493 485 if ( g_strncasecmp( value, "none", 4 ) == 0 ) 494 486 return( value ); 495 487 496 cd = iconv_open( "UTF-8", value );497 if( cd == ( iconv_t) -1 )488 cd = g_iconv_open( "UTF-8", value ); 489 if( cd == (GIConv) -1 ) 498 490 return( NULL ); 499 491 500 iconv_close( cd );492 g_iconv_close( cd ); 501 493 return( value ); 502 494 }
Note: See TracChangeset
for help on using the changeset viewer.