question:mutil accounts how to logon in the nullclient.c

zjye-yezj zjye-yezj at 163.com
Fri Feb 27 03:41:46 EST 2009


i modify the main function in nullclient.c , now the two account can not logon at the sametime, just one account can logon. what's wrong in my process? may anyone tell me. thanks for all!
int main(int argc, char *argv[])
{
    GList *iter;
    int i, j, num;
    GList *names = NULL;
    const char *prpl;
    char *name;
    char *password;
    GMainLoop *loop = g_main_loop_new(NULL, FALSE);
    PurpleAccount *account;
    PurpleSavedStatus *status;

    /* libpurple's built-in DNS resolution forks processes to perform
     * blocking lookups without blocking the main process.  It does not
     * handle SIGCHLD itself, so if the UI does not you quickly get an army
     * of zombie subprocesses marching around.
     */
    init_libpurple();
    purple_debug_set_enabled(TRUE);
    printf("libpurple initialized.\n");

    iter = purple_plugins_get_protocols();
    for (j = 0, i = 0; iter; iter = iter->next) {
        PurplePlugin *plugin = iter->data;
        PurplePluginInfo *info = plugin->info;

        j++;

        printf("%d", j);

        if (info && info->name) {
            printf("\t%d: %s\n", i++, info->name);
            names = g_list_append(names, info->id);
        }
    }

    num = 6;
    prpl = g_list_nth_data(names, num);//"prpl-msn"
    name = "yezhengjun1982 at hotmail.com";
    account = purple_account_new(name, prpl);
    password = "******";
    purple_account_set_password(account, password);
    purple_accounts_add(account);
    purple_account_set_enabled(account, UI_ID, TRUE);

    num = 10;
    prpl = g_list_nth_data(names, num);////"prpl-jabber"
    name = "yezhengjun at gmail.com";
    account = purple_account_new(name, prpl);
    password = "******";
    purple_account_set_password(account, password);
    purple_accounts_add(account);
    purple_account_set_enabled(account, UI_ID, TRUE);

    /* Now, to connect the account(s), create a status and activate it. */
    status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE);
    purple_savedstatus_activate(status);

    connect_to_signals_for_demonstration_purposes_only();

    g_main_loop_run(loop);

    return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20090227/7a399947/attachment.html>


More information about the Devel mailing list