UserPtr DirectoryListing::getUserFromFilename(const string& fileName) {
    // General file list name format: [username].[CID].[xml|xml.bz2|DcLst]

    string name = Util::getFileName(fileName);

    // Strip off any extensions
    if(Util::stricmp(name.c_str() + name.length() - 6, ".DcLst") == 0) {
        name.erase(name.length() - 6);
    }

    if(Util::stricmp(name.c_str() + name.length() - 4, ".bz2") == 0) {
        name.erase(name.length() - 4);
    }

    if(Util::stricmp(name.c_str() + name.length() - 4, ".xml") == 0) {
        name.erase(name.length() - 4);
    }

    // Find CID
    string::size_type i = name.rfind('.');
    if(i == string::npos) {
        return UserPtr();
    }

    size_t n = name.length() - (i + 1);
    // CID's always 39 chars long...
    if(n != 39)
        return UserPtr();

    CID cid(name.substr(i + 1));
    if(cid.isZero())
        return UserPtr();

    return ClientManager::getInstance()->getUser(cid);
}
示例#2
0
Client::Client(const string& p_HubURL, char separator_, bool secure_) :
	m_cs(std::unique_ptr<webrtc::RWLockWrapper> (webrtc::RWLockWrapper::CreateRWLock())),
	m_reconnDelay(120), m_lastActivity(GET_TICK()),
	//registered(false), [-] IRainman fix.
	autoReconnect(false),
	m_encoding(Text::systemCharset),
	state(STATE_DISCONNECTED),
	m_client_sock(0),
	m_HubURL(p_HubURL),
	m_port(0),
	m_separator(separator_),
	m_secure(secure_),
	m_countType(COUNT_UNCOUNTED),
	m_availableBytes(0),
	m_exclChecks(false) // [+] IRainman fix.
{
	dcassert(p_HubURL == Text::toLower(p_HubURL));
	const auto l_my_user = new User(ClientManager::getMyCID());
	const auto l_hub_user = new User(CID());
#ifdef PPA_INCLUDE_LASTIP_AND_USER_RATIO
	m_HubID = CFlylinkDBManager::getInstance()->get_dic_hub_id(m_HubURL);
	dcassert(m_HubID != 0);
	l_my_user->setHubID(m_HubID); // ƒл¤ сохранени¤ кол-ва мессаг по самому себе
	//l_hub_user->setHubID(m_HubID); // ƒл¤ бота-хаба не сохран¤ем пока
#endif
	m_myOnlineUser = new OnlineUser(UserPtr(l_my_user), *this, 0); // [+] IRainman fix.
	m_hubOnlineUser = new OnlineUser(UserPtr(l_hub_user), *this, AdcCommand::HUB_SID); // [+] IRainman fix.
	
	// [-] IRainman.
	//m_hEventClientInitialized = CreateEvent(NULL, TRUE, FALSE, NULL);//[+]FlylinkDC
	
	string file, proto, query, fragment;
	Util::decodeUrl(getHubUrl(), proto, m_address, m_port, file, query, fragment);
	if (!query.empty())
	{
		m_keyprint = Util::decodeQuery(query)["kp"];
#ifdef _DEBUG
		LogManager::getInstance()->message("keyprint = " + m_keyprint);
#endif
	}
#ifdef _DEBUG
	else
	{
		LogManager::getInstance()->message("hubURL = " + getHubUrl() + " query.empty()");
	}
#endif
	TimerManager::getInstance()->addListener(this);
}
示例#3
0
void op_wake()
{
 /* Stack:

     |=============================|=============================|
     |            BEFORE           |           AFTER             |
     |=============================|=============================|
 top |  QM user number of target   |                             |
     |=============================|=============================|
 */

 DESCRIPTOR * descr;
 short int uid;
 USER_ENTRY * uptr;

 descr = e_stack - 1;
 GetInt(descr);
 uid = (short int)(descr->data.value);
 k_dismiss();

 if ((uid > 0) && (uid <= sysseg->hi_user_no ))
  {
   uptr = UserPtr(uid);
   if (uptr != NULL)
    {
     uptr->flags |= USR_WAKE;

     kill(uptr->pid, SIGUSR1);
    }
  }
}
示例#4
0
文件: userlist.cpp 项目: N0U/lsl
const UserPtr UserList::FindByNick(const std::string &nick)
{
    MapType::const_iterator it = find( nick );
    if ( it != end() )
        return it->second;
    return UserPtr();
}
示例#5
0
TDataPlaneElementHandle::TDataPlaneElementHandle(MDataPlaneElement* aDataElement, TUint16 aElementID)
	{
	LOG_FUNC
	SetUserLen(sizeof(SDataPlaneElementHandle));
	SDataPlaneElementHandle* handlePtr = reinterpret_cast<SDataPlaneElementHandle*>(UserPtr());
	handlePtr->iDataElement = aDataElement;
	handlePtr->iElementID = aElementID;
	}
示例#6
0
TIrdaSockAddr::SIrdaAddr* TIrdaSockAddr::addrPtr() const
	{
	return (SIrdaAddr *)UserPtr();
	}
示例#7
0
TUint16 TDataPlaneElementHandle::ElementID() const
	{
	LOG_FUNC
	SDataPlaneElementHandle* handlePtr = reinterpret_cast<SDataPlaneElementHandle*>(UserPtr());
	return (handlePtr->iElementID);
	}
示例#8
0
MDataPlaneElement& TDataPlaneElementHandle::DataPlaneElement() const
	{
	LOG_FUNC
	SDataPlaneElementHandle* handlePtr = reinterpret_cast<SDataPlaneElementHandle*>(UserPtr());
	return *(handlePtr->iDataElement);
	}
示例#9
0
EXPORT_C SE64Addr* TEui64Addr::AddrPtr() const
{
	return (SE64Addr*)UserPtr();
}
示例#10
0
ADLSearchManager::ADLSearchManager() : breakOnFirst(false), user(UserPtr(), Util::emptyString) {
    load();
}
示例#11
0
ADLSearchManager::ADLSearchManager() : user(UserPtr(), Util::emptyString) { 
	load(); 
}