Changeset 1783ab6


Ignore:
Timestamp:
2014-07-24T03:51:07Z (10 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
269580c
Parents:
757515a
Message:

Gadugadu local contact storage (ticket #917)

Patch originally by Michał Siejak, adapted for 3.2.1

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/account.c

    r757515a r1783ab6  
    2727#include "bitlbee.h"
    2828#include "account.h"
     29
     30static const char* account_protocols_local[] = {
     31        "gg", NULL
     32};
    2933
    3034static char *set_eval_nick_source( set_t *set, char *value );
     
    347351void account_on( bee_t *bee, account_t *a )
    348352{
     353        GHashTableIter nicks;
     354        gpointer k, v;
     355
    349356        if( a->ic )
    350357        {
     
    360367        if( a->ic && !( a->ic->flags & ( OPT_SLOW_LOGIN | OPT_LOGGED_IN ) ) )
    361368                a->ic->keepalive = b_timeout_add( 120000, account_on_timeout, a->ic );
     369
     370        if( a->flags & ACC_FLAG_LOCAL )
     371        {
     372                g_hash_table_iter_init(&nicks, a->nicks);
     373                while( g_hash_table_iter_next( &nicks, &k, &v ) )
     374                {
     375                        a->prpl->add_buddy( a->ic, (char*) k, NULL );
     376                }
     377        }
    362378}
    363379
     
    465481        return a->auto_reconnect_delay;
    466482}
     483
     484int protocol_account_islocal( const char* protocol )
     485{
     486        const char** p = account_protocols_local;
     487        do {
     488                if( strcmp( *p, protocol ) == 0 )
     489                        return 1;
     490        } while( *( ++p ) );
     491        return 0;
     492}
  • protocols/account.h

    r757515a r1783ab6  
    5959int account_reconnect_delay( account_t *a );
    6060
     61int protocol_account_islocal( const char* protocol );
     62
    6163typedef enum
    6264{
     
    7072        ACC_FLAG_STATUS_MESSAGE = 0x02, /* Supports status messages (without being away). */
    7173        ACC_FLAG_HANDLE_DOMAINS = 0x04, /* Contact handles need a domain portion. */
     74        ACC_FLAG_LOCAL = 0x08,          /* Contact list is local. */
    7275} account_flag_t;
    7376
  • storage_xml.c

    r757515a r1783ab6  
    8787        char *pass_b64 = NULL;
    8888        unsigned char *pass_cr = NULL;
    89         int pass_len;
     89        int pass_len, local = 0;
    9090        struct prpl *prpl = NULL;
    9191        account_t *acc;
     
    100100        protocol = xt_find_attr( node, "protocol" );
    101101        if( protocol )
     102        {
    102103                prpl = find_protocol( protocol );
     104                local = protocol_account_islocal( protocol );
     105        }
    103106       
    104107        if( !handle || !pass_b64 || !protocol || !prpl )
     
    114117                if( tag )
    115118                        set_setstr( &acc->set, "tag", tag );
     119                if( local )
     120                        acc->flags |= ACC_FLAG_LOCAL;
    116121        }
    117122        else
Note: See TracChangeset for help on using the changeset viewer.