Exemplo n.º 1
0
/*
* Class:     com_alibaba_wireless_imservice_ChatSession
* Method:    nGetUnreadHandle
* Signature: (III)[I
*/
JNIEXPORT jintArray JNICALL Java_com_alibaba_wireless_imservice_ChatSession_nGetUnreadHandle
(JNIEnv *env, jclass cls, jint handle, jint iOffset, jint iLimit)
{
	IASession *pSes = (IASession*)handle;
	jintArray	iaryMsgHandles = AMNULL;

	AMHandle	*phMsgs = AMNULL;
	AMInt32		iCount	= 0;

	AIM_RESULT	eResult;

	if(0 == pSes)
		return AMNULL;

	if(eAIM_RESULT_OK != (eResult = AIMSession_GetMsgs(pSes, iOffset, iLimit, AMTRUE, &phMsgs, &iCount)))
	{
		DPRINT("nGetUnreadHandle..................Error %d!\n", eResult);
		return AMNULL;
	}

	if(0 == iCount)
		return AMNULL;

	if(AMNULL == (iaryMsgHandles = (*env)->NewIntArray(env, iCount)))
	{
		AIMSession_ReleaseMsgs(pSes, phMsgs, iCount, 0);
		return AMNULL;
	}

	(*env)->SetIntArrayRegion(env, iaryMsgHandles, 0, iCount, (const int *)phMsgs);

	AIMSession_ReleaseMsgs(pSes, phMsgs, iCount, 1);

	return iaryMsgHandles;
}
Exemplo n.º 2
0
/*
* Class:     com_alibaba_wireless_imservice_ChatSession
* Method:    nReleaseMsgs
* Signature: (I[I)V
*/
JNIEXPORT void JNICALL Java_com_alibaba_wireless_imservice_ChatSession_nReleaseMsgs
(JNIEnv *env, jclass cls, jint handle, jintArray msgHandles)
{
	IASession *pSes = (IASession*)handle;
	AMHandle	*phMsgs = AMNULL;
	AMInt32		iSize = 0;
	if(AMNULL == pSes && AMNULL != msgHandles)
		return;

	iSize = (*env)->GetArrayLength(env, msgHandles);

	if(!iSize)
		return;

	if( AMNULL == (phMsgs = (*env)->GetPrimitiveArrayCritical(env, msgHandles, 0)))
		return;

	AIMSession_ReleaseMsgs(pSes, phMsgs, iSize, 2);

	(*env)->ReleasePrimitiveArrayCritical(env, msgHandles, phMsgs, 0);
}
Exemplo n.º 3
0
AIM_RESULT IAIMSession_ReleaseUnreadMsgs(AMHandle hSession, AMHandle *phMsgArray, AMInt32 iArraySize)
{
	return AIMSession_ReleaseMsgs( hSession, phMsgArray, iArraySize, 0);
}
Exemplo n.º 4
0
AIM_RESULT IAIMSession_ReleaseMsgs( AMHandle hSession , AMHandle *phMsgArray, AMInt32 iCount)
{
	return AIMSession_ReleaseMsgs( hSession, phMsgArray, iCount, 0);
}