qq_account* qq_account_new(PurpleAccount* account) { qq_account* ac = g_malloc0(sizeof(qq_account)); ac->account = account; ac->magic = QQ_MAGIC; ac->flag = 0; //this is auto increment sized array . so don't worry about it. const char* username = purple_account_get_username(account); const char* password = purple_account_get_password(account); ac->qq = lwqq_client_new(username,password); ac->js = lwqq_js_init(); ac->sys_log = purple_log_new(PURPLE_LOG_SYSTEM, "system", account, NULL, time(NULL), NULL); ac->font.family = s_strdup("宋体"); ac->font.size = 12; ac->font.style = 0; //lwqq_async_set(ac->qq,1); #if QQ_USE_FAST_INDEX ac->qq->find_buddy_by_uin = find_buddy_by_uin; ac->qq->find_buddy_by_qqnumber = find_buddy_by_qqnumber; ac->fast_index.uin_index = g_hash_table_new_full(g_str_hash,g_str_equal,g_free,g_free); ac->fast_index.qqnum_index = g_hash_table_new_full(g_str_hash,g_str_equal,g_free,NULL); #endif ac->qq->dispatch = qq_dispatch; return ac; }
qq_account* qq_account_new(PurpleAccount* account) { qq_account* ac = g_malloc0(sizeof(qq_account)); ac->account = account; ac->magic = QQ_MAGIC; ac->flag = 0; // this is auto increment sized array . so don't worry about it. const char* username = purple_account_get_username(account); const char* password = purple_account_get_password(account); ac->qq = lwqq_client_new(username, password); ac->js = lwqq_js_init(); ac->sys_log = purple_log_new(PURPLE_LOG_SYSTEM, "system", account, NULL, time(NULL), NULL); // add ~/.config/lwqq into search path lwqq_util_add_path(lwdb_get_config_dir()); #ifdef WITH_MOZJS lwqq_hash_add_entry(ac->qq, "hash_local", (LwqqHashFunc)hash_with_local_file, ac->js); lwqq_hash_add_entry(ac->qq, "hash_url", (LwqqHashFunc)hash_with_remote_file, ac->js); lwqq_hash_add_entry(ac->qq, "hash_db", (LwqqHashFunc)hash_with_db_url, ac); #endif ac->font.family = s_strdup("宋体"); ac->font.size = 12; ac->font.style = 0; // lwqq_async_set(ac->qq,1); #if QQ_USE_FAST_INDEX ac->qq->find_buddy_by_uin = find_buddy_by_uin; ac->qq->find_buddy_by_qqnumber = find_buddy_by_qqnumber; ac->fast_index.uin_index = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); ac->fast_index.qqnum_index = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); #endif ac->qq->dispatch = qq_dispatch; char cookie[256]; snprintf(cookie, sizeof(cookie), "%s/%s.cookie", lwdb_get_config_dir(), username); LwqqExtension* ext = lwqq_make_cookie_extension(ac->qq, cookie); ext->init(ac->qq, ext); return ac; }