📄 push.c
字号:
}
pvTemp = SDL_GetNextListElement( pvPushList, pvListElement );
pvListElement = pvTemp;
} /* end outer loop */
}
SDL_DeleteList(&pvPushList);
return pPushListTemp;
} /* end of ME_Push_List_Sort */
/*========================================================================
ME_CompareWString
==========================================================================
Purpose: Compares two WCHAR strings
Params: pwch1, pwch2
Return: Boolean
=========================================================================*/
BOOL ME_CompareWString(WCHAR* pwch1, WCHAR* pwch2)
{
UINT32 istrlength;
if ( (pwch1!=NULL) && (pwch2!=NULL) )
{
istrlength = STRINGLENGTH(pwch1);
if (istrlength == (STRINGLENGTH(pwch2))) {
if (COMPARESTRINGN(pwch1, pwch2, istrlength) == 0)
return TRUE;
else
return FALSE;
}
}
return FALSE;
} /* end of ME_CompareWString */
/*========================================================================
ME_Push_Get_First_New( void* pvPushList )
==========================================================================
Purpose: Gets first new Push in Push list
Params: pvPushList
Return: pPushListStruct (NULL if not any new in list)
=========================================================================*/
void* ME_Push_Get_First_New( void* pvPushList )
{
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvListElement = NULL;
void* pvElementContent = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_Get_First_New");
#endif
if( pvPushList != NULL )
{
pvListElement = SDL_GetNextListElement( pvPushList, NULL );
while ( pvListElement != NULL )
{
pvElementContent = SDL_GetListElementContent( pvListElement );
if( pvElementContent != NULL )
{
pPushListStruct = (PUSHLISTSTRUCT*)pvElementContent;
if ( pPushListStruct->iStatus < PUSH_ACTIVE )
return (void*)pPushListStruct;
}
pvListElement = SDL_GetNextListElement( pvPushList, pvListElement );
}
}
return NULL;
} /* end of ME_Push_Get_First_New */
/*========================================================================
ME_Push_SI_Expired
==========================================================================
Purpose: Check if SI is expired or not. If pvPushListStruct is NULL, then
the entire list is scanned to see if any SI in list is expired.
Params: pvPushListStruct
Return: Boolean
=========================================================================*/
BOOL ME_Push_SI_Expired(void* pvPushList, void* pvPushListStruct)
{
UINT32 iTime=0;
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvListElement = NULL;
void* pvElementContent = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_SI_Expired");
#endif
pPushListStruct = (PUSHLISTSTRUCT*)pvPushListStruct;
if( pPushListStruct != NULL )
{
iTime = CLNTa_currentTime ();
if ((pPushListStruct->iExpires < iTime) &&
(pPushListStruct->iExpires != 0))
return TRUE;
}
else
{
if (pvPushList!=NULL)
{
pvListElement = SDL_GetNextListElement( pvPushList, NULL );
while ( pvListElement != NULL )
{
pvElementContent = SDL_GetListElementContent( pvListElement );
if( pvElementContent != NULL )
{
pPushListStruct = (PUSHLISTSTRUCT*)pvElementContent;
if ((pPushListStruct->iExpires < iTime) &&
(pPushListStruct->iExpires != 0))
return TRUE;
}
pvListElement = SDL_GetNextListElement( pvPushList, pvListElement );
}
}
}
return FALSE;
} /* end of ME_Push_SI_Expired */
/*========================================================================
ME_Push_Find_Id
==========================================================================
Purpose: Find push with PushId in Push List
Params: pvPushId, pvPushList
Return: pPushListStruct or NULL
=========================================================================*/
void* ME_Push_Find_Id(WCHAR* pwchId, void* pvPushList)
{
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvListElement = NULL;
void* pvElementContent = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_Find_Id");
#endif
if( pvPushList != NULL )
{
pvListElement = SDL_GetNextListElement( pvPushList, NULL );
while ( pvListElement != NULL )
{
pvElementContent = SDL_GetListElementContent( pvListElement );
if( pvElementContent != NULL )
{
pPushListStruct = (PUSHLISTSTRUCT*)pvElementContent;
if ( ME_CompareWString(pPushListStruct->pwchPushId, pwchId) )
return (void*)pPushListStruct;
}
pvListElement = SDL_GetNextListElement( pvPushList, pvListElement );
}
}
return NULL;
} /* end of ME_Push_Find_Id */
/*========================================================================
ME_Push_Find_OldId
==========================================================================
Purpose: Find old push with PushId in Push List
Params: pvPushId, pvPushList, iLLPushId
Return: pPushListStruct or NULL
=========================================================================*/
void* ME_Push_Find_OldId(WCHAR* pwchId, void* pvPushList, UINT32 iLLPushId)
{
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvListElement = NULL;
void* pvElementContent = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_Find_OldId");
#endif
if (pwchId == NULL)
return NULL;
else
{
if( pvPushList != NULL )
{
pvListElement = SDL_GetNextListElement( pvPushList, NULL );
while ( pvListElement != NULL )
{
pvElementContent = SDL_GetListElementContent( pvListElement );
if( pvElementContent != NULL )
{
pPushListStruct = (PUSHLISTSTRUCT*)pvElementContent;
if ( ME_CompareWString(pPushListStruct->pwchPushId, pwchId) )
{
if (pPushListStruct->iLLPushId != iLLPushId)
return (void*)pPushListStruct;
}
}
pvListElement = SDL_GetNextListElement( pvPushList, pvListElement );
}
}
return NULL;
}
} /* end of ME_Push_Find_OldId */
/*========================================================================
ME_Push_FindWithIdNumber
==========================================================================
Purpose: Find push with IdNumber in Push List
Params: pvPushList, iIdNumber
Return: pPushListStruct or NULL
=========================================================================*/
void* ME_Push_FindWithIdNumber(void* pvPushList, UINT16 iId)
{
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvListElement = NULL;
void* pvElementContent = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start ME_Push_FindWithIdNumber");
#endif
if( pvPushList != NULL )
{
pvListElement = SDL_GetNextListElement( pvPushList, NULL );
while ( pvListElement != NULL )
{
pvElementContent = SDL_GetListElementContent( pvListElement );
if( pvElementContent != NULL )
{
pPushListStruct = (PUSHLISTSTRUCT*)pvElementContent;
if ( pPushListStruct->iIdNumber == iId )
{
return (void*)pPushListStruct;
}
}
pvListElement = SDL_GetNextListElement( pvPushList, pvListElement );
}
}
return NULL;
} /* end of ME_Push_FindWithIdNumber */
/*========================================================================
ME_Push_Get_Oldest(void* pvPushList, INT8 iType)
==========================================================================
Purpose: Retrieve the oldest SI or SL message.
Params: pvPushList, The List
iType, What should be retrieved? SI, SL
Return: pPushListStruct or NULL
=========================================================================*/
void* ME_Push_Get_Oldest(void* pvPushList, INT8 iType)
{
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvListElement = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_Get_Removable");
#endif
if( pvPushList != NULL )
{
if (iType == -2 || iType == -1)
{
pvListElement = ME_Push_Get_First(pvPushList);
while (pvListElement !=NULL)
{
pPushListStruct = ME_Push_Get_PushListStruct(pvListElement);
if (pPushListStruct !=NULL && pPushListStruct->iLLPushId !=0)
{
if (iType == -1 && pPushListStruct->iPushType == SI)
return (void*) pPushListStruct;
else if(iType == -2 && pPushListStruct->iPushType == SL)
return (void*) pPushListStruct;
}
pvListElement = ME_Push_Get_Next( pvPushList, pvListElement );
}
}
}
return NULL;
} /* end of ME_Push_Get_Removeble */
/*========================================================================
ME_Push_Get_Last( void* pvPushList )
==========================================================================
Purpose: Retrieve last Push in Push list
Params: pvPushList
Return: pPushListStruct
=========================================================================*/
void* ME_Push_Get_Last( void* pvPushList )
{
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvListElement = NULL;
void* pvListElementLast = NULL;
void* pvElementContent = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_Get_Last");
#endif
if( pvPushList != NULL )
{
pvListElement = SDL_GetNextListElement( pvPushList, NULL );
while ( pvListElement != NULL )
{
pvListElementLast = pvListElement;
pvListElement = SDL_GetNextListElement( pvPushList, pvListElement );
}
pvElementContent = SDL_GetListElementContent( pvListElementLast );
if( pvElementContent != NULL )
{
pPushListStruct = (PUSHLISTSTRUCT*)pvElementContent;
return (void*)pPushListStruct;
}
}
return NULL;
} /* end of ME_Push_Get_Last */
/*========================================================================
ME_Push_Get_First( void* pvPushList )
==========================================================================
Purpose: Retrieve first Push in Push list
Params: pvPushList
Return: pvListElement
=========================================================================*/
void* ME_Push_Get_First( void* pvPushList )
{
void* pvListElement = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_Get_First");
#endif
if( pvPushList != NULL )
{
pvListElement = SDL_GetNextListElement( pvPushList, NULL );
return (void*) pvListElement;
}
return NULL;
} /* end of ME_Push_Get_First */
/*========================================================================
ME_Push_Get_Next( void* pvPushList, void* pvListElement )
==========================================================================
Purpose: Retrieve next Push in Push list
Params: pvPushList, pvListElement
Return: pvNextListElement
=========================================================================*/
void* ME_Push_Get_Next( void* pvPushList, void* pvListElement )
{
void* pvNextListElement = NULL;
#ifdef WAE_DEBUG
URL_DEBUG_PRINT("Start Push_Get_Next");
#endif
if( pvPushList != NULL && pvListElement !=NULL)
{
pvNextListElement = SDL_GetNextListElement( pvPushList, pvListElement );
return (void*) pvNextListElement;
}
return NULL;
} /* end of ME_Push_Get_Next */
/*========================================================================
ME_Push_Get_PushListStruct( void* pvListElement )
==========================================================================
Purpose: Retrieve last Push in Push list
Params: pvListElement
Return: pPushListStruct
=========================================================================*/
void* ME_Push_Get_PushListStruct( void* pvListElement )
{
PUSHLISTSTRUCT* pPushListStruct = NULL;
void* pvElementContent = NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -