示例#1
0
/*----------------------------------------------------------------------------*
 *  NAME
 *      HandleAlertUpdate
 *
 *  DESCRIPTION
 *      This function indicates the type and number of alerts received 
 *      over the UART (ANS)
 *
 *  RETURNS
 *      Nothing.
 *----------------------------------------------------------------------------*/
extern void HandleAlertUpdate(alert_type alert)
{

    uint8 alert_cat = alert_cat_simple;
    uint8 num_alert = 0;


    /* The first byte is the category identifier */
    /* The second byte is the number of new alerts in this category */

    if(alert == alert_type_new)
    {
        alert_cat = g_app_ans_data.new_alert_value[0];
        num_alert = g_app_ans_data.new_alert_value[1];
    }
    else
    {
        /* Unread alert */
        alert_cat= g_app_ans_data.unread_alert_status_value[0];
        num_alert = g_app_ans_data.unread_alert_status_value[1];
    }


    DisplayType(alert);
    DisplayCategory(alert_cat);
    writeNumAlerts(num_alert);
    writeString("\n");
}
示例#2
0
bool TopMenu::DisplayMenu(int client, unsigned int hold_time, TopMenuPosition position)
{
	if (m_clients == NULL)
	{
		return false;
	}

	IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
	if (!pPlayer->IsInGame())
	{
		return false;
	}

	UpdateClientRoot(client, pPlayer);

	/* This is unfortunate but it's the best solution. */
	for (size_t i = 0; i < m_Categories.size(); i++)
	{
		UpdateClientCategory(client, i, true);
	}

	topmenu_player_t *pClient = &m_clients[client];
	if (pClient->root == NULL)
	{
		return false;
	}

	if (!m_bCacheTitles)
	{
		char renderbuf[128];
		m_pTitle->OnTopMenuDisplayTitle(this, client, 0, renderbuf, sizeof(renderbuf));
		pClient->root->SetDefaultTitle(renderbuf);
	}

	bool return_value = false;

	if (position == TopMenuPosition_LastCategory && 
		pClient->last_category < m_Categories.size())
	{
		return_value = DisplayCategory(client, pClient->last_category, hold_time, true);
		if (!return_value)
		{
			return_value = pClient->root->DisplayAtItem(client, hold_time, pClient->last_root_pos);
		}
	}
	else if (position == TopMenuPosition_LastRoot)
	{
		pClient->root->DisplayAtItem(client, hold_time, pClient->last_root_pos);
	}
	else if (position == TopMenuPosition_Start)
	{
		pClient->last_position = 0;
		pClient->last_category = 0;
		return_value = pClient->root->Display(client, hold_time);
	}

	return return_value;
}
示例#3
0
bool TopMenu::DisplayMenuAtCategory(int client, unsigned int object_id)
{
	if (m_clients == NULL)
	{
		return false;
	}

	IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
	if (!pPlayer->IsInGame())
	{
		return false;
	}

	// Get the category this object is in.
	size_t category_id;
	if (!FindCategoryByObject(object_id, &category_id))
	{
		return false;
	}

	topmenu_category_t *category = m_Categories[category_id];

	UpdateClientRoot(client, pPlayer);

	topmenu_player_t *pClient = &m_clients[client];
	if (pClient->root == NULL)
	{
		return false;
	}

	if (!m_bCacheTitles)
	{
		char renderbuf[128];
		m_pTitle->OnTopMenuDisplayTitle(this, client, 0, renderbuf, sizeof(renderbuf));
		pClient->root->SetDefaultTitle(renderbuf);
	}

	bool return_value = false;

	return_value = DisplayCategory(client, category_id, 0, true);
	if (!return_value)
	{
		return_value = pClient->root->DisplayAtItem(client, 0, pClient->last_root_pos);
	}

	return return_value;
}
示例#4
0
void TopMenu::OnMenuSelect2(IBaseMenu *menu, int client, unsigned int item, unsigned int item_on_page)
{
	const char *item_name = menu->GetItemInfo(item, NULL);
	if (!item_name)
	{
		return;
	}

	topmenu_object_t *obj;
	topmenu_player_t *pClient = &m_clients[client];
	if (!m_ObjLookup.retrieve(item_name, &obj))
		return;

	/* We now have the object... what do we do with it? */
	if (obj->type == TopMenuObject_Category)
	{
		/* If it's a category, the user wants to view it.. */
		assert(obj->cat_id < m_Categories.size());
		assert(m_Categories[obj->cat_id]->obj == obj);
		pClient->last_root_pos = item_on_page;
		if (!DisplayCategory(client, obj->cat_id, MENU_TIME_FOREVER, false))
		{
			/* If we can't display the category, re-display the root menu.
			 * This code should be dead as of bug 3256, which disables categories 
			 * that cannot be displayed.
			 */
			DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot);
		}
	}
	else
	{
		pClient->last_position = item_on_page;
		
		/* Re-check access in case this user had their credentials revoked */
		if (obj->cmdname[0] != '\0' && !adminsys->CheckAccess(client, obj->cmdname, obj->flags, false))
		{
			DisplayMenu(client, 0, TopMenuPosition_LastCategory);
			return;
		}
		
		/* Pass the information on to the callback */
		obj->callbacks->OnTopMenuSelectOption(this, client, obj->object_id);
	}
}
示例#5
0
/*----------------------------------------------------------------------------*
 *  NAME
 *      DisplaySupportedCategories
 *
 *  DESCRIPTION
 *      This function displays the supported categories of ANS
 *
 *  RETURNS
 *      Nothing.
 *----------------------------------------------------------------------------*/
extern void DisplaySupportedCategories(alert_type alert)
{

    uint8 alert_cat[2];

    writeString("Supported");
    if(alert == alert_type_new)
    {
        MemCopy(alert_cat,&g_app_ans_data.supported_new_alert_cat_value[0], 2);
    }
    else if(alert == alert_type_unread)
    {
        MemCopy(alert_cat,
                &g_app_ans_data.supported_unread_alert_cat_value[0], 2);
    }
    /* Display the alert type */
    DisplayType(alert);

    /* Display the categories which remote host supports */
    if(alert_cat[0] & alert_cat_bitmask_simple)
    {
        DisplayCategory(alert_cat_simple);
    }

    if(alert_cat[0] & alert_cat_bitmask_email)
    {
        DisplayCategory(alert_cat_email);
    }

    if(alert_cat[0] & alert_cat_bitmask_news)
    {
        DisplayCategory(alert_cat_news);
    }

    if(alert_cat[0] & alert_cat_bitmask_call)
    {
        DisplayCategory(alert_cat_call);
    }

    if(alert_cat[0] & alert_cat_bitmask_missed_call)
    {
        DisplayCategory(alert_cat_missed_call);
    }

    if(alert_cat[0] & alert_cat_bitmask_message)
    {
        DisplayCategory(alert_cat_message);
    }

    if(alert_cat[0] & alert_cat_bitmask_vmail)
    {
        DisplayCategory(alert_cat_vmail);
    }

    if(alert_cat[0] & alert_cat_bitmask_schedule)
    {
        DisplayCategory(alert_cat_schedule);
    }

    if(alert_cat[1] & alert_cat_bitmask_priority)
    {
        DisplayCategory(alert_cat_priority);
    }

    if(alert_cat[1] & alert_cat_bitmask_instant_msg)
    {
        DisplayCategory(alert_cat_instant_msg);
    }

    writeString("\n");
}