- Timestamp:
- 2006-06-03T20:20:43Z (18 years ago)
- Branches:
- master
- Children:
- 5973412
- Parents:
- a15c097 (diff), fb62f81f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/http_client.c
ra15c097 r9779c18 69 69 70 70 return( req ); 71 } 72 73 void *http_dorequest_url( char *url_string, http_input_function func, gpointer data ) 74 { 75 url_t *url = g_new0( url_t, 1 ); 76 char *request; 77 void *ret; 78 79 if( !url_set( url, url_string ) ) 80 { 81 g_free( url ); 82 return NULL; 83 } 84 85 if( url->proto != PROTO_HTTP && url->proto != PROTO_HTTPS ) 86 { 87 g_free( url ); 88 return NULL; 89 } 90 91 request = g_strdup_printf( "GET %s HTTP/1.0\r\n" 92 "Host: %s\r\n" 93 "User-Agent: BitlBee " BITLBEE_VERSION " " ARCH "/" CPU "\r\n" 94 "\r\n", url->file, url->host ); 95 96 ret = http_dorequest( url->host, url->port, 97 url->proto == PROTO_HTTPS, request, func, data ); 98 99 g_free( url ); 100 g_free( request ); 101 return ret; 71 102 } 72 103 … … 126 157 127 158 error: 159 req->status_string = g_strdup( "Error while writing HTTP request" ); 160 128 161 req->func( req ); 129 162 … … 185 218 if( !sockerr_again() ) 186 219 { 220 req->status_string = g_strdup( strerror( errno ) ); 187 221 goto cleanup; 188 222 } … … 209 243 210 244 got_reply: 245 /* Maybe if the webserver is overloaded, or when there's bad SSL 246 support... */ 247 if( req->bytes_read == 0 ) 248 { 249 req->status_string = g_strdup( "Empty HTTP reply" ); 250 goto cleanup; 251 } 252 211 253 /* Zero termination is very convenient. */ 212 254 req->reply_headers[req->bytes_read] = 0; … … 222 264 evil_server = 1; 223 265 } 224 else 266 else if( end1 ) 225 267 { 226 268 end1 += 2; 227 269 } 228 229 if( end1 ) 230 { 231 *end1 = 0; 232 233 if( evil_server ) 234 req->reply_body = end1 + 1; 270 else 271 { 272 req->status_string = g_strdup( "Malformed HTTP reply" ); 273 goto cleanup; 274 } 275 276 *end1 = 0; 277 278 if( evil_server ) 279 req->reply_body = end1 + 1; 280 else 281 req->reply_body = end1 + 2; 282 283 req->body_size = req->reply_headers + req->bytes_read - req->reply_body; 284 285 if( ( end1 = strchr( req->reply_headers, ' ' ) ) != NULL ) 286 { 287 if( sscanf( end1 + 1, "%d", &req->status_code ) != 1 ) 288 { 289 req->status_string = g_strdup( "Can't parse status code" ); 290 req->status_code = -1; 291 } 235 292 else 236 req->reply_body = end1 + 2; 237 } 238 239 if( ( end1 = strchr( req->reply_headers, ' ' ) ) != NULL ) 240 { 241 if( sscanf( end1 + 1, "%d", &req->status_code ) != 1 ) 242 req->status_code = -1; 243 } 244 else 245 { 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" ); 246 313 req->status_code = -1; 247 314 } … … 252 319 int error = 0, new_port, new_proto; 253 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 254 325 loc = strstr( req->reply_headers, "\nLocation: " ); 255 326 if( loc == NULL ) /* We can't handle this redirect... */ 327 { 328 req->status_string = g_strdup( "Can't locate Location: header" ); 256 329 goto cleanup; 330 } 257 331 258 332 loc += 11; … … 271 345 don't need this yet anyway, I won't implement it. */ 272 346 347 req->status_string = g_strdup( "Can't handle recursive redirects" ); 348 273 349 goto cleanup; 274 350 } … … 288 364 if( !url_set( url, loc ) ) 289 365 { 366 req->status_string = g_strdup( "Malformed redirect URL" ); 290 367 g_free( url ); 291 368 goto cleanup; … … 298 375 going to use strcat(), whether you like it or not. :-) */ 299 376 300 /* First, find the GET/POST/whatever from the original request. */ 301 s = strchr( req->request, ' ' ); 377 sprintf( new_request, "GET %s HTTP/1.0", url->file ); 378 379 s = strstr( req->request, "\r\n" ); 302 380 if( s == NULL ) 303 381 { 382 req->status_string = g_strdup( "Error while rebuilding request string" ); 304 383 g_free( new_request ); 305 384 g_free( url ); … … 307 386 } 308 387 309 *s = 0; 310 sprintf( new_request, "%s %s HTTP/1.0\r\n", req->request, url->file ); 311 *s = ' '; 312 313 s = strstr( req->request, "\r\n" ); 314 if( s == NULL ) 315 { 316 g_free( new_request ); 317 g_free( url ); 318 goto cleanup; 319 } 320 321 strcat( new_request, s + 2 ); 388 strcat( new_request, s ); 322 389 new_host = g_strdup( url->host ); 323 390 new_port = url->port; … … 333 400 334 401 req->fd = -1; 335 req->ssl = 0;402 req->ssl = NULL; 336 403 337 404 if( new_proto == PROTO_HTTPS ) … … 351 418 if( error ) 352 419 { 420 req->status_string = g_strdup( "Connection problem during redirect" ); 353 421 g_free( new_request ); 354 422 goto cleanup; … … 379 447 g_free( req->request ); 380 448 g_free( req->reply_headers ); 449 g_free( req->status_string ); 381 450 g_free( req ); 382 451 } -
protocols/http_client.h
ra15c097 r9779c18 37 37 int request_length; 38 38 int status_code; 39 char *status_string; 39 40 char *reply_headers; 40 41 char *reply_body; 42 int body_size; 41 43 int finished; 42 44 … … 53 55 54 56 void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data ); 57 void *http_dorequest_url( char *url_string, http_input_function func, gpointer data ); -
protocols/jabber/jabber.c
ra15c097 r9779c18 1045 1045 */ 1046 1046 if(find_buddy(GJ_GC(jap->gjc), jap->user) == NULL) { 1047 show_got_added(GJ_GC(jap->gjc), NULL, jap->user, NULL, NULL);1047 show_got_added(GJ_GC(jap->gjc), jap->user, NULL); 1048 1048 } 1049 1049 g_free(jap->user); … … 1549 1549 if(jd->gjc != NULL) { 1550 1550 gjab_delete(jd->gjc); 1551 /* YAY for modules with their own memory pool managers!... 1551 1552 g_free(jd->gjc->sid); 1553 And a less sarcastic yay for valgrind. :-) */ 1552 1554 jd->gjc = NULL; 1553 1555 } … … 1885 1887 } 1886 1888 1887 static void jabber_set_idle(struct gaim_connection *gc, int idle) {1888 struct jabber_data *jd = (struct jabber_data *)gc->proto_data;1889 jd->idle = idle ? time(NULL) - idle : idle;1890 }1891 1892 1889 static void jabber_keepalive(struct gaim_connection *gc) { 1893 1890 struct jabber_data *jd = (struct jabber_data *)gc->proto_data; 1894 1891 gjab_send_raw(jd->gjc, " \t "); 1895 }1896 1897 static void jabber_buddy_free(struct buddy *b)1898 {1899 while (b->proto_data) {1900 g_free(((GSList *)b->proto_data)->data);1901 b->proto_data = g_slist_remove(b->proto_data, ((GSList *)b->proto_data)->data);1902 }1903 1892 } 1904 1893 … … 2338 2327 } 2339 2328 2340 2341 static GList *jabber_actions()2342 {2343 GList *m = NULL;2344 2345 m = g_list_append(m, _("Set User Info"));2346 /*2347 m = g_list_append(m, _("Set Dir Info"));2348 m = g_list_append(m, _("Change Password"));2349 */2350 2351 return m;2352 }2353 2354 2355 2329 void jabber_init() 2356 2330 { 2357 2331 struct prpl *ret = g_new0(struct prpl, 1); 2358 2332 2359 /* the NULL's aren't required but they're nice to have */2360 2333 ret->name = "jabber"; 2361 2334 ret->away_states = jabber_away_states; 2362 ret->actions = jabber_actions;2363 2335 ret->login = jabber_login; 2364 2336 ret->close = jabber_close; … … 2368 2340 ret->set_away = jabber_set_away; 2369 2341 ret->get_away = jabber_get_away_msg; 2370 ret->set_idle = jabber_set_idle;2371 2342 ret->add_buddy = jabber_add_buddy; 2372 2343 ret->remove_buddy = jabber_remove_buddy; 2373 ret->add_permit = NULL;2374 ret->add_deny = NULL;2375 ret->rem_permit = NULL;2376 ret->rem_deny = NULL;2377 ret->set_permit_deny = NULL;2378 2344 ret->keepalive = jabber_keepalive; 2379 ret->buddy_free = jabber_buddy_free;2380 2345 ret->alias_buddy = jabber_roster_update; 2381 2346 ret->group_buddy = jabber_group_change; -
protocols/jabber/xmlparse.c
ra15c097 r9779c18 1461 1461 s = protocolEncodingName; 1462 1462 #endif 1463 if ( (ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s))1463 if (ns ? XmlInitEncodingNS(&initEncoding, &encoding, s) : XmlInitEncoding(&initEncoding, &encoding, s)) 1464 1464 return XML_ERROR_NONE; 1465 1465 return handleUnknownEncoding(parser, protocolEncodingName); … … 1475 1475 int standalone = -1; 1476 1476 if (!(ns 1477 ? XmlParseXmlDeclNS 1478 : XmlParseXmlDecl)(isGeneralTextEntity, 1477 ? XmlParseXmlDeclNS(isGeneralTextEntity, 1479 1478 encoding, 1480 1479 s, … … 1484 1483 &encodingName, 1485 1484 &newEncoding, 1486 &standalone)) 1485 &standalone) 1486 : XmlParseXmlDecl(isGeneralTextEntity, 1487 encoding, 1488 s, 1489 next, 1490 &eventPtr, 1491 &version, 1492 &encodingName, 1493 &newEncoding, 1494 &standalone))) 1487 1495 return XML_ERROR_SYNTAX; 1488 1496 if (!isGeneralTextEntity && standalone == 1) … … 1537 1545 } 1538 1546 enc = (ns 1539 ? XmlInitUnknownEncodingNS 1540 : XmlInitUnknownEncoding)(unknownEncodingMem, 1547 ? XmlInitUnknownEncodingNS(unknownEncodingMem, 1541 1548 info.map, 1542 1549 info.convert, 1543 info.data); 1550 info.data) 1551 : XmlInitUnknownEncoding(unknownEncodingMem, 1552 info.map, 1553 info.convert, 1554 info.data)); 1544 1555 if (enc) { 1545 1556 unknownEncodingData = info.data; -
protocols/msn/msn_util.c
ra15c097 r9779c18 130 130 { 131 131 msn_buddy_list_add( bla->gc, "AL", bla->handle, bla->realname ); 132 133 if( find_buddy( bla->gc, bla->handle ) == NULL ) 134 show_got_added( bla->gc, bla->handle, NULL ); 132 135 133 136 g_free( bla->handle ); -
protocols/msn/ns.c
ra15c097 r9779c18 650 650 if( key == NULL ) 651 651 { 652 hide_login_progress( gc, "Error during Passport authentication" ); 652 char *err; 653 654 err = g_strdup_printf( "Error during Passport authentication (%s)", 655 rep->error_string ? rep->error_string : "Unknown error" ); 656 657 hide_login_progress( gc, err ); 653 658 signoff( gc ); 659 660 g_free( err ); 654 661 } 655 662 else -
protocols/msn/passport.c
ra15c097 r9779c18 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
ra15c097 r9779c18 39 39 char *result; 40 40 char *header; 41 char *error_string; 41 42 }; 42 43 -
protocols/msn/sb.c
ra15c097 r9779c18 523 523 { 524 524 msn_sb_destroy( sb ); 525 return ( 0 );526 } 527 if( err->flags & STATUS_FATAL )525 return 0; 526 } 527 else if( err->flags & STATUS_FATAL ) 528 528 { 529 529 signoff( gc ); 530 return ( 0 );531 } 532 if( err->flags & STATUS_SB_IM_SPARE )530 return 0; 531 } 532 else if( err->flags & STATUS_SB_IM_SPARE ) 533 533 { 534 534 if( sb->who ) … … 553 553 sb->msgq = NULL; 554 554 } 555 556 /* Do NOT return 0 here, we want to keep this sb. */ 555 557 } 556 558 } -
protocols/msn/tables.c
ra15c097 r9779c18 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 }, -
protocols/nogaim.c
ra15c097 r9779c18 37 37 #include "nogaim.h" 38 38 #include <ctype.h> 39 #include <iconv.h>40 41 static char *proto_away_alias[8][5] =42 {43 { "Away from computer", "Away", "Extended away", NULL },44 { "NA", "N/A", "Not available", NULL },45 { "Busy", "Do not disturb", "DND", "Occupied", NULL },46 { "Be right back", "BRB", NULL },47 { "On the phone", "Phone", "On phone", NULL },48 { "Out to lunch", "Lunch", "Food", NULL },49 { "Invisible", "Hidden" },50 { NULL }51 };52 static char *proto_away_alias_find( GList *gcm, char *away );53 39 54 40 static int remove_chat_buddy_silent( struct conversation *b, char *handle ); … … 159 145 GSList *get_connections() { return connections; } 160 146 161 int proto_away( struct gaim_connection *gc, char *away )162 {163 GList *m, *ms;164 char *s;165 166 if( !away ) away = "";167 ms = m = gc->prpl->away_states( gc );168 169 while( m )170 {171 if( *away )172 {173 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 )174 break;175 }176 else177 {178 if( g_strcasecmp( m->data, "Available" ) == 0 )179 break;180 if( g_strcasecmp( m->data, "Online" ) == 0 )181 break;182 }183 m = m->next;184 }185 186 if( m )187 {188 gc->prpl->set_away( gc, m->data, *away ? away : NULL );189 }190 else191 {192 s = proto_away_alias_find( ms, away );193 if( s )194 {195 gc->prpl->set_away( gc, s, away );196 if( set_getint( gc->irc, "debug" ) )197 serv_got_crap( gc, "Setting away state to %s", s );198 }199 else200 gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );201 }202 203 g_list_free( ms );204 205 return( 1 );206 }207 208 static char *proto_away_alias_find( GList *gcm, char *away )209 {210 GList *m;211 int i, j;212 213 for( i = 0; *proto_away_alias[i]; i ++ )214 {215 for( j = 0; proto_away_alias[i][j]; j ++ )216 if( g_strncasecmp( away, proto_away_alias[i][j], strlen( proto_away_alias[i][j] ) ) == 0 )217 break;218 219 if( !proto_away_alias[i][j] ) /* If we reach the end, this row */220 continue; /* is not what we want. Next! */221 222 /* Now find an entry in this row which exists in gcm */223 for( j = 0; proto_away_alias[i][j]; j ++ )224 {225 m = gcm;226 while( m )227 {228 if( g_strcasecmp( proto_away_alias[i][j], m->data ) == 0 )229 return( proto_away_alias[i][j] );230 m = m->next;231 }232 }233 }234 235 return( NULL );236 }237 238 147 /* multi.c */ 239 148 … … 306 215 { 307 216 va_list params; 308 char text[1024], buf[1024], *acc_id; 309 char *msg; 217 char *text; 310 218 account_t *a; 311 219 312 220 va_start( params, format ); 313 g_vsnprintf( text, sizeof( text ),format, params );221 text = g_strdup_vprintf( format, params ); 314 222 va_end( params ); 315 223 316 if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&317 do_iconv( "UTF8", set_getstr( gc->irc, "charset" ), text, buf, 0, 1024 ) != -1 )318 msg = buf;319 else320 msg = text;321 322 224 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) || 323 225 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) 324 strip_html( msg);226 strip_html( text ); 325 227 326 228 /* Try to find a different connection on the same protocol. */ … … 329 231 break; 330 232 331 /* If we found one, add the screenname to the acc_id. */233 /* If we found one, include the screenname in the message. */ 332 234 if( a ) 333 acc_id = g_strdup_printf( "%s(%s)", gc->prpl->name, gc->username);235 irc_usermsg( gc->irc, "%s(%s) - %s", gc->prpl->name, gc->username, text ); 334 236 else 335 acc_id = g_strdup( gc->prpl->name ); 336 337 irc_usermsg( gc->irc, "%s - %s", acc_id, msg ); 338 339 g_free( acc_id ); 237 irc_usermsg( gc->irc, "%s - %s", gc->prpl->name, text ); 238 239 g_free( text ); 340 240 } 341 241 … … 369 269 /* Also necessary when we're not away, at least for some of the 370 270 protocols. */ 371 proto_away( gc, u->away ); 372 373 if( strcmp( gc->prpl->name, "ICQ" ) == 0 ) 374 { 375 for( u = gc->irc->users; u; u = u->next ) 376 if( u->gc == gc ) 377 break; 378 379 if( u == NULL ) 380 serv_got_crap( gc, "\x02""***\x02"" BitlBee now supports ICQ server-side contact lists. " 381 "See \x02""help import_buddies\x02"" for more information." ); 382 } 271 bim_set_away( gc, u->away ); 383 272 } 384 273 … … 397 286 while( g_source_remove_by_user_data( (gpointer) a ) ); 398 287 a->reconnect = 0; 399 }400 401 void account_offline( struct gaim_connection *gc )402 {403 gc->wants_to_die = TRUE;404 signoff( gc );405 288 } 406 289 … … 412 295 413 296 serv_got_crap( gc, "Signing off.." ); 414 297 gc->flags |= OPT_LOGGING_OUT; 298 415 299 gaim_input_remove( gc->keepalive ); 416 300 gc->keepalive = 0; … … 510 394 else if( gc->user->proto_opt[0] && *gc->user->proto_opt[0] ) 511 395 { 512 u->host = g_strdup( gc->user->proto_opt[0] ); 396 char *colon; 397 398 if( ( colon = strchr( gc->user->proto_opt[0], ':' ) ) ) 399 u->host = g_strndup( gc->user->proto_opt[0], 400 colon - gc->user->proto_opt[0] ); 401 else 402 u->host = g_strdup( gc->user->proto_opt[0] ); 403 513 404 u->user = g_strdup( handle ); 514 405 … … 559 450 { 560 451 user_t *u = user_findhandle( gc, handle ); 561 char *name, buf[1024];562 452 563 453 if( !u ) return; 564 454 565 /* Convert all UTF-8 */ 566 if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 && 567 do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), realname, buf, 0, sizeof( buf ) ) != -1 ) 568 name = buf; 569 else 570 name = realname; 571 572 if( g_strcasecmp( u->realname, name ) != 0 ) 455 if( g_strcasecmp( u->realname, realname ) != 0 ) 573 456 { 574 457 if( u->realname != u->nick ) g_free( u->realname ); 575 458 576 u->realname = g_strdup( name );459 u->realname = g_strdup( realname ); 577 460 578 461 if( ( gc->flags & OPT_LOGGED_IN ) && set_getint( gc->irc, "display_namechanges" ) ) … … 584 467 /* prpl.c */ 585 468 586 void show_got_added( struct gaim_connection *gc, char *id, char *handle, const char *realname, const char *msg ) 587 { 588 return; 469 struct show_got_added_data 470 { 471 struct gaim_connection *gc; 472 char *handle; 473 }; 474 475 void show_got_added_no( gpointer w, struct show_got_added_data *data ) 476 { 477 g_free( data->handle ); 478 g_free( data ); 479 } 480 481 void show_got_added_yes( gpointer w, struct show_got_added_data *data ) 482 { 483 data->gc->prpl->add_buddy( data->gc, data->handle ); 484 add_buddy( data->gc, NULL, data->handle, data->handle ); 485 486 return show_got_added_no( w, data ); 487 } 488 489 void show_got_added( struct gaim_connection *gc, char *handle, const char *realname ) 490 { 491 struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); 492 char *s; 493 494 /* TODO: Make a setting for this! */ 495 if( user_findhandle( gc, handle ) != NULL ) 496 return; 497 498 s = g_strdup_printf( "The user %s is not in your buddy list yet. Do you want to add him/her now?", handle ); 499 500 data->gc = gc; 501 data->handle = g_strdup( handle ); 502 query_add( gc->irc, gc, s, show_got_added_yes, show_got_added_no, data ); 589 503 } 590 504 … … 616 530 return; 617 531 } 618 return; 532 /* Why did we have this here.... 533 return; */ 619 534 } 620 535 … … 680 595 irc_t *irc = gc->irc; 681 596 user_t *u; 682 char buf[8192];683 597 684 598 u = user_findhandle( gc, handle ); … … 722 636 strip_html( msg ); 723 637 724 if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 &&725 do_iconv( "UTF-8", set_getstr( irc, "charset" ), msg, buf, 0, 8192 ) != -1 )726 msg = buf;727 728 638 while( strlen( msg ) > 425 ) 729 639 { … … 822 732 struct conversation *c; 823 733 user_t *u; 824 char buf[8192];825 734 826 735 /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ … … 834 743 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) 835 744 strip_html( msg ); 836 837 if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&838 do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), msg, buf, 0, 8192 ) != -1 )839 msg = buf;840 745 841 746 if( c && u ) … … 956 861 957 862 return( 0 ); 958 }959 960 961 /* prefs.c */962 963 /* Necessary? */964 void build_block_list()965 {966 return;967 }968 969 void build_allow_list()970 {971 return;972 863 } 973 864 … … 1051 942 } 1052 943 1053 int serv_send_im( irc_t *irc, user_t *u, char *msg, int flags ) 1054 { 1055 char buf[8192]; 1056 1057 if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 && 1058 do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 ) 944 945 946 947 /* The plan is to not allow straight calls to prpl functions anymore, but do 948 them all from some wrappers. We'll start to define some down here: */ 949 950 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ) 951 { 952 char *buf = NULL; 953 int st; 954 955 if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 956 { 957 buf = escape_html( msg ); 1059 958 msg = buf; 1060 1061 if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 1062 { 1063 char *html; 1064 1065 html = escape_html( msg ); 1066 strncpy( buf, html, 8192 ); 1067 g_free( html ); 1068 959 } 960 961 st = gc->prpl->send_im( gc, handle, msg, strlen( msg ), flags ); 962 g_free( buf ); 963 964 return st; 965 } 966 967 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg ) 968 { 969 char *buf = NULL; 970 int st; 971 972 if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 973 { 974 buf = escape_html( msg ); 1069 975 msg = buf; 1070 976 } 1071 977 1072 return( ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags ) ); 1073 } 1074 1075 int serv_send_chat( irc_t *irc, struct gaim_connection *gc, int id, char *msg ) 1076 { 1077 char buf[8192]; 1078 1079 if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 && 1080 do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 ) 1081 msg = buf; 1082 1083 if( gc->flags & OPT_CONN_HTML) { 1084 char * html = escape_html(msg); 1085 strncpy(buf, html, 8192); 1086 g_free(html); 1087 } 1088 1089 return( gc->prpl->chat_send( gc, id, msg ) ); 1090 } 1091 1092 /* Convert from one charset to another. 1093 1094 from_cs, to_cs: Source and destination charsets 1095 src, dst: Source and destination strings 1096 size: Size if src. 0 == use strlen(). strlen() is not reliable for UNICODE/UTF16 strings though. 1097 maxbuf: Maximum number of bytes to write to dst 1098 1099 Returns the number of bytes written to maxbuf or -1 on an error. 1100 */ 1101 signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ) 1102 { 1103 iconv_t cd; 1104 size_t res; 1105 size_t inbytesleft, outbytesleft; 1106 char *inbuf = src; 1107 char *outbuf = dst; 1108 1109 cd = iconv_open( to_cs, from_cs ); 1110 if( cd == (iconv_t) -1 ) 1111 return( -1 ); 1112 1113 inbytesleft = size ? size : strlen( src ); 1114 outbytesleft = maxbuf - 1; 1115 res = iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft ); 1116 *outbuf = '\0'; 1117 iconv_close( cd ); 1118 1119 if( res == (size_t) -1 ) 1120 return( -1 ); 978 st = gc->prpl->chat_send( gc, id, msg ); 979 g_free( buf ); 980 981 return st; 982 } 983 984 static char *bim_away_alias_find( GList *gcm, char *away ); 985 986 int bim_set_away( struct gaim_connection *gc, char *away ) 987 { 988 GList *m, *ms; 989 char *s; 990 991 if( !away ) away = ""; 992 ms = m = gc->prpl->away_states( gc ); 993 994 while( m ) 995 { 996 if( *away ) 997 { 998 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 ) 999 break; 1000 } 1001 else 1002 { 1003 if( g_strcasecmp( m->data, "Available" ) == 0 ) 1004 break; 1005 if( g_strcasecmp( m->data, "Online" ) == 0 ) 1006 break; 1007 } 1008 m = m->next; 1009 } 1010 1011 if( m ) 1012 { 1013 gc->prpl->set_away( gc, m->data, *away ? away : NULL ); 1014 } 1121 1015 else 1122 return( outbuf - dst ); 1123 } 1124 1125 char *set_eval_charset( irc_t *irc, set_t *set, char *value ) 1126 { 1127 iconv_t cd; 1128 1129 if ( g_strncasecmp( value, "none", 4 ) == 0 ) 1130 return( value ); 1131 1132 cd = iconv_open( "UTF-8", value ); 1133 if( cd == (iconv_t) -1 ) 1134 return( NULL ); 1135 1136 iconv_close( cd ); 1137 return( value ); 1138 } 1016 { 1017 s = bim_away_alias_find( ms, away ); 1018 if( s ) 1019 { 1020 gc->prpl->set_away( gc, s, away ); 1021 if( set_getint( gc->irc, "debug" ) ) 1022 serv_got_crap( gc, "Setting away state to %s", s ); 1023 } 1024 else 1025 gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); 1026 } 1027 1028 g_list_free( ms ); 1029 1030 return( 1 ); 1031 } 1032 1033 static char *bim_away_alias_list[8][5] = 1034 { 1035 { "Away from computer", "Away", "Extended away", NULL }, 1036 { "NA", "N/A", "Not available", NULL }, 1037 { "Busy", "Do not disturb", "DND", "Occupied", NULL }, 1038 { "Be right back", "BRB", NULL }, 1039 { "On the phone", "Phone", "On phone", NULL }, 1040 { "Out to lunch", "Lunch", "Food", NULL }, 1041 { "Invisible", "Hidden" }, 1042 { NULL } 1043 }; 1044 1045 static char *bim_away_alias_find( GList *gcm, char *away ) 1046 { 1047 GList *m; 1048 int i, j; 1049 1050 for( i = 0; *bim_away_alias_list[i]; i ++ ) 1051 { 1052 for( j = 0; bim_away_alias_list[i][j]; j ++ ) 1053 if( g_strncasecmp( away, bim_away_alias_list[i][j], strlen( bim_away_alias_list[i][j] ) ) == 0 ) 1054 break; 1055 1056 if( !bim_away_alias_list[i][j] ) /* If we reach the end, this row */ 1057 continue; /* is not what we want. Next! */ 1058 1059 /* Now find an entry in this row which exists in gcm */ 1060 for( j = 0; bim_away_alias_list[i][j]; j ++ ) 1061 { 1062 m = gcm; 1063 while( m ) 1064 { 1065 if( g_strcasecmp( bim_away_alias_list[i][j], m->data ) == 0 ) 1066 return( bim_away_alias_list[i][j] ); 1067 m = m->next; 1068 } 1069 } 1070 } 1071 1072 return( NULL ); 1073 } 1074 1075 void bim_add_allow( struct gaim_connection *gc, char *handle ) 1076 { 1077 if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) 1078 { 1079 gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) ); 1080 } 1081 1082 gc->prpl->add_permit( gc, handle ); 1083 } 1084 1085 void bim_rem_allow( struct gaim_connection *gc, char *handle ) 1086 { 1087 GSList *l; 1088 1089 if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) 1090 { 1091 g_free( l->data ); 1092 gc->permit = g_slist_delete_link( gc->permit, l ); 1093 } 1094 1095 gc->prpl->rem_permit( gc, handle ); 1096 } 1097 1098 void bim_add_block( struct gaim_connection *gc, char *handle ) 1099 { 1100 if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) 1101 { 1102 gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) ); 1103 } 1104 1105 gc->prpl->add_deny( gc, handle ); 1106 } 1107 1108 void bim_rem_block( struct gaim_connection *gc, char *handle ) 1109 { 1110 GSList *l; 1111 1112 if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) 1113 { 1114 g_free( l->data ); 1115 gc->deny = g_slist_delete_link( gc->deny, l ); 1116 } 1117 1118 gc->prpl->rem_deny( gc, handle ); 1119 } -
protocols/nogaim.h
ra15c097 r9779c18 15 15 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> 16 16 * (and possibly other members of the Gaim team) 17 * Copyright 2002-2004 Wilmer van der Gaast < lintux@lintux.cx>17 * Copyright 2002-2004 Wilmer van der Gaast <wilmer@gaast.net> 18 18 */ 19 19 … … 52 52 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ 53 53 54 #define PERMIT_ALL 1 55 #define PERMIT_NONE 2 56 #define PERMIT_SOME 3 57 #define DENY_SOME 4 58 59 #define WEBSITE "http://www.bitlee.org/" 54 #define WEBSITE "http://www.bitlbee.org/" 60 55 #define IM_FLAG_AWAY 0x0020 61 #define OPT_CONN_HTML 0x0000000162 #define OPT_LOGGED_IN 0x0001000063 56 #define GAIM_AWAY_CUSTOM "Custom" 64 57 65 #define GAIM_LOGO 0 66 #define GAIM_ERROR 1 67 #define GAIM_WARNING 2 68 #define GAIM_INFO 3 58 #define OPT_CONN_HTML 0x00000001 59 #define OPT_LOGGED_IN 0x00010000 60 #define OPT_LOGGING_OUT 0x00020000 69 61 70 62 /* ok. now the fun begins. first we create a connection structure */ 71 struct gaim_connection { 72 /* we need to do either oscar or TOC */ 73 /* we make this as an int in case if we want to add more protocols later */ 63 struct gaim_connection 64 { 74 65 struct prpl *prpl; 75 66 guint32 flags; 76 67 68 /* each connection then can have its own protocol-specific data */ 69 void *proto_data; 70 77 71 /* all connections need an input watcher */ 78 72 int inpa; 73 guint keepalive; 79 74 80 75 /* buddy list stuff. there is still a global groups for the buddy list, but … … 84 79 int permdeny; 85 80 86 /* all connections need a list of chats, even if they don't have chat */87 GSList *buddy_chats;88 89 /* each connection then can have its own protocol-specific data */90 void *proto_data;91 92 81 struct aim_user *user; 93 82 … … 95 84 char displayname[128]; 96 85 char password[32]; 97 guint keepalive;98 /* stuff needed for per-connection idle times */99 guint idle_timer;100 time_t login_time;101 time_t lastsent;102 int is_idle;103 86 104 87 char *away; 105 int is_auto_away;106 88 107 89 int evil; … … 110 92 /* BitlBee */ 111 93 irc_t *irc; 112 int lstitems; /* added for msnP8 */113 94 114 95 struct conversation *conversations; … … 164 145 const char *name; 165 146 166 /* for ICQ and Yahoo, who have off/on per-conversation options */167 /* char *checkbox; this should be per-connection */168 169 GList *(* away_states)(struct gaim_connection *gc);170 GList *(* actions)();171 void (* do_action)(struct gaim_connection *, char *);172 /* user_opts returns a GList* of g_malloc'd struct proto_user_opts */173 GList *(* user_opts)();174 GList *(* chat_info)(struct gaim_connection *);175 176 /* all the server-related functions */177 178 /* a lot of these (like get_dir) are protocol-dependent and should be removed. ones like179 * set_dir (which is also protocol-dependent) can stay though because there's a dialog180 * (i.e. the prpl says you can set your dir info, the ui shows a dialog and needs to call181 * set_dir in order to set it) */182 183 147 void (* login) (struct aim_user *); 148 void (* keepalive) (struct gaim_connection *); 184 149 void (* close) (struct gaim_connection *); 150 185 151 int (* send_im) (struct gaim_connection *, char *who, char *message, int len, int away); 186 int (* send_typing) (struct gaim_connection *, char *who, int typing);187 void (* set_info) (struct gaim_connection *, char *info);188 void (* get_info) (struct gaim_connection *, char *who);189 152 void (* set_away) (struct gaim_connection *, char *state, char *message); 190 153 void (* get_away) (struct gaim_connection *, char *who); 191 void (* set_idle) (struct gaim_connection *, int idletime); 154 int (* send_typing) (struct gaim_connection *, char *who, int typing); 155 192 156 void (* add_buddy) (struct gaim_connection *, char *name); 157 void (* group_buddy) (struct gaim_connection *, char *who, char *old_group, char *new_group); 193 158 void (* remove_buddy) (struct gaim_connection *, char *name, char *group); 194 159 void (* add_permit) (struct gaim_connection *, char *name); … … 197 162 void (* rem_deny) (struct gaim_connection *, char *name); 198 163 void (* set_permit_deny)(struct gaim_connection *); 164 165 void (* set_info) (struct gaim_connection *, char *info); 166 void (* get_info) (struct gaim_connection *, char *who); 167 void (* alias_buddy) (struct gaim_connection *, char *who); /* save/store buddy's alias on server list/roster */ 168 169 /* Group chat stuff. */ 199 170 void (* join_chat) (struct gaim_connection *, GList *data); 200 171 void (* chat_invite) (struct gaim_connection *, int id, char *who, char *message); 201 172 void (* chat_leave) (struct gaim_connection *, int id); 202 void (* chat_whisper) (struct gaim_connection *, int id, char *who, char *message);203 173 int (* chat_send) (struct gaim_connection *, int id, char *message); 204 174 int (* chat_open) (struct gaim_connection *, char *who); 205 void (* keepalive) (struct gaim_connection *); 206 207 /* get "chat buddy" info and away message */ 208 void (* get_cb_info) (struct gaim_connection *, int, char *who); 209 void (* get_cb_away) (struct gaim_connection *, int, char *who); 210 211 /* save/store buddy's alias on server list/roster */ 212 void (* alias_buddy) (struct gaim_connection *, char *who); 213 214 /* change a buddy's group on a server list/roster */ 215 void (* group_buddy) (struct gaim_connection *, char *who, char *old_group, char *new_group); 216 217 void (* buddy_free) (struct buddy *); 218 175 176 /* DIE! */ 219 177 char *(* get_status_string) (struct gaim_connection *gc, int stat); 220 178 179 GList *(* away_states)(struct gaim_connection *gc); 180 181 /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */ 221 182 int (* cmp_buddynames) (const char *who1, const char *who2); 222 183 }; … … 235 196 236 197 /* nogaim.c */ 237 int serv_send_im(irc_t *irc, user_t *u, char *msg, int flags); 238 int serv_send_chat(irc_t *irc, struct gaim_connection *gc, int id, char *msg ); 239 240 G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ); 241 char *set_eval_charset( irc_t *irc, set_t *set, char *value ); 198 int bim_set_away( struct gaim_connection *gc, char *away ); 199 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ); 200 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg ); 201 202 void bim_add_allow( struct gaim_connection *gc, char *handle ); 203 void bim_rem_allow( struct gaim_connection *gc, char *handle ); 204 void bim_add_block( struct gaim_connection *gc, char *handle ); 205 void bim_rem_block( struct gaim_connection *gc, char *handle ); 242 206 243 207 void nogaim_init(); 244 int proto_away( struct gaim_connection *gc, char *away );245 208 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ); 246 209 … … 254 217 G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg ); 255 218 G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg ); 256 G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) ;219 G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 257 220 G_MODULE_EXPORT void account_online( struct gaim_connection *gc ); 258 G_MODULE_EXPORT void account_offline( struct gaim_connection *gc );259 221 G_MODULE_EXPORT void signoff( struct gaim_connection *gc ); 260 222 … … 264 226 265 227 /* list.c */ 266 G_MODULE_EXPORT int bud_list_cache_exists( struct gaim_connection *gc );267 G_MODULE_EXPORT void do_import( struct gaim_connection *gc, void *null );268 228 G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname ); 269 229 G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle ); 270 G_MODULE_EXPORT void do_export( struct gaim_connection *gc );271 230 G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc ); 272 231 … … 278 237 279 238 /* prpl.c */ 280 G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char * id, char *handle, const char *realname, const char *msg);239 G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname ); 281 240 282 241 /* server.c */ … … 289 248 G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id ); 290 249 291 /* util.c */292 G_MODULE_EXPORT void strip_linefeed( gchar *text );293 G_MODULE_EXPORT char *add_cr( char *text );294 G_MODULE_EXPORT char *tobase64( const char *text );295 G_MODULE_EXPORT char *normalize( const char *s );296 G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec );297 G_MODULE_EXPORT void strip_html( char *msg );298 G_MODULE_EXPORT char *escape_html( const char *html );299 G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value);300 G_MODULE_EXPORT char *ipv6_wrap( char *src );301 G_MODULE_EXPORT char *ipv6_unwrap( char *src );302 303 /* prefs.c */304 G_MODULE_EXPORT void build_block_list();305 G_MODULE_EXPORT void build_allow_list();306 307 250 struct conversation *conv_findchannel( char *channel ); 308 251 309 310 252 #endif -
protocols/oscar/aim.h
ra15c097 r9779c18 728 728 }; 729 729 730 #define AIM_CHATFLAGS_NOREFLECT 0x0001 731 #define AIM_CHATFLAGS_AWAY 0x0002 730 #define AIM_CHATFLAGS_NOREFLECT 0x0001 731 #define AIM_CHATFLAGS_AWAY 0x0002 732 #define AIM_CHATFLAGS_UNICODE 0x0004 733 #define AIM_CHATFLAGS_ISO_8859_1 0x0008 734 732 735 int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen); 733 736 int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance); -
protocols/oscar/chat.c
ra15c097 r9779c18 159 159 if (flags & AIM_CHATFLAGS_AWAY) 160 160 aim_addtlvtochain_noval(&otl, 0x0007); 161 161 162 /* [WvG] This wasn't there originally, but we really should send 163 the right charset flags, as we also do with normal 164 messages. Hope this will work. :-) */ 165 /* 166 if (flags & AIM_CHATFLAGS_UNICODE) 167 aimbs_put16(&fr->data, 0x0002); 168 else if (flags & AIM_CHATFLAGS_ISO_8859_1) 169 aimbs_put16(&fr->data, 0x0003); 170 else 171 aimbs_put16(&fr->data, 0x0000); 172 173 aimbs_put16(&fr->data, 0x0000); 174 */ 175 162 176 /* 163 177 * SubTLV: Type 1: Message -
protocols/oscar/im.c
ra15c097 r9779c18 1469 1469 case 0x9c: /* ICQ 5 seems to send this */ 1470 1470 aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie, 1471 gc->away , sess->aim_icq_state, dc);1471 gc->away ? gc->away : "", sess->aim_icq_state, dc); 1472 1472 break; 1473 1473 -
protocols/oscar/oscar.c
ra15c097 r9779c18 2 2 * gaim 3 3 * 4 * Some code copyright (C) 2002-2006, Jelmer Vernooij <jelmer@samba.org> 5 * and the BitlBee team. 4 6 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> 5 7 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx> … … 136 138 int i, j; 137 139 char *x = strchr(name, '-'); 138 if (!x) return NULL;140 if (!x) return g_strdup(name); 139 141 x = strchr(++x, '-'); 140 if (!x) return NULL;142 if (!x) return g_strdup(name); 141 143 tmp = g_strdup(++x); 142 144 … … 383 385 if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 && 384 386 g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) { 385 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails." );387 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]); 386 388 } 387 389 … … 1119 1121 aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); 1120 1122 // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); 1121 show_got_added(data->gc, NULL, uin, NULL, NULL); 1123 if(find_buddy(data->gc, uin) == NULL) 1124 show_got_added(data->gc, uin, NULL); 1122 1125 1123 1126 g_free(uin); … … 2057 2060 name = g_strdup(normalize(curitem->name)); 2058 2061 gc->permit = g_slist_append(gc->permit, name); 2059 build_allow_list();2060 2062 tmp++; 2061 2063 } … … 2071 2073 name = g_strdup(normalize(curitem->name)); 2072 2074 gc->deny = g_slist_append(gc->deny, name); 2073 build_block_list();2074 2075 tmp++; 2075 2076 } … … 2277 2278 tm.tm_mday = (int)info->birthday; 2278 2279 tm.tm_mon = (int)info->birthmonth-1; 2279 tm.tm_year = (int)info->birthyear -1900;2280 tm.tm_year = (int)info->birthyear%100; 2280 2281 strftime(date, sizeof(date), "%Y-%m-%d", &tm); 2281 2282 info_string_append(str, "\n", _("Birthday"), date); … … 2501 2502 int ret; 2502 2503 guint8 len = strlen(message); 2504 guint16 flags; 2503 2505 char *s; 2504 2506 … … 2509 2511 if (*s & 128) 2510 2512 break; 2511 2513 2514 flags = AIM_CHATFLAGS_NOREFLECT; 2515 2512 2516 /* Message contains high ASCII chars, time for some translation! */ 2513 2517 if (*s) { … … 2516 2520 If we can't, fall back to UTF16. */ 2517 2521 if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) { 2522 flags |= AIM_CHATFLAGS_ISO_8859_1; 2518 2523 len = ret; 2519 2524 } else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) { 2525 flags |= AIM_CHATFLAGS_UNICODE; 2520 2526 len = ret; 2521 2527 } else { … … 2528 2534 } 2529 2535 2530 ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len);2536 ret = aim_chat_send_im(od->sess, ccon->conn, flags, s, len); 2531 2537 2532 2538 if (s != message) { … … 2601 2607 int ret; 2602 2608 static int chat_id = 0; 2603 char * chatname = g_new0(char, strlen(gc->username)+4);2604 2605 g_snprintf(chatname, strlen(gc->username) + 4,"%s%d", gc->username, chat_id++);2609 char * chatname; 2610 2611 chatname = g_strdup_printf("%s%d", gc->username, chat_id++); 2606 2612 2607 2613 ret = oscar_chat_join(gc, chatname); -
protocols/oscar/oscar_util.c
ra15c097 r9779c18 109 109 110 110 curPtr = sn; 111 while ( (*curPtr) != (char) NULL) {111 while ( (*curPtr) != (char) '\0') { 112 112 if ((*curPtr) != ' ') 113 113 i++; … … 140 140 curPtr1 = sn1; 141 141 curPtr2 = sn2; 142 while ( (*curPtr1 != (char) NULL) && (*curPtr2 != (char) NULL) ) {142 while ( (*curPtr1 != (char) '\0') && (*curPtr2 != (char) '\0') ) { 143 143 if ( (*curPtr1 == ' ') || (*curPtr2 == ' ') ) { 144 144 if (*curPtr1 == ' ') -
protocols/oscar/service.c
ra15c097 r9779c18 733 733 int tlvlen; 734 734 735 data = AIM_ICQ_STATE_ WEBAWARE | AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */735 data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */ 736 736 737 737 tlvlen = aim_addtlvtochain32(&tl, 0x0006, data); … … 881 881 #endif 882 882 883 /* len can't be 0 here anyway... 883 884 } else if ((offset == 0x00001000) && (len == 0x00000000)) { 884 885 … … 887 888 aimbs_put32(&fr->data, 0xe9800998); 888 889 aimbs_put32(&fr->data, 0xecf8427e); 889 890 */ 890 891 } else 891 892 do_error_dialog(sess->aux_data, "WARNING: unknown hash request", "Gaim"); -
protocols/ssl_nss.c
ra15c097 r9779c18 122 122 if( source == -1 ) 123 123 goto ssl_connected_failure; 124 125 124 126 127 125 /* Until we find out how to handle non-blocking I/O with NSS... */ 126 sock_make_blocking( conn->fd ); 127 128 128 conn->prfd = SSL_ImportFD(NULL, PR_ImportTCPSocket(source)); 129 129 SSL_OptionSet(conn->prfd, SSL_SECURITY, PR_TRUE); … … 181 181 return( ((struct scd*)conn)->fd ); 182 182 } 183 184 GaimInputCondition ssl_getdirection( void *conn ) 185 { 186 /* Just in case someone calls us, let's return the most likely case: */ 187 return GAIM_INPUT_READ; 188 } -
protocols/yahoo/yahoo.c
ra15c097 r9779c18 227 227 else if( g_strcasecmp( state, GAIM_AWAY_CUSTOM ) == 0 ) 228 228 { 229 if (gc->is_idle) 230 yd->current_status = YAHOO_STATUS_IDLE; 231 else 232 yd->current_status = YAHOO_STATUS_AVAILABLE; 229 yd->current_status = YAHOO_STATUS_AVAILABLE; 233 230 234 231 gc->away = NULL; 235 232 } 236 233 } 237 else if( gc->is_idle )238 yd->current_status = YAHOO_STATUS_IDLE;239 234 else 240 235 yd->current_status = YAHOO_STATUS_AVAILABLE; … … 615 610 struct gaim_connection *gc = byahoo_get_gc_by_id( id ); 616 611 617 serv_got_update( gc, who, stat != YAHOO_STATUS_OFFLINE, 0, 0, 0, 612 serv_got_update( gc, who, stat != YAHOO_STATUS_OFFLINE, 0, 0, 613 ( stat == YAHOO_STATUS_IDLE ) ? away : 0, 618 614 ( stat != YAHOO_STATUS_AVAILABLE ) | ( stat << 1 ), 0 ); 619 615 }
Note: See TracChangeset
for help on using the changeset viewer.