Пример #1
0
// decode a service in a form 'alias/shortname-sid'
void decodeUnifiedName(const string &unifiedName, string &alias, string &shortName, TServiceId &sid)
{
	size_t pos1 = 0, pos2 = 0;
	pos1 = unifiedName.find("/");
	if (pos1 != string::npos)
	{
		alias = unifiedName.substr(0, pos1);
		pos1++;
	}
	else
	{
		alias = "";
		pos1 = 0;
	}
	pos2 = unifiedName.find("-");
	if (pos2 != string::npos)
	{
		shortName = unifiedName.substr(pos1,pos2-pos1);
		sid.set(atoi(unifiedName.substr(pos2+1).c_str()));
	}
	else
	{
		shortName = unifiedName.substr(pos1);
		sid.set(0);
	}

	if (alias.empty())
	{
		alias = shortName;
	}
}
Пример #2
0
	void reset()
	{
		AliasName.clear();
		ShortName.clear();
		LongName.clear();
		ServiceId.set(0);
		Ready = false;
		Connected = false;
		Commands.clear();
		AutoReconnect = false;
		PId = 0;
		Relaunch = false;
		LastPing = 0;
		WaitingRequestId.clear();
	}