Ticket #917: gadugadu-local-clist-fixed.patch
File gadugadu-local-clist-fixed.patch, 3.0 KB (added by , at 2014-01-15T23:53:57Z) |
---|
-
protocols/account.c
a b 27 27 #include "bitlbee.h" 28 28 #include "account.h" 29 29 30 static const char* account_protocols_local[] = { 31 "gg", NULL 32 }; 33 30 34 static char *set_eval_nick_source( set_t *set, char *value ); 31 35 32 36 account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass ) … … static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond 338 342 339 343 void account_on( bee_t *bee, account_t *a ) 340 344 { 345 GHashTableIter nicks; 346 gpointer k, v; 347 341 348 if( a->ic ) 342 349 { 343 350 /* Trying to enable an already-enabled account */ … … void account_on( bee_t *bee, account_t *a ) 351 358 352 359 if( a->ic && !( a->ic->flags & ( OPT_SLOW_LOGIN | OPT_LOGGED_IN ) ) ) 353 360 a->ic->keepalive = b_timeout_add( 120000, account_on_timeout, a->ic ); 361 362 if( a->flags & ACC_FLAG_LOCAL ) 363 { 364 g_hash_table_iter_init(&nicks, a->nicks); 365 while( g_hash_table_iter_next( &nicks, &k, &v ) ) 366 { 367 a->prpl->add_buddy( a->ic, (char*) k, NULL ); 368 } 369 } 354 370 } 355 371 356 372 void account_off( bee_t *bee, account_t *a ) … … int account_reconnect_delay( account_t *a ) 456 472 457 473 return a->auto_reconnect_delay; 458 474 } 475 476 int protocol_account_islocal( const char* protocol ) 477 { 478 const char** p = account_protocols_local; 479 do { 480 if( strcmp( *p, protocol ) == 0 ) 481 return 1; 482 } while( *( ++p ) ); 483 return 0; 484 } -
protocols/account.h
a b char *set_eval_account( set_t *set, char *value ); 58 58 char *set_eval_account_reconnect_delay( set_t *set, char *value ); 59 59 int account_reconnect_delay( account_t *a ); 60 60 61 int protocol_account_islocal( const char* protocol ); 62 61 63 typedef enum 62 64 { 63 65 ACC_SET_OFFLINE_ONLY = 0x02, /* Allow changes only if the acct is offline. */ … … typedef enum 69 71 ACC_FLAG_AWAY_MESSAGE = 0x01, /* Supports away messages instead of just states. */ 70 72 ACC_FLAG_STATUS_MESSAGE = 0x02, /* Supports status messages (without being away). */ 71 73 ACC_FLAG_HANDLE_DOMAINS = 0x04, /* Contact handles need a domain portion. */ 74 ACC_FLAG_LOCAL = 0x08, /* Contact list is local. */ 72 75 } account_flag_t; 73 76 74 77 #endif -
storage_xml.c
a b static xt_status handle_account( struct xt_node *node, gpointer data ) 86 86 char *protocol, *handle, *server, *password = NULL, *autoconnect, *tag; 87 87 char *pass_b64 = NULL; 88 88 unsigned char *pass_cr = NULL; 89 int pass_len ;89 int pass_len, local = 0; 90 90 struct prpl *prpl = NULL; 91 91 account_t *acc; 92 92 struct xt_node *c; … … static xt_status handle_account( struct xt_node *node, gpointer data ) 99 99 100 100 protocol = xt_find_attr( node, "protocol" ); 101 101 if( protocol ) 102 { 102 103 prpl = find_protocol( protocol ); 104 local = protocol_account_islocal( protocol ); 105 } 103 106 104 107 if( !handle || !pass_b64 || !protocol || !prpl ) 105 108 return XT_ABORT; … … static xt_status handle_account( struct xt_node *node, gpointer data ) 113 116 set_setstr( &acc->set, "auto_connect", autoconnect ); 114 117 if( tag ) 115 118 set_setstr( &acc->set, "tag", tag ); 119 if( local ) 120 acc->flags |= ACC_FLAG_LOCAL; 116 121 } 117 122 else 118 123 return XT_ABORT;