Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r098a75b r9076a1c  
    132132        extern void twitter_initmodule();
    133133        extern void purple_initmodule();
     134        extern void rpc_initmodule();
    134135
    135136#ifdef WITH_MSN
     
    155156#ifdef WITH_PURPLE
    156157        purple_initmodule();
     158#endif
     159
     160#ifdef WITH_RPC
     161        rpc_initmodule();
    157162#endif
    158163
     
    307312        }
    308313
    309         if (ic->acc->flags & ACC_FLAG_LOCAL) {
     314        if ((ic->acc->flags & ACC_FLAG_LOCAL_CONTACTS) &&
     315            !(ic->flags & OPT_LOCAL_CONTACTS_SENT) &&
     316            ic->acc->prpl->add_buddy) {
    310317                GHashTableIter nicks;
    311                 gpointer k, v;
     318                gpointer handle;
    312319                g_hash_table_iter_init(&nicks, ic->acc->nicks);
    313                 while (g_hash_table_iter_next(&nicks, &k, &v)) {
    314                         ic->acc->prpl->add_buddy(ic, (char *) k, NULL);
     320                while (g_hash_table_iter_next(&nicks, &handle, NULL)) {
     321                        ic->acc->prpl->add_buddy(ic, (char *) handle, NULL);
    315322                }
    316323        }
     
    407414        query_del_by_conn((irc_t *) ic->bee->ui_data, ic);
    408415
     416        /* Throw away groupchats owned by this account. Historically this was only
     417           ever done by IM modules which is a bug. But it gives them opportunity
     418           to clean up protocol-specific bits as well so keep it that way, just
     419           do another cleanup here as a fallback. Don't want to leave any dangling
     420           pointers! */
     421        while (ic->groupchats) {
     422                imcb_chat_free(ic->groupchats->data);
     423        }
     424
    409425        if (!a) {
    410426                /* Uhm... This is very sick. */
     
    492508}
    493509
     510/* Returns the local contacts for an IM account (based on assigned nicks).
     511   Linked list should be freed, the strings themselves not! So look at it
     512   like a GSList<const char*> I guess? Empty list means NULL retval (as
     513   always with GSList). */
     514GSList *imcb_get_local_contacts(struct im_connection *ic)
     515{
     516        GHashTableIter nicks;
     517        GSList *ret = NULL;
     518       
     519        if (!(ic->acc->flags & ACC_FLAG_LOCAL_CONTACTS)) {
     520                /* Only allow protocols that indicate local contact list
     521                   support to use this function. */
     522                return ret;
     523        }
     524       
     525        g_hash_table_iter_init(&nicks, ic->acc->nicks);
     526        gpointer handle;
     527        while (g_hash_table_iter_next(&nicks, &handle, NULL)) {
     528                ret = g_slist_prepend(ret, (char *) handle);
     529        }
     530       
     531        /* If the protocol asked for the list, assume we won't have to send it
     532           anymore in imcb_connected(). */
     533        ic->flags |= OPT_LOCAL_CONTACTS_SENT;
     534       
     535        return ret;
     536}
     537
    494538
    495539struct imcb_ask_cb_data {
     
    550594        struct imcb_ask_cb_data *cbd = data;
    551595
    552         cbd->ic->acc->prpl->add_buddy(cbd->ic, cbd->handle, NULL);
     596        if (cbd->ic->acc->prpl->add_buddy) {
     597                cbd->ic->acc->prpl->add_buddy(cbd->ic, cbd->handle, NULL);
     598        }
    553599
    554600        imcb_ask_cb_free(data);
Note: See TracChangeset for help on using the changeset viewer.