Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/yahoo.c

    r823de9d r99c8f13  
    197197{
    198198        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    199        
    200         ic->away = NULL;
     199        char *away;
     200       
     201        away = NULL;
    201202       
    202203        if( state && msg && g_strcasecmp( state, msg ) != 0 )
    203204        {
    204205                yd->current_status = YAHOO_STATUS_CUSTOM;
    205                 ic->away = "";
     206                away = "";
    206207        }
    207208        else if( state )
     
    212213                msg = NULL;
    213214               
    214                 ic->away = "";
     215                away = "";
    215216                if( g_strcasecmp( state, "Available" ) == 0 )
    216217                {
    217218                        yd->current_status = YAHOO_STATUS_AVAILABLE;
    218                         ic->away = NULL;
     219                        away = NULL;
    219220                }
    220221                else if( g_strcasecmp( state, "Be Right Back" ) == 0 )
     
    242243                        yd->current_status = YAHOO_STATUS_AVAILABLE;
    243244                       
    244                         ic->away = NULL;
     245                        away = NULL;
    245246                }
    246247        }
     
    248249                yd->current_status = YAHOO_STATUS_AVAILABLE;
    249250       
    250         yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL ? 2 : 0 );
     251        yahoo_set_away( yd->y2_id, yd->current_status, msg, away != NULL ? 2 : 0 );
    251252}
    252253
    253254static GList *byahoo_away_states( struct im_connection *ic )
    254255{
    255         GList *m = NULL;
    256 
    257         m = g_list_append( m, "Available" );
    258         m = g_list_append( m, "Be Right Back" );
    259         m = g_list_append( m, "Busy" );
    260         m = g_list_append( m, "Not At Home" );
    261         m = g_list_append( m, "Not At Desk" );
    262         m = g_list_append( m, "Not In Office" );
    263         m = g_list_append( m, "On Phone" );
    264         m = g_list_append( m, "On Vacation" );
    265         m = g_list_append( m, "Out To Lunch" );
    266         m = g_list_append( m, "Stepped Out" );
    267         m = g_list_append( m, "Invisible" );
    268         m = g_list_append( m, GAIM_AWAY_CUSTOM );
     256        static GList *m = NULL;
     257
     258        if( m == NULL )
     259        {
     260                m = g_list_append( m, "Available" );
     261                m = g_list_append( m, "Be Right Back" );
     262                m = g_list_append( m, "Busy" );
     263                m = g_list_append( m, "Not At Home" );
     264                m = g_list_append( m, "Not At Desk" );
     265                m = g_list_append( m, "Not In Office" );
     266                m = g_list_append( m, "On Phone" );
     267                m = g_list_append( m, "On Vacation" );
     268                m = g_list_append( m, "Out To Lunch" );
     269                m = g_list_append( m, "Stepped Out" );
     270                m = g_list_append( m, "Invisible" );
     271                m = g_list_append( m, GAIM_AWAY_CUSTOM );
     272        }
    269273       
    270274        return m;
     
    347351}
    348352
     353static void byahoo_auth_allow( struct im_connection *ic, const char *who )
     354{
     355        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
     356       
     357        yahoo_accept_buddy_ymsg13( yd->y2_id, NULL, who );
     358}
     359
     360static void byahoo_auth_deny( struct im_connection *ic, const char *who )
     361{
     362        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
     363       
     364        yahoo_reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL );
     365}
     366
    349367void byahoo_initmodule( )
    350368{
    351369        struct prpl *ret = g_new0(struct prpl, 1);
    352370        ret->name = "yahoo";
    353     ret->mms = 832;           /* this guess taken from libotr UPGRADING file */
    354371        ret->init = byahoo_init;
    355372       
     
    373390        ret->handle_cmp = g_strcasecmp;
    374391       
     392        ret->auth_allow = byahoo_auth_allow;
     393        ret->auth_deny = byahoo_auth_deny;
     394       
    375395        register_protocol(ret);
    376396}
     
    452472        struct byahoo_write_ready_data *d = data;
    453473       
    454         yahoo_write_ready( d->id, d->fd, d->data );
    455        
    456         return FALSE;
     474        return yahoo_write_ready( d->id, d->fd, d->data );
    457475}
    458476
     
    791809{
    792810        struct byahoo_conf_invitation *inv = data;
    793        
    794         yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
    795         imcb_chat_add_buddy( inv->c, inv->ic->acc->user );
     811        struct groupchat *b;
     812       
     813        for( b = inv->ic->groupchats; b; b = b->next )
     814                if( b == inv->c )
     815                        break;
     816       
     817        if( b != NULL )
     818        {
     819                yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
     820                imcb_chat_add_buddy( inv->c, inv->ic->acc->user );
     821        }
     822        else
     823        {
     824                imcb_log( inv->ic, "Duplicate/corrupted invitation to `%s'.", inv->name );
     825        }
     826       
    796827        g_free( inv->name );
    797828        g_free( inv );
     
    909940}
    910941
     942void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg )
     943{
     944        struct im_connection *ic = byahoo_get_ic_by_id( id );
     945       
     946        imcb_ask_auth( ic, who, NULL );
     947}
     948
    911949void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg )
    912950{
    913         /* Groups schmoups. If I want to handle groups properly I can get the
    914            buddy data from some internal libyahoo2 structure. */
    915         imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL );
     951        struct im_connection *ic = byahoo_get_ic_by_id( id );
     952       
     953        imcb_add_buddy( ic, (char*) who, NULL );
    916954}
    917955
Note: See TracChangeset for help on using the changeset viewer.