extern int accountlist_create(void) { eventlog(eventlog_level_info, __FUNCTION__, "started creating accountlist"); if (!(accountlist_head = hashtable_create(prefs_get_hashtable_size()))) { eventlog(eventlog_level_error, __FUNCTION__, "could not create accountlist_head"); return -1; } eventlog(eventlog_level_info, __FUNCTION__, "sca trace: head c"); if (!(accountlist_uid_head = hashtable_create(prefs_get_hashtable_size()))) { eventlog(eventlog_level_error, __FUNCTION__, "could not create accountlist_uid_head"); return -1; } eventlog(eventlog_level_info, __FUNCTION__, "sca trace: uidhead c"); /* load accounts without force, indexed storage types wont be loading */ accountlist_load_all(ST_NONE); eventlog(eventlog_level_info, __FUNCTION__, "sca trace: load"); maxuserid = storage->read_maxuserid(); eventlog(eventlog_level_info, __FUNCTION__, "sca trace: getmax"); eventlog(eventlog_level_info, __FUNCTION__, "sca trace: done"); return 0; }
void Ladders::rebuild(std::list<LadderList*>& laddersToRebuild) { t_entry * curr; t_account * account; unsigned int uid, primary, secondary, tertiary; eventlog(eventlog_level_debug,__FUNCTION__,"start rebuilding ladders"); if (accountlist_load_all(ST_FORCE)) { eventlog(eventlog_level_error, __FUNCTION__, "error loading all accounts"); return; } HASHTABLE_TRAVERSE(accountlist(),curr) { if ((account=((t_account *)entry_get_data(curr)))) { LadderReferencedObject referencedObject(account); for (std::list<LadderList*>::iterator lit(laddersToRebuild.begin()); lit!=laddersToRebuild.end(); lit++) { // only do handle referenceTypeAccount ladders here if ((*lit)->getReferenceType() != referenceTypeAccount) { continue; } if (referencedObject.getData((*lit)->getLadderKey(),uid,primary,secondary,tertiary)) { (*lit)->addEntry(uid, primary, secondary, tertiary, referencedObject); } } } } // now we would need to traverse teamlist, too. // how about comletly moving this code into team? eventlog(eventlog_level_debug,__FUNCTION__,"done rebuilding ladders"); }