Changes in protocols/yahoo/yahoo.c [c495217:56699f0]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/yahoo/yahoo.c
rc495217 r56699f0 2 2 * libyahoo2 wrapper to BitlBee 3 3 * 4 * Mostly Copyright 2004 -2010Wilmer van der Gaast <wilmer@gaast.net>4 * Mostly Copyright 2004 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 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 ); 273 274 yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP, NULL ); 299 275 } 300 276 … … 365 341 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 366 342 367 yahoo_ confirm_buddy( yd->y2_id, who, 0, "");343 yahoo_accept_buddy_ymsg13( yd->y2_id, NULL, who ); 368 344 } 369 345 … … 372 348 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 373 349 374 yahoo_ confirm_buddy( yd->y2_id, who, 1, "");350 yahoo_reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL ); 375 351 } 376 352 … … 445 421 } 446 422 447 d->callback( NULL +d->fd, 0, d->data );423 d->callback( d->fd, 0, d->data ); 448 424 g_free( d ); 449 425 } … … 465 441 return FALSE; 466 442 467 yahoo_read_ready( d->id, NULL +d->fd, d->data );443 yahoo_read_ready( d->id, d->fd, d->data ); 468 444 469 445 return TRUE; … … 482 458 struct byahoo_write_ready_data *d = data; 483 459 484 return yahoo_write_ready( d->id, NULL +d->fd, d->data );460 return yahoo_write_ready( d->id, d->fd, d->data ); 485 461 } 486 462 … … 511 487 { 512 488 char *errstr; 513 int allow_reconnect = FALSE;489 int allow_reconnect = TRUE; 514 490 515 491 yd->logged_in = FALSE; … … 521 497 else if( succ == YAHOO_LOGIN_LOCK ) 522 498 errstr = "Yahoo! account locked"; 523 else if( succ == 1236 )524 errstr = "Yahoo! account locked or machine temporarily banned";525 499 else if( succ == YAHOO_LOGIN_DUPL ) 500 { 526 501 errstr = "Logged in on a different machine or device"; 502 allow_reconnect = FALSE; 503 } 527 504 else if( succ == YAHOO_LOGIN_SOCK ) 528 {529 505 errstr = "Socket problem"; 530 allow_reconnect = TRUE;531 }532 506 else 533 507 errstr = "Unknown error"; … … 632 606 flags = 0; 633 607 break; 608 case YAHOO_STATUS_NOTIFY: 609 state_string = "Notify"; 610 break; 634 611 } 635 612 … … 638 615 if( stat == YAHOO_STATUS_IDLE ) 639 616 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 {644 617 } 645 618 … … 657 630 } 658 631 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 ) 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 ) 661 635 { 662 636 struct im_connection *ic = byahoo_get_ic_by_id( id ); 663 637 664 638 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 {673 639 } 674 640 … … 683 649 } 684 650 685 void ext_yahoo_system_message( int id, const char *m e, const char *who, const char *msg )651 void ext_yahoo_system_message( int id, const char *msg ) 686 652 { 687 653 struct im_connection *ic = byahoo_get_ic_by_id( id ); … … 705 671 706 672 /* TODO: Clear up the mess of inp and d structures */ 707 int ext_yahoo_add_handler( int id, void *fd_, yahoo_input_condition cond, void *data )673 int ext_yahoo_add_handler( int id, int fd, yahoo_input_condition cond, void *data ) 708 674 { 709 675 struct byahoo_input_data *inp = g_new0( struct byahoo_input_data, 1 ); 710 int fd = (int) fd_;711 676 712 677 if( cond == YAHOO_INPUT_READ ) … … 735 700 { 736 701 g_free( inp ); 737 return -1;702 return( -1 ); 738 703 /* Panic... */ 739 704 } 740 705 741 706 byahoo_inputs = g_slist_append( byahoo_inputs, inp ); 742 return inp->h;707 return( inp->h ); 743 708 } 744 709 … … 764 729 } 765 730 766 int ext_yahoo_connect_async( int id, const char *host, int port, yahoo_connect_callback callback, void *data , int use_ssl)731 int ext_yahoo_connect_async( int id, const char *host, int port, yahoo_connect_callback callback, void *data ) 767 732 { 768 733 struct byahoo_connect_callback_data *d; … … 780 745 d->id = id; 781 746 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 ); 747 return( fd ); 811 748 } 812 749 … … 815 752 int ext_yahoo_connect(const char *host, int port) 816 753 { 754 #if 0 755 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 #endif 817 789 return -1; 818 790 } … … 926 898 } 927 899 928 void ext_yahoo_chat_join( int id, const char *who, const char *room, const char *topic, YList *members, void *fd )900 void ext_yahoo_chat_join( int id, const char *who, const char *room, const char *topic, YList *members, int fd ) 929 901 { 930 902 } … … 954 926 } 955 927 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 956 935 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 957 936 { 958 937 struct im_connection *ic = byahoo_get_ic_by_id( id ); 959 938 960 imcb_a sk_auth( ic, who, msg);939 imcb_add_buddy( ic, (char*) who, NULL ); 961 940 } 962 941 … … 965 944 } 966 945 967 void ext_yahoo_game_notify( int id, const char *me, const char *who, int stat , const char *msg)946 void ext_yahoo_game_notify( int id, const char *me, const char *who, int stat ) 968 947 { 969 948 } … … 1010 989 } 1011 990 1012 void ext_yahoo_got_ping( int id, const char *msg 991 void ext_yahoo_got_ping( int id, const char *msg) 1013 992 { 1014 993 }
Note: See TracChangeset
for help on using the changeset viewer.