Ignore:
Timestamp:
2007-04-16T04:31:52Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
b3cae44
Parents:
6bbb939
Message:

Updating the Yahoo! module. This seems to fix handling of incoming away
states/messages, should fix some issues with group chats, and unfortunately
also adds some crap which I don't want to clean up for now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/yahoo.c

    r6bbb939 rcfc8d58  
    6767static int byahoo_chat_id = 0;
    6868
    69 static char *byahoo_strip( char *in )
     69static char *byahoo_strip( const char *in )
    7070{
    7171        int len;
     
    8686                else if( strncmp( in, "\e[", 2 ) == 0 )
    8787                {
    88                         char *s;
     88                        const char *s;
    8989                       
    9090                        for( s = in + 2; *s && *s != 'm'; s ++ );
     
    172172        struct byahoo_data *yd = ic->proto_data;
    173173       
    174         yahoo_send_im( yd->y2_id, NULL, who, what, 1 );
     174        yahoo_send_im( yd->y2_id, NULL, who, what, 1, 0 );
    175175       
    176176        return 1;
     
    240240                yd->current_status = YAHOO_STATUS_AVAILABLE;
    241241       
    242         yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL );
     242        yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL ? 2 : 0 );
    243243}
    244244
     
    274274        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    275275       
    276         yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP );
     276        yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP, NULL );
    277277}
    278278
     
    451451}
    452452
    453 void ext_yahoo_login_response( int id, int succ, char *url )
     453void ext_yahoo_login_response( int id, int succ, const char *url )
    454454{
    455455        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    543543}
    544544
    545 void ext_yahoo_status_changed( int id, char *who, int stat, char *msg, int away )
     545void ext_yahoo_status_changed( int id, const char *who, int stat, const char *msg, int away, int idle, int mobile )
    546546{
    547547        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    607607}
    608608
    609 void ext_yahoo_got_im( int id, char *who, char *msg, long tm, int stat, int utf8 )
     609void ext_yahoo_got_im( int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8 )
    610610{
    611611        struct im_connection *ic = byahoo_get_ic_by_id( id );
    612612        char *m = byahoo_strip( msg );
    613613       
    614         serv_got_im( ic, who, m, 0, 0, strlen( m ) );
     614        serv_got_im( ic, (char*) who, (char*) m, 0, 0, strlen( m ) );
    615615        g_free( m );
    616616}
    617617
    618 void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg, char *fname, unsigned long fesize )
     618void ext_yahoo_got_file( int id,
     619                         const char *ignored,
     620                         const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize )
    619621{
    620622        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    623625}
    624626
    625 void ext_yahoo_typing_notify( int id, char *who, int stat )
     627void ext_yahoo_typing_notify( int id, const char *ignored, const char *who, int stat )
    626628{
    627629        struct im_connection *ic = byahoo_get_ic_by_id( id );
    628630        if (stat == 1) {
    629631                /* User is typing */
    630                 serv_got_typing( ic, who, 1, 1 );
     632                serv_got_typing( ic, (char*) who, 1, 1 );
    631633        }
    632634        else {
    633635                /* User stopped typing */
    634                 serv_got_typing( ic, who, 1, 0 );
    635         }
    636 }
    637 
    638 void ext_yahoo_system_message( int id, char *msg )
     636                serv_got_typing( ic, (char*) who, 1, 0 );
     637        }
     638}
     639
     640void ext_yahoo_system_message( int id, const char *msg )
    639641{
    640642        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    643645}
    644646
    645 void ext_yahoo_webcam_invite( int id, char *from )
     647void ext_yahoo_webcam_invite( int id, const char *ignored, const char *from )
    646648{
    647649        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    650652}
    651653
    652 void ext_yahoo_error( int id, char *err, int fatal )
     654void ext_yahoo_error( int id, const char *err, int fatal, int num )
    653655{
    654656        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    719721}
    720722
    721 int ext_yahoo_connect_async( int id, char *host, int port, yahoo_connect_callback callback, void *data )
     723int ext_yahoo_connect_async( int id, const char *host, int port, yahoo_connect_callback callback, void *data )
    722724{
    723725        struct byahoo_connect_callback_data *d;
     
    740742/* Because we don't want asynchronous connects in BitlBee, and because
    741743   libyahoo doesn't seem to use this one anyway, this one is now defunct. */
    742 int ext_yahoo_connect(char *host, int port)
     744int ext_yahoo_connect(const char *host, int port)
    743745{
    744746#if 0
     
    796798}
    797799
    798 void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList *members )
     800void ext_yahoo_got_conf_invite( int id, const char *ignored,
     801                                const char *who, const char *room, const char *msg, YList *members )
    799802{
    800803        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    806809        memset( inv, 0, sizeof( struct byahoo_conf_invitation ) );
    807810        inv->name = g_strdup( room );
    808         inv->c = serv_got_joined_chat( ic, room );
     811        inv->c = serv_got_joined_chat( ic, (char*) room );
    809812        inv->c->data = members;
    810813        inv->yid = id;
     
    821824}
    822825
    823 void ext_yahoo_conf_userdecline( int id, char *who, char *room, char *msg )
     826void ext_yahoo_conf_userdecline( int id, const char *ignored, const char *who, const char *room, const char *msg )
    824827{
    825828        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    828831}
    829832
    830 void ext_yahoo_conf_userjoin( int id, char *who, char *room )
     833void ext_yahoo_conf_userjoin( int id, const char *ignored, const char *who, const char *room )
    831834{
    832835        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    836839       
    837840        if( c )
    838                 add_chat_buddy( c, who );
    839 }
    840 
    841 void ext_yahoo_conf_userleave( int id, char *who, char *room )
     841                add_chat_buddy( c, (char*) who );
     842}
     843
     844void ext_yahoo_conf_userleave( int id, const char *ignored, const char *who, const char *room )
     845
    842846{
    843847        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    847851       
    848852        if( c )
    849                 remove_chat_buddy( c, who, "" );
    850 }
    851 
    852 void ext_yahoo_conf_message( int id, char *who, char *room, char *msg, int utf8 )
     853                remove_chat_buddy( c, (char*) who, "" );
     854}
     855
     856void ext_yahoo_conf_message( int id, const char *ignored, const char *who, const char *room, const char *msg, int utf8 )
    853857{
    854858        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    859863       
    860864        if( c )
    861                 serv_got_chat_in( c, who, 0, m, 0 );
     865                serv_got_chat_in( c, (char*) who, 0, (char*) m, 0 );
    862866        g_free( m );
    863867}
    864868
    865 void ext_yahoo_chat_cat_xml( int id, char *xml )
    866 {
    867 }
    868 
    869 void ext_yahoo_chat_join( int id, char *room, char *topic, YList *members, int fd )
    870 {
    871 }
    872 
    873 void ext_yahoo_chat_userjoin( int id, char *room, struct yahoo_chat_member *who )
    874 {
    875 }
    876 
    877 void ext_yahoo_chat_userleave( int id, char *room, char *who )
    878 {
    879 }
    880 
    881 void ext_yahoo_chat_message( int id, char *who, char *room, char *msg, int msgtype, int utf8 )
    882 {
    883 }
    884 
    885 void ext_yahoo_chat_yahoologout( int id )
    886 {
    887 }
    888 
    889 void ext_yahoo_chat_yahooerror( int id )
    890 {
    891 }
    892 
    893 void ext_yahoo_contact_added( int id, char *myid, char *who, char *msg )
    894 {
    895 }
    896 
    897 void ext_yahoo_rejected( int id, char *who, char *msg )
    898 {
    899 }
    900 
    901 void ext_yahoo_game_notify( int id, char *who, int stat )
    902 {
    903 }
    904 
    905 void ext_yahoo_mail_notify( int id, char *from, char *subj, int cnt )
     869void ext_yahoo_chat_cat_xml( int id, const char *xml )
     870{
     871}
     872
     873void ext_yahoo_chat_join( int id, const char *who, const char *room, const char *topic, YList *members, int fd )
     874{
     875}
     876
     877void ext_yahoo_chat_userjoin( int id, const char *me, const char *room, struct yahoo_chat_member *who )
     878{
     879        free(who->id);
     880        free(who->alias);
     881        free(who->location);
     882        free(who);
     883}
     884
     885void ext_yahoo_chat_userleave( int id, const char *me, const char *room, const char *who )
     886{
     887}
     888
     889void ext_yahoo_chat_message( int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8 )
     890{
     891}
     892
     893void ext_yahoo_chat_yahoologout( int id, const char *me )
     894{
     895}
     896
     897void ext_yahoo_chat_yahooerror( int id, const char *me )
     898{
     899}
     900
     901void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg )
     902{
     903}
     904
     905void ext_yahoo_rejected( int id, const char *who, const char *msg )
     906{
     907}
     908
     909void ext_yahoo_game_notify( int id, const char *me, const char *who, int stat )
     910{
     911}
     912
     913void ext_yahoo_mail_notify( int id, const char *from, const char *subj, int cnt )
    906914{
    907915        struct im_connection *ic = byahoo_get_ic_by_id( id );
     
    913921}
    914922
    915 void ext_yahoo_webcam_invite_reply( int id, char *from, int accept )
    916 {
    917 }
    918 
    919 void ext_yahoo_webcam_closed( int id, char *who, int reason )
     923void ext_yahoo_webcam_invite_reply( int id, const char *me, const char *from, int accept )
     924{
     925}
     926
     927void ext_yahoo_webcam_closed( int id, const char *who, int reason )
    920928{
    921929}
     
    925933}
    926934
    927 void ext_yahoo_webcam_viewer( int id, char *who, int connect )
     935void ext_yahoo_webcam_viewer( int id, const char *who, int connect )
    928936{
    929937}
     
    933941}
    934942
    935 int ext_yahoo_log( char *fmt, ... )
     943int ext_yahoo_log( const char *fmt, ... )
    936944{
    937945        return( 0 );
     
    941949{
    942950}
     951
     952void ext_yahoo_got_ping( int id, const char *msg)
     953{
     954}
     955
     956void ext_yahoo_got_buddyicon (int id, const char *me, const char *who, const char *url, int checksum) {}
     957void ext_yahoo_got_buddyicon_checksum (int id, const char *me,const char *who, int checksum) {}
     958
     959void ext_yahoo_got_buddyicon_request(int id, const char *me, const char *who){}
     960void ext_yahoo_buddyicon_uploaded(int id, const char *url){}
Note: See TracChangeset for help on using the changeset viewer.