static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { struct irc_conn *irc = (struct irc_conn *)gc->proto_data; struct irc_buddy *ib = g_new0(struct irc_buddy, 1); ib->name = g_strdup(buddy->name); g_hash_table_insert(irc->buddies, ib->name, ib); /* if the timer isn't set, this is during signon, so we don't want to flood * ourself off with ISON's, so we don't, but after that we want to know when * someone's online asap */ if (irc->timer) irc_ison_one(irc, ib); }
static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { struct irc_conn *irc = (struct irc_conn *)gc->proto_data; struct irc_buddy *ib; const char *bname = purple_buddy_get_name(buddy); ib = g_hash_table_lookup(irc->buddies, bname); if (ib != NULL) { ib->ref++; purple_prpl_got_user_status(irc->account, bname, ib->online ? "available" : "offline", NULL); } else { ib = g_new0(struct irc_buddy, 1); ib->name = g_strdup(bname); ib->ref = 1; g_hash_table_replace(irc->buddies, ib->name, ib); } /* if the timer isn't set, this is during signon, so we don't want to flood * ourself off with ISON's, so we don't, but after that we want to know when * someone's online asap */ if (irc->timer) irc_ison_one(irc, ib); }