Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/yahoo.c

    rdfbb056 rbe915f5  
    130130{
    131131        set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc );
     132       
     133        acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;
    132134}
    133135
     
    198200        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    199201       
    200         ic->away = NULL;
    201        
    202         if( state && msg && g_strcasecmp( state, msg ) != 0 )
    203         {
    204                 yd->current_status = YAHOO_STATUS_CUSTOM;
    205                 ic->away = "";
    206         }
    207         else if( state )
    208         {
    209                 /* Set msg to NULL since (if it isn't NULL already) it's equal
    210                    to state. msg must be empty if we want to use an existing
    211                    away state. */
    212                 msg = NULL;
    213                
    214                 ic->away = "";
    215                 if( g_strcasecmp( state, "Available" ) == 0 )
    216                 {
    217                         yd->current_status = YAHOO_STATUS_AVAILABLE;
    218                         ic->away = NULL;
    219                 }
    220                 else if( g_strcasecmp( state, "Be Right Back" ) == 0 )
     202        if( state && msg == NULL )
     203        {
     204                /* Use these states only if msg doesn't contain additional
     205                   info since away messages are only supported with CUSTOM. */
     206                if( g_strcasecmp( state, "Be Right Back" ) == 0 )
    221207                        yd->current_status = YAHOO_STATUS_BRB;
    222208                else if( g_strcasecmp( state, "Busy" ) == 0 )
     
    238224                else if( g_strcasecmp( state, "Invisible" ) == 0 )
    239225                        yd->current_status = YAHOO_STATUS_INVISIBLE;
    240                 else if( g_strcasecmp( state, GAIM_AWAY_CUSTOM ) == 0 )
    241                 {
    242                         yd->current_status = YAHOO_STATUS_AVAILABLE;
    243                        
    244                         ic->away = NULL;
    245                 }
    246         }
     226                else
     227                        yd->current_status = YAHOO_STATUS_CUSTOM;
     228        }
     229        else if( state )
     230                yd->current_status = YAHOO_STATUS_CUSTOM;
    247231        else
    248232                yd->current_status = YAHOO_STATUS_AVAILABLE;
    249233       
    250         yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL ? 2 : 0 );
     234        yahoo_set_away( yd->y2_id, yd->current_status, msg, state ? 2 : 0 );
    251235}
    252236
    253237static GList *byahoo_away_states( struct im_connection *ic )
    254238{
    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 );
     239        static GList *m = NULL;
     240
     241        if( m == NULL )
     242        {
     243                m = g_list_append( m, "Be Right Back" );
     244                m = g_list_append( m, "Busy" );
     245                m = g_list_append( m, "Not At Home" );
     246                m = g_list_append( m, "Not At Desk" );
     247                m = g_list_append( m, "Not In Office" );
     248                m = g_list_append( m, "On Phone" );
     249                m = g_list_append( m, "On Vacation" );
     250                m = g_list_append( m, "Out To Lunch" );
     251                m = g_list_append( m, "Stepped Out" );
     252                m = g_list_append( m, "Invisible" );
     253        }
    269254       
    270255        return m;
     
    345330       
    346331        return c;
     332}
     333
     334static void byahoo_auth_allow( struct im_connection *ic, const char *who )
     335{
     336        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
     337       
     338        yahoo_accept_buddy_ymsg13( yd->y2_id, NULL, who );
     339}
     340
     341static void byahoo_auth_deny( struct im_connection *ic, const char *who )
     342{
     343        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
     344       
     345        yahoo_reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL );
    347346}
    348347
     
    372371        ret->handle_cmp = g_strcasecmp;
    373372       
     373        ret->auth_allow = byahoo_auth_allow;
     374        ret->auth_deny = byahoo_auth_deny;
     375       
    374376        register_protocol(ret);
    375377}
     
    451453        struct byahoo_write_ready_data *d = data;
    452454       
    453         yahoo_write_ready( d->id, d->fd, d->data );
    454        
    455         return FALSE;
     455        return yahoo_write_ready( d->id, d->fd, d->data );
    456456}
    457457
     
    665665       
    666666        imcb_error( ic, "%s", err );
    667        
    668         if( fatal )
    669                 imc_logout( ic, TRUE );
    670667}
    671668
     
    793790{
    794791        struct byahoo_conf_invitation *inv = data;
    795        
    796         yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
    797         imcb_chat_add_buddy( inv->c, inv->ic->acc->user );
     792        struct groupchat *b;
     793       
     794        for( b = inv->ic->groupchats; b; b = b->next )
     795                if( b == inv->c )
     796                        break;
     797       
     798        if( b != NULL )
     799        {
     800                yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
     801                imcb_chat_add_buddy( inv->c, inv->ic->acc->user );
     802        }
     803        else
     804        {
     805                imcb_log( inv->ic, "Duplicate/corrupted invitation to `%s'.", inv->name );
     806        }
     807       
    798808        g_free( inv->name );
    799809        g_free( inv );
     
    911921}
    912922
     923void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg )
     924{
     925        struct im_connection *ic = byahoo_get_ic_by_id( id );
     926       
     927        imcb_ask_auth( ic, who, NULL );
     928}
     929
    913930void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg )
    914931{
    915         /* Groups schmoups. If I want to handle groups properly I can get the
    916            buddy data from some internal libyahoo2 structure. */
    917         imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL );
     932        struct im_connection *ic = byahoo_get_ic_by_id( id );
     933       
     934        imcb_add_buddy( ic, (char*) who, NULL );
    918935}
    919936
Note: See TracChangeset for help on using the changeset viewer.