aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-01-23 03:29:00 -0300
committerdequis <dx@dxzone.com.ar>2015-01-25 23:43:35 -0300
commit11e782892c33d6ecae949bc610c075107c0cda89 (patch)
tree1e2a2caf0f1fc60d409c742151ce5caa57f6d3bd
parentfcb2c2eee4526bb58dccf17f8702d670dda62644 (diff)
Fix whatsapp local contact lists
Had to move the code that adds contacts to imcb_connected to avoid dereferencing a null im_connection. Turns out this kind of local contact lists only applies to renamed contacts, though. It doesn't deal with libpurple's blist.xml at all (it could, there are APIs for it since 2.6.0)
-rw-r--r--protocols/account.c14
-rw-r--r--protocols/nogaim.c11
2 files changed, 12 insertions, 13 deletions
diff --git a/protocols/account.c b/protocols/account.c
index 188e362e..234b9de2 100644
--- a/protocols/account.c
+++ b/protocols/account.c
@@ -28,7 +28,7 @@
#include "account.h"
static const char* account_protocols_local[] = {
- "gg", NULL
+ "gg", "whatsapp", NULL
};
static char *set_eval_nick_source( set_t *set, char *value );
@@ -350,9 +350,6 @@ static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond
void account_on( bee_t *bee, account_t *a )
{
- GHashTableIter nicks;
- gpointer k, v;
-
if( a->ic )
{
/* Trying to enable an already-enabled account */
@@ -366,15 +363,6 @@ void account_on( bee_t *bee, account_t *a )
if( a->ic && !( a->ic->flags & ( OPT_SLOW_LOGIN | OPT_LOGGED_IN ) ) )
a->ic->keepalive = b_timeout_add( 120000, account_on_timeout, a->ic );
-
- if( a->flags & ACC_FLAG_LOCAL )
- {
- g_hash_table_iter_init(&nicks, a->nicks);
- while( g_hash_table_iter_next( &nicks, &k, &v ) )
- {
- a->prpl->add_buddy( a->ic, (char*) k, NULL );
- }
- }
}
void account_off( bee_t *bee, account_t *a )
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index ff1c9a85..0a674b40 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -293,6 +293,17 @@ void imcb_connected( struct im_connection *ic )
function should be handled correctly. (IOW, ignored) */
if( ic->flags & OPT_LOGGED_IN )
return;
+
+ if( ic->acc->flags & ACC_FLAG_LOCAL )
+ {
+ GHashTableIter nicks;
+ gpointer k, v;
+ g_hash_table_iter_init( &nicks, ic->acc->nicks );
+ while( g_hash_table_iter_next( &nicks, &k, &v ) )
+ {
+ ic->acc->prpl->add_buddy( ic, (char*) k, NULL );
+ }
+ }
imcb_log( ic, "Logged in" );