- Timestamp:
- 2006-05-24T23:04:18Z (19 years ago)
- Branches:
- master
- Children:
- 80c1e4d
- Parents:
- 46ad029 (diff), fc630f9 (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:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/http_client.c
r46ad029 r601e813 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 … … 222 253 evil_server = 1; 223 254 } 224 else 255 else if( end1 ) 225 256 { 226 257 end1 += 2; 227 258 } 228 229 if( end1 ) 230 { 231 *end1 = 0; 232 233 if( evil_server ) 234 req->reply_body = end1 + 1; 235 else 236 req->reply_body = end1 + 2; 237 } 259 else 260 { 261 goto cleanup; 262 } 263 264 *end1 = 0; 265 266 if( evil_server ) 267 req->reply_body = end1 + 1; 268 else 269 req->reply_body = end1 + 2; 270 271 req->body_size = req->reply_headers + req->bytes_read - req->reply_body; 238 272 239 273 if( ( end1 = strchr( req->reply_headers, ' ' ) ) != NULL ) -
protocols/http_client.h
r46ad029 r601e813 39 39 char *reply_headers; 40 40 char *reply_body; 41 int body_size; 41 42 int finished; 42 43 … … 53 54 54 55 void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data ); 56 void *http_dorequest_url( char *url_string, http_input_function func, gpointer data ); -
protocols/jabber/jabber.c
r46ad029 r601e813 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); … … 1232 1232 } 1233 1233 1234 x = jutil_presnew(0, NULL, "Online"); 1235 gjab_send(gjc, x); 1236 xmlnode_free(x); 1234 account_online(GJ_GC(gjc)); 1237 1235 } 1238 1236 … … 1250 1248 } else { 1251 1249 gjab_reqroster(gjc); 1252 account_online(GJ_GC(gjc));1253 1250 1254 1251 ((struct jabber_data *)GJ_GC(gjc)->proto_data)->did_import = TRUE; … … 1552 1549 if(jd->gjc != NULL) { 1553 1550 gjab_delete(jd->gjc); 1551 /* YAY for modules with their own memory pool managers!... 1554 1552 g_free(jd->gjc->sid); 1553 And a less sarcastic yay for valgrind. :-) */ 1555 1554 jd->gjc = NULL; 1556 1555 } … … 1888 1887 } 1889 1888 1890 static void jabber_set_idle(struct gaim_connection *gc, int idle) {1891 struct jabber_data *jd = (struct jabber_data *)gc->proto_data;1892 jd->idle = idle ? time(NULL) - idle : idle;1893 }1894 1895 1889 static void jabber_keepalive(struct gaim_connection *gc) { 1896 1890 struct jabber_data *jd = (struct jabber_data *)gc->proto_data; 1897 1891 gjab_send_raw(jd->gjc, " \t "); 1898 }1899 1900 static void jabber_buddy_free(struct buddy *b)1901 {1902 while (b->proto_data) {1903 g_free(((GSList *)b->proto_data)->data);1904 b->proto_data = g_slist_remove(b->proto_data, ((GSList *)b->proto_data)->data);1905 }1906 1892 } 1907 1893 … … 2341 2327 } 2342 2328 2343 2344 static GList *jabber_actions()2345 {2346 GList *m = NULL;2347 2348 m = g_list_append(m, _("Set User Info"));2349 /*2350 m = g_list_append(m, _("Set Dir Info"));2351 m = g_list_append(m, _("Change Password"));2352 */2353 2354 return m;2355 }2356 2357 2358 2329 void jabber_init() 2359 2330 { 2360 2331 struct prpl *ret = g_new0(struct prpl, 1); 2361 2332 2362 /* the NULL's aren't required but they're nice to have */2363 2333 ret->name = "jabber"; 2364 2334 ret->away_states = jabber_away_states; 2365 ret->actions = jabber_actions;2366 2335 ret->login = jabber_login; 2367 2336 ret->close = jabber_close; … … 2371 2340 ret->set_away = jabber_set_away; 2372 2341 ret->get_away = jabber_get_away_msg; 2373 ret->set_idle = jabber_set_idle;2374 2342 ret->add_buddy = jabber_add_buddy; 2375 2343 ret->remove_buddy = jabber_remove_buddy; 2376 ret->add_permit = NULL;2377 ret->add_deny = NULL;2378 ret->rem_permit = NULL;2379 ret->rem_deny = NULL;2380 ret->set_permit_deny = NULL;2381 2344 ret->keepalive = jabber_keepalive; 2382 ret->buddy_free = jabber_buddy_free;2383 2345 ret->alias_buddy = jabber_roster_update; 2384 2346 ret->group_buddy = jabber_group_change; -
protocols/jabber/xmlparse.c
r46ad029 r601e813 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.h
r46ad029 r601e813 66 66 GSList *msgq; 67 67 GSList *switchboards; 68 const struct msn_away_state *away_state; 69 68 70 int buddycount; 69 const struct msn_away_state *away_state; 71 int groupcount; 72 char **grouplist; 70 73 }; 71 74 -
protocols/msn/msn_util.c
r46ad029 r601e813 46 46 int msn_logged_in( struct gaim_connection *gc ) 47 47 { 48 struct msn_data *md = gc->proto_data;49 char buf[1024];50 51 48 account_online( gc ); 52 53 /* account_online() sets an away state if there is any, so only54 execute this code if we're not away. */55 if( md->away_state == msn_away_state_list )56 {57 g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 );58 return( msn_write( gc, buf, strlen( buf ) ) );59 }60 49 61 50 return( 0 ); … … 141 130 { 142 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 ); 143 135 144 136 g_free( bla->handle ); -
protocols/msn/ns.c
r46ad029 r601e813 257 257 { 258 258 md->buddycount = atoi( cmd[3] ); 259 md->groupcount = atoi( cmd[4] ); 260 if( md->groupcount > 0 ) 261 md->grouplist = g_new0( char *, md->groupcount ); 259 262 260 263 if( !*cmd[3] || md->buddycount == 0 ) … … 269 272 } 270 273 } 271 else if( strcmp( cmd[0], "GTC" ) == 0 )272 {273 }274 else if( strcmp( cmd[0], "BLP" ) == 0 )275 {276 }277 else if( strcmp( cmd[0], "PRP" ) == 0 )278 {279 }280 else if( strcmp( cmd[0], "LSG" ) == 0 )281 {282 }283 274 else if( strcmp( cmd[0], "LST" ) == 0 ) 284 275 { … … 297 288 if( list & 1 ) /* FL */ 298 289 { 299 add_buddy( gc, NULL, cmd[1], cmd[2] ); 290 char *group = NULL; 291 int num; 292 293 if( cmd[4] != NULL && sscanf( cmd[4], "%d", &num ) == 1 ) 294 group = md->grouplist[num]; 295 296 add_buddy( gc, group, cmd[1], cmd[2] ); 300 297 } 301 298 if( list & 2 ) /* AL */ … … 327 324 } 328 325 } 329 else if( strcmp( cmd[0], "BPR" ) == 0 ) 330 { 331 } 332 else if( strcmp( cmd[0], "CHG" ) == 0 ) 333 { 326 else if( strcmp( cmd[0], "LSG" ) == 0 ) 327 { 328 int num; 329 330 if( num_parts != 4 ) 331 { 332 hide_login_progress_error( gc, "Syntax error" ); 333 signoff( gc ); 334 return( 0 ); 335 } 336 337 http_decode( cmd[2] ); 338 num = atoi( cmd[1] ); 339 340 if( num < md->groupcount ) 341 md->grouplist[num] = g_strdup( cmd[2] ); 334 342 } 335 343 else if( strcmp( cmd[0], "CHL" ) == 0 ) … … 357 365 return( msn_write( gc, buf, strlen( buf ) ) ); 358 366 } 359 else if( strcmp( cmd[0], "QRY" ) == 0 )360 {361 }362 else if( strcmp( cmd[0], "QNG" ) == 0 )363 {364 }365 367 else if( strcmp( cmd[0], "ILN" ) == 0 ) 366 368 { … … 478 480 msn_buddy_ask( gc, cmd[4], cmd[5] ); 479 481 } 480 }481 else if( strcmp( cmd[0], "REM" ) == 0 )482 {483 482 } 484 483 else if( strcmp( cmd[0], "OUT" ) == 0 ) -
protocols/msn/sb.c
r46ad029 r601e813 202 202 debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" ); 203 203 204 if( sb->key ) g_free( sb->key );205 if( sb->who ) g_free( sb->who );206 207 204 if( sb->msgq ) 208 205 { … … 222 219 serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with " 223 220 "unsent message to %s, you'll have to resend it.", 224 m->who ? m->who : "(unknown)" ); 225 } 221 sb->who ? sb->who : "(unknown)" ); 222 } 223 224 if( sb->key ) g_free( sb->key ); 225 if( sb->who ) g_free( sb->who ); 226 226 227 227 if( sb->chat ) -
protocols/nogaim.c
r46ad029 r601e813 14 14 * (except for the function names). 15 15 * 16 * Copyright 2002-200 4 Wilmer van der Gaast <lintux@lintux.cx>16 * Copyright 2002-2006 Wilmer van der Gaast <wilmer@gaast.net> and others 17 17 */ 18 18 … … 37 37 #include "nogaim.h" 38 38 #include <ctype.h> 39 #include <iconv.h>40 41 static char *proto_away_alias[7][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 { NULL }50 };51 static char *proto_away_alias_find( GList *gcm, char *away );52 39 53 40 static int remove_chat_buddy_silent( struct conversation *b, char *handle ); … … 158 145 GSList *get_connections() { return connections; } 159 146 160 int proto_away( struct gaim_connection *gc, char *away )161 {162 GList *m, *ms;163 char *s;164 165 if( !away ) away = "";166 ms = m = gc->prpl->away_states( gc );167 168 while( m )169 {170 if( *away )171 {172 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 )173 break;174 }175 else176 {177 if( g_strcasecmp( m->data, "Available" ) == 0 )178 break;179 if( g_strcasecmp( m->data, "Online" ) == 0 )180 break;181 }182 m = m->next;183 }184 185 if( m )186 {187 gc->prpl->set_away( gc, m->data, *away ? away : NULL );188 }189 else190 {191 s = proto_away_alias_find( ms, away );192 if( s )193 {194 gc->prpl->set_away( gc, s, away );195 if( set_getint( gc->irc, "debug" ) )196 serv_got_crap( gc, "Setting away state to %s", s );197 }198 else199 gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );200 }201 202 g_list_free( ms );203 204 return( 1 );205 }206 207 static char *proto_away_alias_find( GList *gcm, char *away )208 {209 GList *m;210 int i, j;211 212 for( i = 0; *proto_away_alias[i]; i ++ )213 {214 for( j = 0; proto_away_alias[i][j]; j ++ )215 if( g_strncasecmp( away, proto_away_alias[i][j], strlen( proto_away_alias[i][j] ) ) == 0 )216 break;217 218 if( !proto_away_alias[i][j] ) /* If we reach the end, this row */219 continue; /* is not what we want. Next! */220 221 /* Now find an entry in this row which exists in gcm */222 for( j = 0; proto_away_alias[i][j]; j ++ )223 {224 m = gcm;225 while( m )226 {227 if( g_strcasecmp( proto_away_alias[i][j], m->data ) == 0 )228 return( proto_away_alias[i][j] );229 m = m->next;230 }231 }232 }233 234 return( NULL );235 }236 237 147 /* multi.c */ 238 148 … … 305 215 { 306 216 va_list params; 307 char text[1024], buf[1024], acc_id[33]; 308 char *msg; 217 char *text; 309 218 account_t *a; 310 219 311 220 va_start( params, format ); 312 g_vsnprintf( text, sizeof( text ),format, params );221 text = g_strdup_vprintf( format, params ); 313 222 va_end( params ); 314 223 315 if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&316 do_iconv( "UTF8", set_getstr( gc->irc, "charset" ), text, buf, 0, 1024 ) != -1 )317 msg = buf;318 else319 msg = text;320 321 224 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) || 322 225 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) 323 strip_html( msg);226 strip_html( text ); 324 227 325 228 /* Try to find a different connection on the same protocol. */ … … 328 231 break; 329 232 330 /* If we found one, add the screenname to the acc_id. */233 /* If we found one, include the screenname in the message. */ 331 234 if( a ) 332 g_snprintf( acc_id, 32, "%s(%s)", gc->prpl->name, gc->username);235 irc_usermsg( gc->irc, "%s(%s) - %s", gc->prpl->name, gc->username, text ); 333 236 else 334 g_snprintf( acc_id, 32, "%s", gc->prpl->name);335 336 irc_usermsg( gc->irc, "%s - %s", acc_id, msg);237 irc_usermsg( gc->irc, "%s - %s", gc->prpl->name, text ); 238 239 g_free( text ); 337 240 } 338 241 … … 352 255 353 256 /* MSN servers sometimes redirect you to a different server and do 354 the whole login sequence again, so subsequentcalls to this257 the whole login sequence again, so these "late" calls to this 355 258 function should be handled correctly. (IOW, ignored) */ 356 259 if( gc->flags & OPT_LOGGED_IN ) … … 364 267 gc->flags |= OPT_LOGGED_IN; 365 268 366 if( u && u->away ) proto_away( gc, u->away ); 367 368 if( !strcmp(gc->prpl->name, "icq") ) 369 { 370 for( u = gc->irc->users; u; u = u->next ) 371 if( u->gc == gc ) 372 break; 373 374 if( u == NULL ) 375 serv_got_crap( gc, "\x02""***\x02"" BitlBee now supports ICQ server-side contact lists. " 376 "See \x02""help import_buddies\x02"" for more information." ); 377 } 269 /* Also necessary when we're not away, at least for some of the 270 protocols. */ 271 bim_set_away( gc, u->away ); 378 272 } 379 273 … … 392 286 while( g_source_remove_by_user_data( (gpointer) a ) ); 393 287 a->reconnect = 0; 394 }395 396 void account_offline( struct gaim_connection *gc )397 {398 gc->wants_to_die = TRUE;399 signoff( gc );400 288 } 401 289 … … 470 358 /* list.c */ 471 359 472 int bud_list_cache_exists( struct gaim_connection *gc )473 {474 return( 0 );475 }476 477 void do_import( struct gaim_connection *gc, void *null )478 {479 return;480 }481 482 360 void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname ) 483 361 { … … 515 393 else if( gc->user->proto_opt[0] && *gc->user->proto_opt[0] ) 516 394 { 517 u->host = g_strdup( gc->user->proto_opt[0] ); 395 char *colon; 396 397 if( ( colon = strchr( gc->user->proto_opt[0], ':' ) ) ) 398 u->host = g_strndup( gc->user->proto_opt[0], 399 colon - gc->user->proto_opt[0] ); 400 else 401 u->host = g_strdup( gc->user->proto_opt[0] ); 402 518 403 u->user = g_strdup( handle ); 519 404 … … 531 416 u->gc = gc; 532 417 u->handle = g_strdup( handle ); 418 if( group ) u->group = g_strdup( group ); 533 419 u->send_handler = buddy_send_handler; 534 420 u->last_typing_notice = 0; … … 554 440 } 555 441 556 void do_export( struct gaim_connection *gc )557 {558 return;559 }560 561 442 void signoff_blocked( struct gaim_connection *gc ) 562 443 { … … 568 449 { 569 450 user_t *u = user_findhandle( gc, handle ); 570 char *name, buf[1024];571 451 572 452 if( !u ) return; 573 453 574 /* Convert all UTF-8 */ 575 if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 && 576 do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), realname, buf, 0, sizeof( buf ) ) != -1 ) 577 name = buf; 578 else 579 name = realname; 580 581 if( g_strcasecmp( u->realname, name ) != 0 ) 454 if( g_strcasecmp( u->realname, realname ) != 0 ) 582 455 { 583 456 if( u->realname != u->nick ) g_free( u->realname ); 584 457 585 u->realname = g_strdup( name );458 u->realname = g_strdup( realname ); 586 459 587 460 if( ( gc->flags & OPT_LOGGED_IN ) && set_getint( gc->irc, "display_namechanges" ) ) … … 593 466 /* prpl.c */ 594 467 595 void show_got_added( struct gaim_connection *gc, char *id, char *handle, const char *realname, const char *msg ) 596 { 597 return; 468 struct show_got_added_data 469 { 470 struct gaim_connection *gc; 471 char *handle; 472 }; 473 474 void show_got_added_no( gpointer w, struct show_got_added_data *data ) 475 { 476 g_free( data->handle ); 477 g_free( data ); 478 } 479 480 void show_got_added_yes( gpointer w, struct show_got_added_data *data ) 481 { 482 data->gc->prpl->add_buddy( data->gc, data->handle ); 483 add_buddy( data->gc, NULL, data->handle, data->handle ); 484 485 return show_got_added_no( w, data ); 486 } 487 488 void show_got_added( struct gaim_connection *gc, char *handle, const char *realname ) 489 { 490 struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); 491 char *s; 492 493 /* TODO: Make a setting for this! */ 494 if( user_findhandle( gc, handle ) != NULL ) 495 return; 496 497 s = g_strdup_printf( "The user %s is not in your buddy list yet. Do you want to add him/her now?", handle ); 498 499 data->gc = gc; 500 data->handle = g_strdup( handle ); 501 query_add( gc->irc, gc, s, show_got_added_yes, show_got_added_no, data ); 598 502 } 599 503 … … 625 529 return; 626 530 } 627 return; 531 /* Why did we have this here.... 532 return; */ 628 533 } 629 534 … … 689 594 irc_t *irc = gc->irc; 690 595 user_t *u; 691 char buf[8192];692 596 693 597 u = user_findhandle( gc, handle ); … … 731 635 strip_html( msg ); 732 636 733 if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 &&734 do_iconv( "UTF-8", set_getstr( irc, "charset" ), msg, buf, 0, 8192 ) != -1 )735 msg = buf;736 737 637 while( strlen( msg ) > 425 ) 738 638 { … … 831 731 struct conversation *c; 832 732 user_t *u; 833 char buf[8192];834 733 835 734 /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ … … 843 742 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) 844 743 strip_html( msg ); 845 846 if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&847 do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), msg, buf, 0, 8192 ) != -1 )848 msg = buf;849 744 850 745 if( c && u ) … … 884 779 } 885 780 886 void serv_finish_login( struct gaim_connection *gc )887 {888 return;889 }890 891 781 892 782 /* buddy_chat.c */ … … 970 860 971 861 return( 0 ); 972 }973 974 975 /* prefs.c */976 977 /* Necessary? */978 void build_block_list()979 {980 return;981 }982 983 void build_allow_list()984 {985 return;986 862 } 987 863 … … 1065 941 } 1066 942 1067 int serv_send_im( irc_t *irc, user_t *u, char *msg, int flags ) 1068 { 1069 char buf[8192]; 1070 1071 if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 && 1072 do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 ) 943 944 945 946 /* The plan is to not allow straight calls to prpl functions anymore, but do 947 them all from some wrappers. We'll start to define some down here: */ 948 949 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ) 950 { 951 char *buf = NULL; 952 int st; 953 954 if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 955 { 956 buf = escape_html( msg ); 1073 957 msg = buf; 1074 1075 if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 1076 { 1077 char *html; 1078 1079 html = escape_html( msg ); 1080 strncpy( buf, html, 8192 ); 1081 g_free( html ); 1082 958 } 959 960 st = gc->prpl->send_im( gc, handle, msg, strlen( msg ), flags ); 961 g_free( buf ); 962 963 return st; 964 } 965 966 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg ) 967 { 968 char *buf = NULL; 969 int st; 970 971 if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) ) 972 { 973 buf = escape_html( msg ); 1083 974 msg = buf; 1084 975 } 1085 976 1086 return( ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags ) ); 1087 } 1088 1089 int serv_send_chat( irc_t *irc, struct gaim_connection *gc, int id, char *msg ) 1090 { 1091 char buf[8192]; 1092 1093 if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 && 1094 do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 ) 1095 msg = buf; 1096 1097 if( gc->flags & OPT_CONN_HTML) { 1098 char * html = escape_html(msg); 1099 strncpy(buf, html, 8192); 1100 g_free(html); 1101 } 1102 1103 return( gc->prpl->chat_send( gc, id, msg ) ); 1104 } 1105 1106 /* Convert from one charset to another. 1107 1108 from_cs, to_cs: Source and destination charsets 1109 src, dst: Source and destination strings 1110 size: Size if src. 0 == use strlen(). strlen() is not reliable for UNICODE/UTF16 strings though. 1111 maxbuf: Maximum number of bytes to write to dst 1112 1113 Returns the number of bytes written to maxbuf or -1 on an error. 1114 */ 1115 signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ) 1116 { 1117 iconv_t cd; 1118 size_t res; 1119 size_t inbytesleft, outbytesleft; 1120 char *inbuf = src; 1121 char *outbuf = dst; 1122 1123 cd = iconv_open( to_cs, from_cs ); 1124 if( cd == (iconv_t) -1 ) 1125 return( -1 ); 1126 1127 inbytesleft = size ? size : strlen( src ); 1128 outbytesleft = maxbuf - 1; 1129 res = iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft ); 1130 *outbuf = '\0'; 1131 iconv_close( cd ); 1132 1133 if( res == (size_t) -1 ) 1134 return( -1 ); 977 st = gc->prpl->chat_send( gc, id, msg ); 978 g_free( buf ); 979 980 return st; 981 } 982 983 static char *bim_away_alias_find( GList *gcm, char *away ); 984 985 int bim_set_away( struct gaim_connection *gc, char *away ) 986 { 987 GList *m, *ms; 988 char *s; 989 990 if( !away ) away = ""; 991 ms = m = gc->prpl->away_states( gc ); 992 993 while( m ) 994 { 995 if( *away ) 996 { 997 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 ) 998 break; 999 } 1000 else 1001 { 1002 if( g_strcasecmp( m->data, "Available" ) == 0 ) 1003 break; 1004 if( g_strcasecmp( m->data, "Online" ) == 0 ) 1005 break; 1006 } 1007 m = m->next; 1008 } 1009 1010 if( m ) 1011 { 1012 gc->prpl->set_away( gc, m->data, *away ? away : NULL ); 1013 } 1135 1014 else 1136 return( outbuf - dst ); 1137 } 1138 1139 char *set_eval_charset( irc_t *irc, set_t *set, char *value ) 1140 { 1141 iconv_t cd; 1142 1143 if ( g_strncasecmp( value, "none", 4 ) == 0 ) 1144 return( value ); 1145 1146 cd = iconv_open( "UTF-8", value ); 1147 if( cd == (iconv_t) -1 ) 1148 return( NULL ); 1149 1150 iconv_close( cd ); 1151 return( value ); 1152 } 1015 { 1016 s = bim_away_alias_find( ms, away ); 1017 if( s ) 1018 { 1019 gc->prpl->set_away( gc, s, away ); 1020 if( set_getint( gc->irc, "debug" ) ) 1021 serv_got_crap( gc, "Setting away state to %s", s ); 1022 } 1023 else 1024 gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away ); 1025 } 1026 1027 g_list_free( ms ); 1028 1029 return( 1 ); 1030 } 1031 1032 static char *bim_away_alias_list[8][5] = 1033 { 1034 { "Away from computer", "Away", "Extended away", NULL }, 1035 { "NA", "N/A", "Not available", NULL }, 1036 { "Busy", "Do not disturb", "DND", "Occupied", NULL }, 1037 { "Be right back", "BRB", NULL }, 1038 { "On the phone", "Phone", "On phone", NULL }, 1039 { "Out to lunch", "Lunch", "Food", NULL }, 1040 { "Invisible", "Hidden" }, 1041 { NULL } 1042 }; 1043 1044 static char *bim_away_alias_find( GList *gcm, char *away ) 1045 { 1046 GList *m; 1047 int i, j; 1048 1049 for( i = 0; *bim_away_alias_list[i]; i ++ ) 1050 { 1051 for( j = 0; bim_away_alias_list[i][j]; j ++ ) 1052 if( g_strncasecmp( away, bim_away_alias_list[i][j], strlen( bim_away_alias_list[i][j] ) ) == 0 ) 1053 break; 1054 1055 if( !bim_away_alias_list[i][j] ) /* If we reach the end, this row */ 1056 continue; /* is not what we want. Next! */ 1057 1058 /* Now find an entry in this row which exists in gcm */ 1059 for( j = 0; bim_away_alias_list[i][j]; j ++ ) 1060 { 1061 m = gcm; 1062 while( m ) 1063 { 1064 if( g_strcasecmp( bim_away_alias_list[i][j], m->data ) == 0 ) 1065 return( bim_away_alias_list[i][j] ); 1066 m = m->next; 1067 } 1068 } 1069 } 1070 1071 return( NULL ); 1072 } 1073 1074 void bim_add_allow( struct gaim_connection *gc, char *handle ) 1075 { 1076 if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) 1077 { 1078 gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) ); 1079 } 1080 1081 gc->prpl->add_permit( gc, handle ); 1082 } 1083 1084 void bim_rem_allow( struct gaim_connection *gc, char *handle ) 1085 { 1086 GSList *l; 1087 1088 if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) 1089 { 1090 g_free( l->data ); 1091 gc->permit = g_slist_delete_link( gc->permit, l ); 1092 } 1093 1094 gc->prpl->rem_permit( gc, handle ); 1095 } 1096 1097 void bim_add_block( struct gaim_connection *gc, char *handle ) 1098 { 1099 if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) == NULL ) 1100 { 1101 gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) ); 1102 } 1103 1104 gc->prpl->add_deny( gc, handle ); 1105 } 1106 1107 void bim_rem_block( struct gaim_connection *gc, char *handle ) 1108 { 1109 GSList *l; 1110 1111 if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->prpl->cmp_buddynames ) ) ) 1112 { 1113 g_free( l->data ); 1114 gc->deny = g_slist_delete_link( gc->deny, l ); 1115 } 1116 1117 gc->prpl->rem_deny( gc, handle ); 1118 } -
protocols/nogaim.h
r46ad029 r601e813 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 155 #define PERMIT_NONE 256 #define PERMIT_SOME 357 #define DENY_SOME 458 59 54 #define WEBSITE "http://www.bitlee.org/" 60 55 #define IM_FLAG_AWAY 0x0020 … … 63 58 #define GAIM_AWAY_CUSTOM "Custom" 64 59 65 #define GAIM_LOGO 066 #define GAIM_ERROR 167 #define GAIM_WARNING 268 #define GAIM_INFO 369 70 60 /* 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 */ 61 struct gaim_connection 62 { 74 63 struct prpl *prpl; 75 64 guint32 flags; 76 65 66 /* each connection then can have its own protocol-specific data */ 67 void *proto_data; 68 77 69 /* all connections need an input watcher */ 78 70 int inpa; 71 guint keepalive; 79 72 80 73 /* buddy list stuff. there is still a global groups for the buddy list, but … … 84 77 int permdeny; 85 78 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 79 struct aim_user *user; 93 80 … … 95 82 char displayname[128]; 96 83 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 84 104 85 char *away; 105 int is_auto_away;106 86 107 87 int evil; … … 110 90 /* BitlBee */ 111 91 irc_t *irc; 112 int lstitems; /* added for msnP8 */113 92 114 93 struct conversation *conversations; … … 183 162 const char *name; 184 163 185 /* for ICQ and Yahoo, who have off/on per-conversation options */186 /* char *checkbox; this should be per-connection */187 188 GList *(* away_states)(struct gaim_connection *gc);189 GList *(* actions)();190 void (* do_action)(struct gaim_connection *, char *);191 /* user_opts returns a GList* of g_malloc'd struct proto_user_opts */192 GList *(* user_opts)();193 GList *(* chat_info)(struct gaim_connection *);194 195 /* all the server-related functions */196 197 /* a lot of these (like get_dir) are protocol-dependent and should be removed. ones like198 * set_dir (which is also protocol-dependent) can stay though because there's a dialog199 * (i.e. the prpl says you can set your dir info, the ui shows a dialog and needs to call200 * set_dir in order to set it) */201 202 164 void (* login) (struct aim_user *); 165 void (* keepalive) (struct gaim_connection *); 203 166 void (* close) (struct gaim_connection *); 167 204 168 int (* send_im) (struct gaim_connection *, char *who, char *message, int len, int away); 205 int (* send_typing) (struct gaim_connection *, char *who, int typing);206 void (* set_info) (struct gaim_connection *, char *info);207 void (* get_info) (struct gaim_connection *, char *who);208 169 void (* set_away) (struct gaim_connection *, char *state, char *message); 209 170 void (* get_away) (struct gaim_connection *, char *who); 210 void (* set_idle) (struct gaim_connection *, int idletime); 171 int (* send_typing) (struct gaim_connection *, char *who, int typing); 172 211 173 void (* add_buddy) (struct gaim_connection *, char *name); 174 void (* group_buddy) (struct gaim_connection *, char *who, char *old_group, char *new_group); 212 175 void (* remove_buddy) (struct gaim_connection *, char *name, char *group); 213 176 void (* add_permit) (struct gaim_connection *, char *name); … … 216 179 void (* rem_deny) (struct gaim_connection *, char *name); 217 180 void (* set_permit_deny)(struct gaim_connection *); 181 182 void (* set_info) (struct gaim_connection *, char *info); 183 void (* get_info) (struct gaim_connection *, char *who); 184 void (* alias_buddy) (struct gaim_connection *, char *who); /* save/store buddy's alias on server list/roster */ 185 186 /* Group chat stuff. */ 218 187 void (* join_chat) (struct gaim_connection *, GList *data); 219 188 void (* chat_invite) (struct gaim_connection *, int id, char *who, char *message); 220 189 void (* chat_leave) (struct gaim_connection *, int id); 221 void (* chat_whisper) (struct gaim_connection *, int id, char *who, char *message);222 190 int (* chat_send) (struct gaim_connection *, int id, char *message); 223 191 int (* chat_open) (struct gaim_connection *, char *who); 224 void (* keepalive) (struct gaim_connection *); 225 226 /* get "chat buddy" info and away message */ 227 void (* get_cb_info) (struct gaim_connection *, int, char *who); 228 void (* get_cb_away) (struct gaim_connection *, int, char *who); 229 230 /* save/store buddy's alias on server list/roster */ 231 void (* alias_buddy) (struct gaim_connection *, char *who); 232 233 /* change a buddy's group on a server list/roster */ 234 void (* group_buddy) (struct gaim_connection *, char *who, char *old_group, char *new_group); 235 236 /* file transfers */ 237 struct ft_send_req *(* req_send_file) (struct gaim_connection *, const char *file); 238 void (* send_file_part) (struct gaim_connection *, struct ft*, void *data, size_t length); 239 void (* accept_recv_file) (struct gaim_connection *, struct ft*, ft_recv_handler); 240 241 void (* buddy_free) (struct buddy *); 242 192 193 /* DIE! */ 243 194 char *(* get_status_string) (struct gaim_connection *gc, int stat); 244 195 196 GList *(* away_states)(struct gaim_connection *gc); 197 198 /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */ 245 199 int (* cmp_buddynames) (const char *who1, const char *who2); 246 200 }; … … 259 213 260 214 /* nogaim.c */ 261 int serv_send_im(irc_t *irc, user_t *u, char *msg, int flags); 262 int serv_send_chat(irc_t *irc, struct gaim_connection *gc, int id, char *msg ); 263 264 G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf ); 265 char *set_eval_charset( irc_t *irc, set_t *set, char *value ); 215 int bim_set_away( struct gaim_connection *gc, char *away ); 216 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags ); 217 int bim_chat_msg( struct gaim_connection *gc, int id, char *msg ); 218 219 void bim_add_allow( struct gaim_connection *gc, char *handle ); 220 void bim_rem_allow( struct gaim_connection *gc, char *handle ); 221 void bim_add_block( struct gaim_connection *gc, char *handle ); 222 void bim_rem_block( struct gaim_connection *gc, char *handle ); 266 223 267 224 void nogaim_init(); 268 int proto_away( struct gaim_connection *gc, char *away );269 225 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ); 270 226 … … 278 234 G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg ); 279 235 G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg ); 280 G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) ;236 G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 281 237 G_MODULE_EXPORT void account_online( struct gaim_connection *gc ); 282 G_MODULE_EXPORT void account_offline( struct gaim_connection *gc );283 238 G_MODULE_EXPORT void signoff( struct gaim_connection *gc ); 284 239 … … 288 243 289 244 /* list.c */ 290 G_MODULE_EXPORT int bud_list_cache_exists( struct gaim_connection *gc );291 G_MODULE_EXPORT void do_import( struct gaim_connection *gc, void *null );292 245 G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname ); 293 246 G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle ); 294 G_MODULE_EXPORT void do_export( struct gaim_connection *gc );295 247 G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc ); 296 248 … … 302 254 303 255 /* prpl.c */ 304 G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char * id, char *handle, const char *realname, const char *msg);256 G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname ); 305 257 306 258 /* server.c */ … … 313 265 G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id ); 314 266 315 /* util.c */316 G_MODULE_EXPORT void strip_linefeed( gchar *text );317 G_MODULE_EXPORT char *add_cr( char *text );318 G_MODULE_EXPORT char *tobase64( const char *text );319 G_MODULE_EXPORT char *normalize( const char *s );320 G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec );321 G_MODULE_EXPORT void strip_html( char *msg );322 G_MODULE_EXPORT char *escape_html( const char *html );323 G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value);324 G_MODULE_EXPORT char *ipv6_wrap( char *src );325 G_MODULE_EXPORT char *ipv6_unwrap( char *src );326 327 /* prefs.c */328 G_MODULE_EXPORT void build_block_list();329 G_MODULE_EXPORT void build_allow_list();330 331 267 struct conversation *conv_findchannel( char *channel ); 332 268 333 334 269 #endif -
protocols/oscar/aim.h
r46ad029 r601e813 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
r46ad029 r601e813 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 if (flags & AIM_CHATFLAGS_UNICODE) 166 aimbs_put16(&fr->data, 0x0002); 167 else if (flags & AIM_CHATFLAGS_ISO_8859_1) 168 aimbs_put16(&fr->data, 0x0003); 169 else 170 aimbs_put16(&fr->data, 0x0000); 171 172 aimbs_put16(&fr->data, 0x0000); 173 162 174 /* 163 175 * SubTLV: Type 1: Message -
protocols/oscar/oscar.c
r46ad029 r601e813 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> … … 356 358 if (isdigit(*user->username)) { 357 359 odata->icq = TRUE; 358 /* this is odd but it's necessary for a proper do_import and do_export */ 360 /* This is odd but it's necessary for a proper do_import and do_export. 361 We don't do those anymore, but let's stick with it, just in case 362 it accidentally fixes something else too... */ 359 363 gc->password[8] = 0; 360 364 } else { … … 381 385 if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 && 382 386 g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) { 383 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]); 384 388 } 385 389 … … 1117 1121 aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); 1118 1122 // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); 1119 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); 1120 1125 1121 1126 g_free(uin); … … 1148 1153 reason = msg + 6; 1149 1154 1150 dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: \n\n%s", uin, reason ? reason : "No reason given.");1155 dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given."); 1151 1156 data->gc = gc; 1152 1157 data->uin = uin; … … 1737 1742 odata->rights.maxdenies = (guint)maxdenies; 1738 1743 1739 // serv_finish_login(gc);1740 1741 if (bud_list_cache_exists(gc))1742 do_import(gc, NULL);1743 1744 1744 aim_clientready(sess, fr->conn); 1745 1745 … … 2060 2060 name = g_strdup(normalize(curitem->name)); 2061 2061 gc->permit = g_slist_append(gc->permit, name); 2062 build_allow_list();2063 2062 tmp++; 2064 2063 } … … 2074 2073 name = g_strdup(normalize(curitem->name)); 2075 2074 gc->deny = g_slist_append(gc->deny, name); 2076 build_block_list();2077 2075 tmp++; 2078 2076 } … … 2096 2094 } /* End of for loop */ 2097 2095 2098 if (tmp)2099 do_export(gc);2100 2096 aim_ssi_enable(sess, fr->conn); 2101 2097 … … 2282 2278 tm.tm_mday = (int)info->birthday; 2283 2279 tm.tm_mon = (int)info->birthmonth-1; 2284 tm.tm_year = (int)info->birthyear -1900;2280 tm.tm_year = (int)info->birthyear%100; 2285 2281 strftime(date, sizeof(date), "%Y-%m-%d", &tm); 2286 2282 info_string_append(str, "\n", _("Birthday"), date); … … 2506 2502 int ret; 2507 2503 guint8 len = strlen(message); 2504 guint16 flags; 2508 2505 char *s; 2509 2506 … … 2514 2511 if (*s & 128) 2515 2512 break; 2516 2513 2514 flags = AIM_CHATFLAGS_NOREFLECT; 2515 2517 2516 /* Message contains high ASCII chars, time for some translation! */ 2518 2517 if (*s) { … … 2521 2520 If we can't, fall back to UTF16. */ 2522 2521 if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) { 2522 flags |= AIM_CHATFLAGS_ISO_8859_1; 2523 2523 len = ret; 2524 2524 } else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) { 2525 flags |= AIM_CHATFLAGS_UNICODE; 2525 2526 len = ret; 2526 2527 } else { … … 2533 2534 } 2534 2535 2535 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); 2536 2537 2537 2538 if (s != message) { -
protocols/oscar/oscar_util.c
r46ad029 r601e813 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
r46ad029 r601e813 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
r46ad029 r601e813 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/ssl_openssl.c
r46ad029 r601e813 5 5 \********************************************************************/ 6 6 7 /* SSL module - Open TLS version*/7 /* SSL module - OpenSSL version */ 8 8 9 9 /* … … 41 41 struct scd 42 42 { 43 SslInputFunction func;43 ssl_input_function func; 44 44 gpointer data; 45 45 int fd; 46 46 gboolean established; 47 47 48 int inpa; 49 int lasterr; /* Necessary for SSL_get_error */ 48 50 SSL *ssl; 49 51 SSL_CTX *ssl_ctx; … … 54 56 55 57 56 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )58 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) 57 59 { 58 60 struct scd *conn = g_new0( struct scd, 1 ); … … 93 95 } 94 96 97 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ); 98 95 99 static void ssl_connected( gpointer data, gint source, GaimInputCondition cond ) 96 100 { … … 98 102 99 103 if( source == -1 ) 100 goto ssl_connected_failure; 101 104 return ssl_handshake( data, -1, cond ); 105 106 /* Make it non-blocking at least during the handshake... */ 107 sock_make_nonblocking( conn->fd ); 102 108 SSL_set_fd( conn->ssl, conn->fd ); 103 109 104 if( SSL_connect( conn->ssl ) < 0 ) 105 goto ssl_connected_failure; 110 return ssl_handshake( data, source, cond ); 111 } 112 113 static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond ) 114 { 115 struct scd *conn = data; 116 int st; 117 118 if( conn->inpa != -1 ) 119 { 120 gaim_input_remove( conn->inpa ); 121 conn->inpa = -1; 122 } 123 124 if( ( st = SSL_connect( conn->ssl ) ) < 0 ) 125 { 126 conn->lasterr = SSL_get_error( conn->ssl, st ); 127 if( conn->lasterr != SSL_ERROR_WANT_READ && conn->lasterr != SSL_ERROR_WANT_WRITE ) 128 goto ssl_connected_failure; 129 130 conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ), ssl_handshake, data ); 131 return; 132 } 106 133 107 134 conn->established = TRUE; 135 sock_make_blocking( conn->fd ); /* For now... */ 108 136 conn->func( conn->data, conn, cond ); 109 137 return; … … 127 155 int ssl_read( void *conn, char *buf, int len ) 128 156 { 157 int st; 158 129 159 if( !((struct scd*)conn)->established ) 130 return( 0 ); 131 132 return( SSL_read( ((struct scd*)conn)->ssl, buf, len ) ); 160 { 161 ssl_errno = SSL_NOHANDSHAKE; 162 return -1; 163 } 164 165 st = SSL_read( ((struct scd*)conn)->ssl, buf, len ); 166 167 ssl_errno = SSL_OK; 168 if( st <= 0 ) 169 { 170 ((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st ); 171 if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ) 172 ssl_errno = SSL_AGAIN; 173 } 174 175 return st; 133 176 } 134 177 135 178 int ssl_write( void *conn, const char *buf, int len ) 136 179 { 180 int st; 181 137 182 if( !((struct scd*)conn)->established ) 138 return( 0 ); 139 140 return( SSL_write( ((struct scd*)conn)->ssl, buf, len ) ); 183 { 184 ssl_errno = SSL_NOHANDSHAKE; 185 return -1; 186 } 187 188 st = SSL_write( ((struct scd*)conn)->ssl, buf, len ); 189 190 ssl_errno = SSL_OK; 191 if( st <= 0 ) 192 { 193 ((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st ); 194 if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ) 195 ssl_errno = SSL_AGAIN; 196 } 197 198 return st; 141 199 } 142 200 … … 144 202 { 145 203 struct scd *conn = conn_; 204 205 if( conn->inpa != -1 ) 206 gaim_input_remove( conn->inpa ); 146 207 147 208 if( conn->established ) … … 159 220 return( ((struct scd*)conn)->fd ); 160 221 } 222 223 GaimInputCondition ssl_getdirection( void *conn ) 224 { 225 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ ); 226 } -
protocols/yahoo/yahoo.c
r46ad029 r601e813 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.