Changes in protocols/yahoo/yahoo.c [56699f0:c495217]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/yahoo/yahoo.c
r56699f0 rc495217 2 2 * libyahoo2 wrapper to BitlBee 3 3 * 4 * Mostly Copyright 2004 Wilmer van der Gaast <wilmer@gaast.net>4 * Mostly Copyright 2004-2010 Wilmer van der Gaast <wilmer@gaast.net> 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify … … 271 271 { 272 272 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 273 274 yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP, NULL ); 273 bee_user_t *bu; 274 275 if( group && ( bu = bee_user_by_handle( ic->bee, ic, who ) ) && bu->group ) 276 { 277 GSList *bgl; 278 279 /* If the person is in our list already, this is a group change. */ 280 yahoo_change_buddy_group( yd->y2_id, who, bu->group->name, group ); 281 282 /* No idea how often people have people in multiple groups and 283 BitlBee doesn't currently support this anyway .. but keep 284 this struct up-to-date for now. */ 285 for( bgl = yd->buddygroups; bgl; bgl = bgl->next ) 286 { 287 struct byahoo_buddygroups *bg = bgl->data; 288 289 if( g_strcasecmp( bg->buddy, who ) == 0 && 290 g_strcasecmp( bg->group, bu->group->name ) == 0 ) 291 { 292 g_free( bg->group ); 293 bg->group = g_strdup( group ); 294 } 295 } 296 } 297 else 298 yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP, NULL ); 275 299 } 276 300 … … 341 365 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 342 366 343 yahoo_ accept_buddy_ymsg13( yd->y2_id, NULL, who);367 yahoo_confirm_buddy( yd->y2_id, who, 0, "" ); 344 368 } 345 369 … … 348 372 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 349 373 350 yahoo_ reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL);374 yahoo_confirm_buddy( yd->y2_id, who, 1, "" ); 351 375 } 352 376 … … 421 445 } 422 446 423 d->callback( d->fd, 0, d->data );447 d->callback( NULL + d->fd, 0, d->data ); 424 448 g_free( d ); 425 449 } … … 441 465 return FALSE; 442 466 443 yahoo_read_ready( d->id, d->fd, d->data );467 yahoo_read_ready( d->id, NULL + d->fd, d->data ); 444 468 445 469 return TRUE; … … 458 482 struct byahoo_write_ready_data *d = data; 459 483 460 return yahoo_write_ready( d->id, d->fd, d->data );484 return yahoo_write_ready( d->id, NULL + d->fd, d->data ); 461 485 } 462 486 … … 487 511 { 488 512 char *errstr; 489 int allow_reconnect = TRUE;513 int allow_reconnect = FALSE; 490 514 491 515 yd->logged_in = FALSE; … … 497 521 else if( succ == YAHOO_LOGIN_LOCK ) 498 522 errstr = "Yahoo! account locked"; 523 else if( succ == 1236 ) 524 errstr = "Yahoo! account locked or machine temporarily banned"; 499 525 else if( succ == YAHOO_LOGIN_DUPL ) 526 errstr = "Logged in on a different machine or device"; 527 else if( succ == YAHOO_LOGIN_SOCK ) 500 528 { 501 errstr = " Logged in on a different machine or device";502 allow_reconnect = FALSE;529 errstr = "Socket problem"; 530 allow_reconnect = TRUE; 503 531 } 504 else if( succ == YAHOO_LOGIN_SOCK )505 errstr = "Socket problem";506 532 else 507 533 errstr = "Unknown error"; … … 606 632 flags = 0; 607 633 break; 608 case YAHOO_STATUS_NOTIFY:609 state_string = "Notify";610 break;611 634 } 612 635 … … 615 638 if( stat == YAHOO_STATUS_IDLE ) 616 639 imcb_buddy_times( ic, who, 0, idle ); 640 } 641 642 void ext_yahoo_got_buzz( int id, const char *me, const char *who, long tm ) 643 { 617 644 } 618 645 … … 630 657 } 631 658 632 void ext_yahoo_got_file( int id, 633 const char *ignored, 634 const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize ) 659 void ext_yahoo_got_file( int id, const char *ignored, const char *who, const char *msg, 660 const char *fname, unsigned long fesize, char *trid ) 635 661 { 636 662 struct im_connection *ic = byahoo_get_ic_by_id( id ); 637 663 638 664 imcb_log( ic, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who ); 665 } 666 667 void ext_yahoo_got_ft_data( int id, const unsigned char *in, int len, void *data ) 668 { 669 } 670 671 void ext_yahoo_file_transfer_done( int id, int result, void *data ) 672 { 639 673 } 640 674 … … 649 683 } 650 684 651 void ext_yahoo_system_message( int id, const char *m sg )685 void ext_yahoo_system_message( int id, const char *me, const char *who, const char *msg ) 652 686 { 653 687 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 671 705 672 706 /* TODO: Clear up the mess of inp and d structures */ 673 int ext_yahoo_add_handler( int id, int fd, yahoo_input_condition cond, void *data )707 int ext_yahoo_add_handler( int id, void *fd_, yahoo_input_condition cond, void *data ) 674 708 { 675 709 struct byahoo_input_data *inp = g_new0( struct byahoo_input_data, 1 ); 710 int fd = (int) fd_; 676 711 677 712 if( cond == YAHOO_INPUT_READ ) … … 700 735 { 701 736 g_free( inp ); 702 return ( -1 );737 return -1; 703 738 /* Panic... */ 704 739 } 705 740 706 741 byahoo_inputs = g_slist_append( byahoo_inputs, inp ); 707 return ( inp->h );742 return inp->h; 708 743 } 709 744 … … 729 764 } 730 765 731 int ext_yahoo_connect_async( int id, const char *host, int port, yahoo_connect_callback callback, void *data )766 int ext_yahoo_connect_async( int id, const char *host, int port, yahoo_connect_callback callback, void *data, int use_ssl ) 732 767 { 733 768 struct byahoo_connect_callback_data *d; … … 745 780 d->id = id; 746 781 747 return( fd ); 782 return fd; 783 } 784 785 char *ext_yahoo_get_ip_addr( const char *domain ) 786 { 787 return NULL; 788 } 789 790 int ext_yahoo_write( void *fd, char *buf, int len ) 791 { 792 return write( (int) fd, buf, len ); 793 } 794 795 int ext_yahoo_read( void *fd, char *buf, int len ) 796 { 797 return read( (int) fd, buf, len ); 798 } 799 800 void ext_yahoo_close( void *fd ) 801 { 802 close( (int) fd ); 803 } 804 805 void ext_yahoo_got_buddy_change_group( int id, const char *me, const char *who, 806 const char *old_group, const char *new_group ) 807 { 808 struct im_connection *ic = byahoo_get_ic_by_id( id ); 809 810 imcb_add_buddy( ic, who, new_group ); 748 811 } 749 812 … … 752 815 int ext_yahoo_connect(const char *host, int port) 753 816 { 754 #if 0755 struct sockaddr_in serv_addr;756 static struct hostent *server;757 static char last_host[256];758 int servfd;759 char **p;760 761 if(last_host[0] || g_strcasecmp(last_host, host)!=0) {762 if(!(server = gethostbyname(host))) {763 return -1;764 }765 strncpy(last_host, host, 255);766 }767 768 if((servfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {769 return -1;770 }771 772 for (p = server->h_addr_list; *p; p++)773 {774 memset(&serv_addr, 0, sizeof(serv_addr));775 serv_addr.sin_family = AF_INET;776 memcpy(&serv_addr.sin_addr.s_addr, *p, server->h_length);777 serv_addr.sin_port = htons(port);778 779 if(connect(servfd, (struct sockaddr *) &serv_addr,780 sizeof(serv_addr)) == -1) {781 return -1;782 } else {783 return servfd;784 }785 }786 787 closesocket(servfd);788 #endif789 817 return -1; 790 818 } … … 898 926 } 899 927 900 void ext_yahoo_chat_join( int id, const char *who, const char *room, const char *topic, YList *members, intfd )928 void ext_yahoo_chat_join( int id, const char *who, const char *room, const char *topic, YList *members, void *fd ) 901 929 { 902 930 } … … 926 954 } 927 955 928 void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg )929 {930 struct im_connection *ic = byahoo_get_ic_by_id( id );931 932 imcb_ask_auth( ic, who, NULL );933 }934 935 956 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 936 957 { 937 958 struct im_connection *ic = byahoo_get_ic_by_id( id ); 938 959 939 imcb_a dd_buddy( ic, (char*) who, NULL);960 imcb_ask_auth( ic, who, msg ); 940 961 } 941 962 … … 944 965 } 945 966 946 void ext_yahoo_game_notify( int id, const char *me, const char *who, int stat )967 void ext_yahoo_game_notify( int id, const char *me, const char *who, int stat, const char *msg ) 947 968 { 948 969 } … … 989 1010 } 990 1011 991 void ext_yahoo_got_ping( int id, const char *msg )1012 void ext_yahoo_got_ping( int id, const char *msg ) 992 1013 { 993 1014 }
Note: See TracChangeset
for help on using the changeset viewer.