Changeset 23411c6


Ignore:
Timestamp:
2007-08-20T22:00:16Z (17 years ago)
Author:
VMiklos <vmiklos@…>
Branches:
master
Children:
98bca36
Parents:
f78f949
Message:

implement skype_set_away()

Location:
skype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skype/README

    rf78f949 r23411c6  
    9292- Adding / removing contacts
    9393
     94- Set away state when you do a `/away`.
     95
    9496== What needs to be done (aka. TODO)
    9597
    9698- detect when somebody wants to add us (confirm callback)
    9799
    98 - Due to some API limitations, I have no idea how to change status. This affects:
    99   * When you `/away`, Skype will be still show `Online`
    100   * When you `account off`, Skype will not set status to `Offline`
    101   * When you `account on`, Skype will not set status to `Online`
     100-  When you `account off`, Skype will not set status to `Offline`
     101-  When you `account on`, Skype will not set status to `Online`
    102102
    103103== I would like to have support for ...
  • skype/skype.c

    rf78f949 r23411c6  
    4040        { "DND",      "Do Not Disturb" },
    4141        { "INVISIBLE",      "Invisible" },
    42         { "OFFLINE",      "Offline" }
     42        { "OFFLINE",      "Offline" },
     43        { NULL, NULL}
    4344};
    4445
     
    258259}
    259260
     261const struct skype_away_state *skype_away_state_by_name( char *name )
     262{
     263        int i;
     264
     265        for( i = 0; skype_away_state_list[i].full_name; i ++ )
     266                if( g_strcasecmp( skype_away_state_list[i].full_name, name ) == 0 )
     267                        return( skype_away_state_list + i );
     268
     269        return NULL;
     270}
     271
    260272static void skype_set_away( struct im_connection *ic, char *state_txt, char *message )
    261273{
     274        const struct skype_away_state *state;
     275        char *buf;
     276
     277        if( strcmp( state_txt, GAIM_AWAY_CUSTOM ) == 0 )
     278                state = skype_away_state_by_name( "Away" );
     279        else
     280                state = skype_away_state_by_name( state_txt );
     281        printf("would set to: '%s'\n", state->code);
     282        buf = g_strdup_printf("SET USERSTATUS %s\n", state->code);
     283        skype_write( ic, buf, strlen( buf ) );
     284        g_free(buf);
    262285}
    263286
    264287static GList *skype_away_states( struct im_connection *ic )
    265288{
    266         static GList *l = NULL;
     289        GList *l = NULL;
    267290        int i;
    268291       
    269         if( l == NULL )
    270                 for( i = 0; skype_away_state_list[i].full_name; i ++ )
    271                         l = g_list_append( l, (void*) skype_away_state_list[i].full_name );
     292        for( i = 0; skype_away_state_list[i].full_name; i ++ )
     293                l = g_list_append( l, (void*) skype_away_state_list[i].full_name );
    272294       
    273295        return l;
     
    315337        ret->add_buddy = skype_add_buddy;
    316338        ret->remove_buddy = skype_remove_buddy;
    317         ret->away_states = skype_away_states;
    318         ret->set_away = skype_set_away;
    319339        ret->handle_cmp = g_strcasecmp;
    320340        register_protocol( ret );
Note: See TracChangeset for help on using the changeset viewer.