80 lines
1.0 KiB
C++
Executable File
80 lines
1.0 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "threadinfo.h"
|
|
|
|
|
|
|
|
namespace Thread
|
|
{
|
|
|
|
void ThreadInfo::SetDb(Db * pdb)
|
|
{
|
|
db = pdb;
|
|
}
|
|
|
|
|
|
void ThreadInfo::SetTDb(TDb * ptdb)
|
|
{
|
|
tdb = ptdb;
|
|
}
|
|
|
|
|
|
void ThreadInfo::SetSystem(System * psystem)
|
|
{
|
|
system = psystem;
|
|
}
|
|
|
|
|
|
void ThreadInfo::Clear()
|
|
{
|
|
item_tab.clear();
|
|
thread_tab.clear();
|
|
item_sort_tab.clear();
|
|
}
|
|
|
|
|
|
|
|
Item * ThreadInfo::FindThreadDir()
|
|
{
|
|
const std::wstring & dir_str = system->mounts.pmount->FirstArg(mount_par_thread_dir);
|
|
|
|
if( dir_str.empty() )
|
|
return 0;
|
|
|
|
int res = system->FollowAllLinks(dir_str, out_dir_tab, out_item);
|
|
|
|
if( res != 0 )
|
|
return 0;
|
|
|
|
return out_dir_tab.back();
|
|
}
|
|
|
|
|
|
|
|
void ThreadInfo::RemoveThread(long file_id)
|
|
{
|
|
if( tdb->GetAnswers(file_id, remove_answer_id_tab) == WINIX_ERR_OK )
|
|
{
|
|
for(size_t i=0 ; i<remove_answer_id_tab.size() ; ++i)
|
|
db->DelFileById(remove_answer_id_tab[i]);
|
|
}
|
|
|
|
tdb->RemoveThread(file_id);
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
|