From 812031ba549e2b3ee7aa732b6e3e34237c903b56 Mon Sep 17 00:00:00 2001
From: dequis <dx@dxzone.com.ar>
Date: Fri, 23 Jan 2015 03:29:00 -0300
Subject: [PATCH] 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)
---
protocols/account.c | 14 +-------------
protocols/nogaim.c | 11 +++++++++++
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/protocols/account.c b/protocols/account.c
index 188e362..234b9de 100644
a
|
b
|
|
28 | 28 | #include "account.h" |
29 | 29 | |
30 | 30 | static const char* account_protocols_local[] = { |
31 | | "gg", NULL |
| 31 | "gg", "whatsapp", NULL |
32 | 32 | }; |
33 | 33 | |
34 | 34 | static char *set_eval_nick_source( set_t *set, char *value ); |
… |
… |
static gboolean account_on_timeout( gpointer d, gint fd, b_input_condition cond |
350 | 350 | |
351 | 351 | void account_on( bee_t *bee, account_t *a ) |
352 | 352 | { |
353 | | GHashTableIter nicks; |
354 | | gpointer k, v; |
355 | | |
356 | 353 | if( a->ic ) |
357 | 354 | { |
358 | 355 | /* Trying to enable an already-enabled account */ |
… |
… |
void account_on( bee_t *bee, account_t *a ) |
366 | 363 | |
367 | 364 | if( a->ic && !( a->ic->flags & ( OPT_SLOW_LOGIN | OPT_LOGGED_IN ) ) ) |
368 | 365 | 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 | | } |
378 | 366 | } |
379 | 367 | |
380 | 368 | void account_off( bee_t *bee, account_t *a ) |
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index ff1c9a8..0a674b4 100644
a
|
b
|
void imcb_connected( struct im_connection *ic ) |
293 | 293 | function should be handled correctly. (IOW, ignored) */ |
294 | 294 | if( ic->flags & OPT_LOGGED_IN ) |
295 | 295 | return; |
| 296 | |
| 297 | if( ic->acc->flags & ACC_FLAG_LOCAL ) |
| 298 | { |
| 299 | GHashTableIter nicks; |
| 300 | gpointer k, v; |
| 301 | g_hash_table_iter_init( &nicks, ic->acc->nicks ); |
| 302 | while( g_hash_table_iter_next( &nicks, &k, &v ) ) |
| 303 | { |
| 304 | ic->acc->prpl->add_buddy( ic, (char*) k, NULL ); |
| 305 | } |
| 306 | } |
296 | 307 | |
297 | 308 | imcb_log( ic, "Logged in" ); |
298 | 309 | |