int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain)
{
	for (int i=0; i<SIZEOF(TransportProtoTable); i++)
		if ( MatchMask(TransportDomain, TransportProtoTable[i].mask))
			return i;

	return -1;
}
static int GetTransportProtoID(char * TransportDomain)
{
	for ( int i=0; i<SIZEOF(TransportProtoTable); i++)
		if (MatchMask(TransportDomain,TransportProtoTable[i].mask)) 
			return i;

	return -1;
}
BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, HANDLE hContact)
{
	// check if transport is already set
	if (!jid || !hContact)
		return FALSE;

	// strip domain part from jid
	TCHAR *domain  = _tcschr((TCHAR*)jid, '@');
	BOOL   isAgent = (domain == NULL) ? TRUE : FALSE;
	BOOL   isTransported = FALSE;
	if (domain != NULL)
		domain = NEWTSTR_ALLOCA(domain+1);
	else
		domain = NEWTSTR_ALLOCA(jid);

	TCHAR *resourcepos = _tcschr(domain, '/');
	if (resourcepos != NULL)
		*resourcepos = '\0';

	for (int i=0; i < SIZEOF(TransportProtoTable); i++)
		if (MatchMask(domain, TransportProtoTable[i].mask)) {
			GetTransportStatusIconIndex(GetTransportProtoID(domain), ID_STATUS_OFFLINE);
			isTransported = TRUE;
			break;
		}

	if (m_lstTransports.getIndex(domain) == -1 && isAgent) {
		m_lstTransports.insert( mir_tstrdup(domain));
		setByte(hContact, "IsTransport", 1);
	}

	if (isTransported) {
		setTString(hContact, "Transport", domain);
		setByte(hContact, "IsTransported", 1);
	}
	return isTransported;
}