Skip to content

Commit

Permalink
Properly initialize the bee_user data
Browse files Browse the repository at this point in the history
This is mainly for sanity and consistency as the bee_user should be
zeroed.
  • Loading branch information
jgeboski committed Mar 11, 2016
1 parent e9b15f9 commit 205d2ed
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions facebook/facebook.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fb_cb_api_contacts(FbApi *api, GSList *users, gboolean complete, gpointer data)
}

if (GPOINTER_TO_INT(bu->data)) {
bu->data = NULL;
bu->data = GINT_TO_POINTER(FALSE);
} else {
imcb_remove_buddy(ic, bu->handle, NULL);
}
Expand Down Expand Up @@ -870,6 +870,18 @@ fb_away_states(struct im_connection *ic)
return m;
}

static void
fb_buddy_data_add(struct bee_user *bu)
{
bu->data = GINT_TO_POINTER(FALSE);
}

static void
fb_buddy_data_free(struct bee_user *bu)
{
bu->data = NULL;
}

static account_t *
fb_cmd_account(irc_t *irc, char **args, guint required, guint *offset)
{
Expand Down Expand Up @@ -1068,7 +1080,9 @@ init_plugin(void)
.chat_join = fb_chat_join,
.chat_topic = fb_chat_topic,
.away_states = fb_away_states,
.handle_cmp = g_strcmp0
.handle_cmp = g_strcmp0,
.buddy_data_add = fb_buddy_data_add,
.buddy_data_free = fb_buddy_data_free
};

#if !GLIB_CHECK_VERSION(2, 36, 0)
Expand Down

0 comments on commit 205d2ed

Please sign in to comment.