Changeset 694be84


Ignore:
Timestamp:
2010-11-21T19:08:43Z (13 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
68adaf8
Parents:
5df65bd
Message:

Fetch Gadu-Gadu contact lists (libpurple-specific hardcoding hack). Bug
#679. Patch from "rover.orna".

Location:
protocols/purple
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/Makefile

    r5df65bd r694be84  
    4343purple_mod.o: $(objects)
    4444        @echo '*' Linking purple_mod.o
    45         $(LD) $(LFLAGS) $(objects) -o purple_mod.o
     45        @$(LD) $(LFLAGS) $(objects) -o purple_mod.o
    4646
    4747-include .depend/*.d
  • protocols/purple/purple.c

    r5df65bd r694be84  
    209209        }
    210210       
     211        if( strcmp( prpl->info->name, "Gadu-Gadu" ) == 0 )
     212                s = set_add( &acc->set, "gg_sync_contacts", "true", set_eval_bool, acc );
     213       
    211214        /* Go through all away states to figure out if away/status messages
    212215           are possible. */
     
    381384}
    382385
     386/* Bad bad gadu-gadu, not saving buddy list by itself */
     387static void purple_gg_buddylist_export( PurpleConnection *gc )
     388{
     389        struct im_connection *ic = purple_ic_by_gc( gc );
     390       
     391        if( set_getstr( &ic->acc->set, "gg_sync_contacts" ) )
     392        {
     393                GList *actions = gc->prpl->info->actions( gc->prpl, gc );
     394                GList *p;
     395                for( p = g_list_first(actions); p; p = p->next )
     396                {
     397                        if( ((PurplePluginAction*)p->data) &&
     398                            purple_menu_cmp( ((PurplePluginAction*)p->data)->label, "Upload buddylist to Server" ) == 0)
     399                        {
     400                                PurplePluginAction action;
     401                                action.plugin = gc->prpl;
     402                                action.context = gc;
     403                                action.user_data = NULL;
     404                                ((PurplePluginAction*)p->data)->callback(&action);
     405                                break;
     406                        }
     407                }
     408                g_list_free( actions );
     409        }
     410}
     411
     412static void purple_gg_buddylist_import( PurpleConnection *gc )
     413{
     414        struct im_connection *ic = purple_ic_by_gc( gc );
     415       
     416        if( set_getstr( &ic->acc->set, "gg_sync_contacts" ) )
     417        {
     418                GList *actions = gc->prpl->info->actions( gc->prpl, gc );
     419                GList *p;
     420                for( p = g_list_first(actions); p; p = p->next )
     421                {
     422                        if( ((PurplePluginAction*)p->data) &&
     423                            purple_menu_cmp( ((PurplePluginAction*)p->data)->label, "Download buddylist from Server" ) == 0 )
     424                        {
     425                                PurplePluginAction action;
     426                                action.plugin = gc->prpl;
     427                                action.context = gc;
     428                                action.user_data = NULL;
     429                                ((PurplePluginAction*)p->data)->callback(&action);
     430                                break;
     431                        }
     432                }
     433                g_list_free( actions );
     434        }
     435}
     436
    383437static void purple_add_buddy( struct im_connection *ic, char *who, char *group )
    384438{
     
    395449        purple_blist_add_buddy( pb, NULL, pg, NULL );
    396450        purple_account_add_buddy( (PurpleAccount*) ic->proto_data, pb );
     451
     452        purple_gg_buddylist_export( ((PurpleAccount*)ic->proto_data)->gc );
    397453}
    398454
     
    411467                purple_blist_remove_buddy( pb );
    412468        }
     469
     470        purple_gg_buddylist_export( ((PurpleAccount*)ic->proto_data)->gc );
    413471}
    414472
     
    629687                s->value = g_strdup( dn );
    630688        }
     689
     690        // user list needs to be requested for Gadu-Gadu
     691        purple_gg_buddylist_import( gc );
    631692       
    632693        if( gc->flags & PURPLE_CONNECTION_HTML )
Note: See TracChangeset for help on using the changeset viewer.