Ejemplo n.º 1
0
STATUSINFO * TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int* iCount)
{
	if (!ppStatusList || !pszStatus)
		return NULL;

	if ( !TM_FindStatus(*ppStatusList, pszStatus)) {
		STATUSINFO *node = (STATUSINFO*) mir_alloc(sizeof(STATUSINFO));
		ZeroMemory(node, sizeof(STATUSINFO));
		replaceStr( &node->pszGroup, pszStatus );
		node->hIcon = (HICON)(*iCount);
		while ((int)node->hIcon > STATUSICONCOUNT - 1)
			node->hIcon--;

		if (*ppStatusList == NULL) // list is empty
		{
			node->Status = 1;
			*ppStatusList = node;
			node->next = NULL;
		}
		else
		{
			node->Status = ppStatusList[0]->Status*2;
			node->next = *ppStatusList;
			*ppStatusList = node;
		}
		return node;

	}
	return FALSE;
}
Ejemplo n.º 2
0
HICON SM_GetStatusIcon(SESSION_INFO* si, USERINFO * ui)
{
	STATUSINFO * ti;
	if (!ui || !si)
		return NULL;

	ti = TM_FindStatus(si->pStatuses, TM_WordToString(si->pStatuses, ui->Status));
	if (ti)
	{
		if ((int)ti->hIcon < STATUSICONCOUNT)
		{
			int id = si->iStatusCount - (int)ti->hIcon - 1;
			if (id == 0)
				return hIcons[ICON_STATUS0];
			if (id == 1)
				return hIcons[ICON_STATUS1];
			if (id == 2)
				return hIcons[ICON_STATUS2];
			if (id == 3)
				return hIcons[ICON_STATUS3];
			if (id == 4)
				return hIcons[ICON_STATUS4];
			if (id == 5)
				return hIcons[ICON_STATUS5];
		}
		else
			return ti->hIcon;
	}
	return hIcons[ICON_STATUS0];
}
Ejemplo n.º 3
0
HICON SM_GetStatusIcon(SESSION_INFO * si, USERINFO * ui, char *szIndicator)
{
	STATUSINFO * ti;
	if(!ui || !si)
		return NULL;

    *szIndicator = 0;
    
    ti = TM_FindStatus(si->pStatuses, TM_WordToString(si->pStatuses, ui->Status));
	if (ti)
	{
        if((int)ti->hIcon < STATUSICONCOUNT)
		{
			int id = si->iStatusCount - (int)ti->hIcon - 1;

            if(id == 0) {
                *szIndicator = 0;
                return hIcons[ICON_STATUS0];
            }
            if(id == 1) {
                *szIndicator = '+';
                return hIcons[ICON_STATUS1];
            }
            if(id == 2) {
                *szIndicator = '%';
                return hIcons[ICON_STATUS2];
            }
            if(id == 3) {
                *szIndicator = '@';
                return hIcons[ICON_STATUS3];
            }
            if(id == 4) {
                *szIndicator = '!';
                return hIcons[ICON_STATUS4];
            }
            if(id == 5) {
                *szIndicator = '*';
                return hIcons[ICON_STATUS5];
            }
		}
		else
			return ti->hIcon;
	}
	return hIcons[ICON_STATUS0];
}