Ejemplo n.º 1
0
//	Append the 'chat state' to the cursor
void
WChatLog::ChatLog_ChatStateTextAppend(INOUT OCursor & oTextCursor)
	{
	TContact ** ppContactStop;
	TContact ** ppContact = m_arraypContactsComposing.PrgpGetContactsStop(OUT &ppContactStop);
	if (ppContact == ppContactStop)
		{
		oTextCursor.removeSelectedText();
		}
	else
		{
		if (g_poImageComposing == NULL)
			g_poImageComposing = new QImage(":/ico/Pencil");
		while (TRUE)
			{
			oTextCursor.insertImage(*g_poImageComposing);
			TContact * pContact = *ppContact++;
			Assert(pContact != NULL);
			Assert(pContact->EGetRuntimeClass() == RTI(TContact));
			g_strScratchBufferStatusBar.Format(d_szu_nbsp " <b>^s</b> is typing...", pContact->ChatLog_PszGetNickname());
			oTextCursor.insertHtml(g_strScratchBufferStatusBar);
			if (ppContact == ppContactStop)
				break;
			} // while
		}
	if (m_pContactOrGroup->EGetRuntimeClass() == RTI(TContact))
		((TContact *)m_pContactOrGroup)->ChatLogContact_AppendExtraTextToChatState(INOUT oTextCursor);
	Widget_ScrollToEnd(INOUT this);
	} // ChatLog_ChatStateTextAppend()
Ejemplo n.º 2
0
void
CArrayPtrContacts::RemoveAllContactsComposingWhoAreIdle()
	{
	if (m_paArrayHdr == NULL)
		return;
	TContact ** ppContactStop;
	TContact ** ppContactStart = PrgpGetContactsStop(OUT &ppContactStop);
	TContact ** ppContactDst = ppContactStart;
	TContact ** ppContactSrc = ppContactStart;
	while (ppContactSrc != ppContactStop)
		{
		TContact * pContact = *ppContactSrc++;
		Assert(pContact->EGetRuntimeClass() == RTI(TContact));
		MessageLog_AppendTextFormatSev(eSeverityNoise, "\t[$@] $S ($s) is still typing for $i minutes...\n", &pContact->m_strJidBare, pContact->ChatLog_PszGetNickname(), g_tsmMinutesSinceApplicationStarted - pContact->m_tsmLastStanzaReceived);
		if (g_tsmMinutesSinceApplicationStarted - pContact->m_tsmLastStanzaReceived >= 4)
			pContact->ChatLogContact_ChatStateIconUpdateComposingStopped();	// If the user has not typed anything during the past 4 minutes, then assume he stopped typing.
		else
			*ppContactDst++ = pContact;
		}
	m_paArrayHdr->cElements = ppContactDst - ppContactStart;
	} // RemoveAllContactsComposingWhoAreIdle()