void
FileShowInExplorer(const CStr & strPathFile, BOOL fOpenFile)
	{
	CString sPathFile = strPathFile;
	if (!fOpenFile)
		{
		// We do not want to open the file, but just show it in Explorer (or in the GUI of the OS)
		#if defined(Q_OS_WIN)
			if (QFile::exists(sPathFile))
				{
				QStringList args;
				args << "/select," << QDir::toNativeSeparators(sPathFile);
				QProcess::startDetached("explorer", args);
				return;
				}
			MessageLog_AppendTextFormatSev(eSeverityWarning, "The file \"$Q\" does not exist, therefore showing only its folder\n", &sPathFile);
			goto StripFileName;
		#elif defined(Q_OS_MAC)
			QStringList args;
			args << "-e";
			args << "tell application \"Finder\"";
			args << "-e";
			args << "activate";
			args << "-e";
			args << "select POSIX file \"" + sPathFile + "\"";
			args << "-e";
			args << "end tell";
			QProcess::startDetached("osascript", args);
			return;
		#else
			// Since we do not know how to display a file in this platform, strip the filename and open its containing folder
			goto StripFileName;
		#endif
		}
	else if (!QFile::exists(sPathFile))
		{
		StripFileName:
		sPathFile.File_StripFileName();
		}
	MessageLog_AppendTextFormatSev(eSeverityNoise, "FileShowInExplorer(\"$Q\")\n", &sPathFile);
	#if defined(Q_OS_WIN)
	Assert(sizeof(ushort) == sizeof(wchar_t));
	SHELLEXECUTEINFOW seiW;
	InitToZeroes(OUT &seiW, sizeof(seiW));
	seiW.cbSize = sizeof(seiW);
	seiW.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI;
	seiW.nShow = SW_SHOWNORMAL;
	seiW.lpFile = (LPCWSTR)sPathFile.utf16();
	::ShellExecuteExW(INOUT &seiW);
	#else
	QDesktopServices::openUrl(QUrl::fromUserInput(sPathFile));
	#endif
	} // FileShowInExplorer()
Example #2
0
void
TAccountXmpp::Contacts_RosterDisplayDebug(PSZAC pszName)
	{
	MessageLog_AppendTextFormatSev(eSeverityNoise, "Roster subscription for account $S: $s\n", &m_strJID, pszName);
	TContact * pContact;
	TContact ** ppContactStop;
	TContact ** ppContact = m_arraypaContacts.PrgpGetContactsStop(OUT &ppContactStop);
	while (ppContact != ppContactStop)
		{
		pContact = *ppContact++;
		PSZUC pszSubscription = pContact->XmppRoster_PszGetSubscription();
		if (pszSubscription != NULL)
			MessageLog_AppendTextFormatSev(eSeverityNoise, "\t $S: $s\n", &pContact->m_strJidBare, pszSubscription);
		}
	}
Example #3
0
void
TContact::XmppPresenceUpdateIcon(const CXmlNode * pXmlNodeStanzaPresence)
	{
	if (FCompareStrings(pXmlNodeStanzaPresence->PszFindAttributeValueType_NZ(), "unavailable"))
		{
		TreeItemContact_UpdateIconOffline();
		return;
		}
	UINT uFlagsPresence = FC_kePresenceChat;	// If there is no presence value, assume online
	PSZUC pszPresence = pXmlNodeStanzaPresence->PszuFindElementValue_ZZ("show");
	if (pszPresence != NULL && !FCompareStrings(pszPresence, "chat"))
		{
		if (FCompareStrings(pszPresence, "away"))
			uFlagsPresence = FC_kePresenceAway;
		else if (FCompareStrings(pszPresence, "xa"))
			uFlagsPresence = FC_kePresenceAwayExtended;
		else if (FCompareStrings(pszPresence, "dnd"))
			uFlagsPresence = FC_kePresenceBusy;	// Do Not Disturb
		else
			MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "Unrecognized presence value '$s'\n", pszPresence);
		}
	XmppRosterSubscribed();
	if (m_uFlagsContact & FC_kfContactNeedsInvitation)
		{
		MessageLog_AppendTextFormatSev(eSeverityComment, "XmppPresenceUpdateIcon($S) - Invitation no longer needed because of presence $s\n", &m_strJidBare, pszPresence);
		ChatLogContact_RemoveInvitationMessage();
		Assert((m_uFlagsContact & FC_kfContactNeedsInvitation) == 0);
		NoticeListAuxiliary_DeleteAllNoticesRelatedToTreeItem(this);
		}
	//m_uFlagsContact = (m_uFlagsContact & ~(FC_kmPresenceMask | FC_kfNoCambrianProtocol)) | uFlagsPresence;
	m_uFlagsContact = (m_uFlagsContact & ~(FC_kmPresenceMaskOnlineXosp)) | uFlagsPresence;
	// Check if the contact uses Cambrian
	const CXmlNode * pXmlNodeXCP = pXmlNodeStanzaPresence->PFindElement(c_sza_xcp);
	if (pXmlNodeXCP != NULL)
		{
		// The contact is supporting XOSP
		m_uFlagsContact = (m_uFlagsContact & ~FC_kfNativeXmppOnly) | FC_kfPresenceXosp;	// Remember the XOSP is present, and remove the XMPP only flag
		if (m_uFlagsContact & FC_kfXospSynchronizeWhenPresenceOnline)
			{
			MessageLog_AppendTextFormatSev(eSeverityComment, "XmppPresenceUpdateIcon($S) - FC_kfXospSynchronizeWhenPresenceOnline\n", &m_strJidBare);
			XcpApi_Invoke_Synchronize();
			}
		if (m_uFlagsContact & FC_kfContactRecommendationsNeverReceived)
			XcpApi_Invoke_RecommendationsGet();
		//m_listaTasksSendReceive.SentTasksToContact(this);	// Send any pending task
		}
	TreeItemContact_UpdateIcon();
	} // XmppPresenceUpdateIcon()
Example #4
0
void
TAccountXmpp::Contacts_RosterUpdate(const CXmlNode * pXmlNodeQuery)
	{
	Assert(pXmlNodeQuery != NULL);
	Assert(pXmlNodeQuery->FCompareTagName("query"));
	MessageLog_AppendTextFormatSev(eSeverityNoise, "TAccountXmpp::Contacts_RosterUpdate()\n");
	// Loop through every <item> under the <query> element
	const CXmlNode * pXmlNodeItemRoster = pXmlNodeQuery->m_pElementsList;
	while (pXmlNodeItemRoster != NULL)
		{
		Contact_RosterUpdateItem(pXmlNodeItemRoster);
		pXmlNodeItemRoster = pXmlNodeItemRoster->m_pNextSibling;
		}
	// Make sure every contact is subscribed
	TContact * pContact;
	TContact ** ppContactStop;
	TContact ** ppContact = m_arraypaContacts.PrgpGetContactsStop(OUT &ppContactStop);
	while (ppContact != ppContactStop)
		{
		pContact = *ppContact++;
		if (pContact->XmppRoster_PszGetSubscription() == NULL)
			Contact_RosterSubscribe(pContact);
			//pContact->XmppRosterSubscribed();
		}
	} // Contacts_RosterUpdate()
Example #5
0
PSZUC
TAccountXmpp::Contact_RosterUpdateItem(const CXmlNode * pXmlNodeItemRoster)
	{
	Assert(pXmlNodeItemRoster != NULL);
	Assert(pXmlNodeItemRoster->FCompareTagName("item"));
	PSZUC pszJid = pXmlNodeItemRoster->PszFindAttributeValueJid_NZ();
	PSZUC pszSubscription = pXmlNodeItemRoster->PszuFindAttributeValue_NZ("subscription");	/* // The attribute "subscription" is not present for a "<iq type='set'>" */
	if (!FCompareStrings(pszSubscription, "remove"))
		{
		#ifdef DEBUG_DELETE_TEMP_ACCOUNTS
		if (PszrCompareStringBeginNoCase(pszJid, "temp") != NULL)
			{
			MessageLog_AppendTextFormatSev(eSeverityErrorAssert, "#$I Removing contact $s from roster...\n", ++g_cContactsRemoved, pszJid);
			if (m_paSocket != NULL)
				m_paSocket->Socket_WriteXmlFormatted("<iq type='set'><query xmlns='jabber:iq:roster'><item jid='^s' subscription='remove'></item></query></iq>", pszJid);
			return NULL;
			}
		#endif
		TContact * pContact = Contact_PFindByJID(pszJid, eFindContact_kfCreateNew);
		Endorse(pContact == NULL);	// The attribute "jid" may not be valid (for example, missing the '@' character)
		if (pContact != NULL)
			pContact->XmppRosterSubscriptionUpdate(pszSubscription);
		}
	return pszJid;
	}
void
OJapiAppBallotmaster::OnEventBallotReceived(CEventBallotReceived * pEventBallotReceived)
	{
	Assert(pEventBallotReceived != NULL);
	MessageLog_AppendTextFormatSev(eSeverityInfoTextBlack, "emit onBallotReceived($t)\n", pEventBallotReceived->m_tsEventID);
	emit onBallotReceived(PGetOJapiBallot(pEventBallotReceived));
	}
Example #7
0
void
WChatLog::SL_HyperlinkMouseHovering(const QUrl & url)
	{
	CStr strTip;
	QString sUrl = url.toString();
	CStr strUrl = sUrl;		// Convert the URL to UTF-8
	PSZUC pszUrl = strUrl;
	if (FIsSchemeCambrian(pszUrl))
		{
		const CHS chCambrianAction = ChGetCambrianActionFromUrl(pszUrl);
		if (chCambrianAction == d_chCambrianAction_None)
			{
			TIMESTAMP tsEventID;
			PSZUC pszAction = Timestamp_PchDecodeFromBase64Url(OUT &tsEventID, pszUrl + 2);
			Assert(pszAction[0] == d_chSchemeCambrianActionSeparator);
			IEvent * pEvent = m_pContactOrGroup->Vault_PFindEventByID(tsEventID);
			if (pEvent != NULL)
				pEvent->HyperlinkGetTooltipText(pszAction + 1, IOUT &strTip);
			else
				MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "WChatLog::SL_HyperlinkMouseHovering() - Unable to find matching tsEventID $t from hyperlink $s\n", tsEventID, pszUrl);
			} // if
		sUrl = strTip.ToQString();
		}
	QToolTip::showText(QCursor::pos(), sUrl, this);
	} // SL_HyperlinkMouseHovering()
//	CServiceBallotmaster::IXmlExchange::XmlExchange()
void
CServiceBallotmaster::XmlExchange(INOUT CXmlExchanger * pXmlExchanger)
	{
	IService::XmlExchange(pXmlExchanger);
	m_oVaultBallots.XmlExchange("Ballots", INOUT pXmlExchanger);
	if (pXmlExchanger->m_fSerializing)
		return;
	// Initialize the timers for polls to automatically stop
	TIMESTAMP tsNow = Timestamp_GetCurrentDateTime();
	IEvent ** ppEventStop;
	IEvent ** ppEvent = m_oVaultBallots.m_arraypaEvents.PrgpGetEventsStop(OUT &ppEventStop);
	while (ppEvent != ppEventStop)
		{
		CEventBallotPoll * pEventBallotPoll = (CEventBallotPoll *)*ppEvent++;
		Assert(pEventBallotPoll->EGetEventClass() == CEventBallotPoll::c_eEventClass);
		if (pEventBallotPoll->m_tsStarted != d_ts_zNA && pEventBallotPoll->m_tsStopped == d_ts_zNA && pEventBallotPoll->m_cSecondsPollLength > 0)
			{
			TIMESTAMP tsStop = pEventBallotPoll->m_tsStarted + pEventBallotPoll->m_cSecondsPollLength * (TIMESTAMP_DELTA)d_ts_cSeconds;
			TIMESTAMP_DELTA dtsStopping = tsStop - tsNow;	// If this value is negative, it means the poll 'stopped' while SocietyPro was not running.
			if (dtsStopping < 10 * d_ts_cMinutes)
				dtsStopping = 10 * d_ts_cMinutes;	// Make the poll has a minimum of 10 minutes to run so it may collect all pending votes before closing
			MessageLog_AppendTextFormatSev(eSeverityNoise, "Poll ID $t which started on {tL} lasting $I seconds will automatically stop at {tL} in $I seconds ($T).\n", pEventBallotPoll->m_tsEventID, pEventBallotPoll->m_tsStarted, pEventBallotPoll->m_cSecondsPollLength, tsStop, (int)(dtsStopping / d_ts_cSeconds), dtsStopping);
			TimerQueue_CallbackAdd(dtsStopping / d_ts_cSeconds, TimerQueueCallback_PollStop, pEventBallotPoll);
			}
		} // while
	TimerQueue_DisplayToMessageLog();
	} // XmlExchange()
Example #9
0
void
TContact::XmppRosterSubscriptionUpdate(PSZUC pszSubscription)
	{
	Assert(pszSubscription != NULL);
	MessageLog_AppendTextFormatSev(eSeverityNoise, "TContact::XmppRosterSubscriptionUpdate($S) to '$s'\n", &m_strJidBare, pszSubscription);
	const UINT uFlagsOld = m_uFlagsContact;
	m_uFlagsContact = (m_uFlagsContact & ~FC_kmRosterSubscriptionBoth) | FC_kfRosterItem;
	if (FCompareStrings(pszSubscription, "both"))
		{
		m_uFlagsContact |= FC_kmRosterSubscriptionBoth;
		}
	else
		{
		if (FCompareStringsBeginsWith(pszSubscription, "from"))
			m_uFlagsContact |= FC_kfRosterSubscriptionFrom;
		else if (FCompareStringsBeginsWith(pszSubscription, "to"))
			m_uFlagsContact |= FC_kfRosterSubscriptionTo;
		else
			{
			Assert(FCompareStrings(pszSubscription, "none"));
			if ((m_uFlagsContact & FC_kfSubscribeAsk) == 0)
				{
				m_uFlagsContact |= FC_kfSubscribeAsk;
				m_pAccount->PGetSocket_YZ()->Socket_WriteXmlFormatted("<iq id='$p' type='set'><query xmlns='jabber:iq:roster'><item jid='^j' subscription='from' ask='subscribe'></item></query></iq>", this, this);
				}
			}
		if ((m_uFlagsContact & FC_kfSubscribe) == 0)
			{
			m_uFlagsContact |= FC_kfSubscribe;
			m_pAccount->PGetSocket_YZ()->Socket_WriteXmlFormatted("<presence to='^j' type='subscribe'/>", this);
			}
		}
	if (m_uFlagsContact != uFlagsOld)
		{
		MessageLog_AppendTextFormatSev(eSeverityNoise, "\t m_uFlagsContact changed from 0x$x to 0x$x\n", uFlagsOld, m_uFlagsContact);
		TreeItemContact_UpdateIcon();
		}

	#ifdef DEBUG
	PSZUC pszSubscriptionReturned = XmppRoster_PszGetSubscription();
	if (!FCompareStrings(pszSubscriptionReturned, pszSubscription))
		MessageLog_AppendTextFormatSev(eSeverityErrorAssert, "XmppRosterSubscriptionUpdate($S) - XmppRoster_PszGetSubscription() returned '$s' however expecting '$s'\n", &m_strJidBare, pszSubscriptionReturned, pszSubscription);
	#endif
	} // XmppRosterSubscriptionUpdate()
Example #10
0
void
TAccountXmpp::ChatLog_DisplayStanza(const CXmlNode * pXmlNodeMessageStanza)
	{
	Assert(pXmlNodeMessageStanza != NULL);
	TContact * pContact = Contact_PFindByJID(IN pXmlNodeMessageStanza->PszFindAttributeValueFrom_NZ(), eFindContact_kmCreateAsUnsolicited);	// Find the contact matching the the stanza
	if (pContact != NULL)
		pContact->ChatLogContact_DisplayStanzaToUI(pXmlNodeMessageStanza);
	else
		MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "Unable to deliver message from unknown peer:\n^N", pXmlNodeMessageStanza);	// This happens when the stanza is incomplete and the JID is not adequate to create a contact
	}
Example #11
0
BOOL
WLayoutChatLog::FGotFocus()
	{
	if (hasFocus())
		{
		MessageLog_AppendTextFormatSev(eSeverityNoise, "WLayoutChatLog has the focus\n");
		return TRUE;
		}
	return m_pwChatInput->hasFocus() || m_pwChatLog_NZ->hasFocus();
	}
Example #12
0
void
WGrid::resizeEvent(QResizeEvent *)
	{
	MessageLog_AppendTextFormatSev(eSeverityNoise, "WGrid::resizeEvent()\n");
	m_cxWidthColumns = 0;	// Force the width of the columns to be recalculated (in case there is a stretchable column)
	m_cxDisplay = width();
	m_cyDisplay = height();
	int cxRows = m_arraypRowsDisplay.GetSize() * m_cyHeightRow;
	if (cxRows > m_cyDisplay)
		{
		setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
		verticalScrollBar()->setMaximum(cxRows);
		}
	}
//	This method return a pointer to a group or a contact.
//	The name of the method uses the word 'group' because most polls are sent to groups.
ITreeItemChatLogEvents *
CEventBallotPoll::PGetGroupTarget_YZ()
	{
	PSZUC pszGroupIdentifier = m_strTargetIdentifier;
	Assert(pszGroupIdentifier != NULL);
	TAccountXmpp * pAccount = PGetAccount();
	ITreeItemChatLogEvents * pContactOrGroup = pAccount->Contact_PFindByJID(pszGroupIdentifier, eFindContact_zDefault);
	if (pContactOrGroup == NULL)
		pContactOrGroup = pAccount->Group_PFindByIdentifier_YZ(pszGroupIdentifier);
	if (pContactOrGroup != NULL)
		return pContactOrGroup;
	if (*pszGroupIdentifier != '\0')
		MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "CEventBallotPoll::PGetGroupTarget_YZ() - Invalid pollTargetId '$s'\n", pszGroupIdentifier);
	return NULL;
	}
//	submit(), slot
//	Submit a vote back to the sender of the poll.
//	This method should be called only for received ballots to send the vote back to the poll sender.
bool
OJapiBallot::submit(const QString & sComment)
	{
	if (m_pEventBallot->EGetEventClass() == CEventBallotReceived::c_eEventClass)
		{
		CEventBallotReceived * pEventBallotReceived = (CEventBallotReceived *)m_pEventBallot;
		// Calculate the bitmask from the selected choices
		UINT_BALLOT_CHOICES ukmChoices = 0;
		UINT iChoice = 0;
		_CEventBallotChoice ** ppChoiceStop;
		_CEventBallotChoice ** ppChoice = pEventBallotReceived->PrgpGetChoicesStop(OUT &ppChoiceStop);
		while (ppChoice != ppChoiceStop)
			{
			_CEventBallotChoice * pChoice = *ppChoice++;
			Assert(_CEventBallotChoice::F_kfIsSelected == 1);
			ukmChoices |= (pChoice->m_uFlags & _CEventBallotChoice::F_kfIsSelected) << iChoice++;
			}
		MessageLog_AppendTextFormatSev(eSeverityNoise, "OJapiBallot::submit() - Event ID $t: $x $Q\n", m_pEventBallot->m_tsEventID, ukmChoices, &sComment);
		pEventBallotReceived->SubmitVoteViaXospF(ukmChoices, sComment);
		return true;
		}
	MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "OJapiBallot::submit() - Event ID $t is not allowed to vote\n", m_pEventBallot->m_tsEventID);
	return false;
	}
CEventBallotPoll *
OJapiAppBallotmaster::PFindPollByTimeStarted(TIMESTAMP tsStarted) const
	{
	IEvent ** ppEventStop;
	IEvent ** ppEvent = m_pServiceBallotmaster->m_oVaultBallots.m_arraypaEvents.PrgpGetEventsStop(OUT &ppEventStop);
	while (ppEvent != ppEventStop)
		{
		CEventBallotPoll * pEvent = (CEventBallotPoll *)*--ppEventStop;
		Assert(pEvent->EGetEventClass() == CEventBallotPoll::c_eEventClass);
		if (pEvent->m_tsStarted == tsStarted)
			return pEvent;
		}
	MessageLog_AppendTextFormatSev(eSeverityWarningToErrorLog, "OJapiAppBallotmaster::PFindPollByTimeStarted() - Unable to find poll matching tsStarted $t\n", tsStarted);
	return NULL;
	}
void
OJapiAppBallotmaster::OnEventVoteReceived(const CEventBallotSent * pEventBallotSent)
	{
	Assert(pEventBallotSent != NULL);
	if (pEventBallotSent->PGetProfile() == m_pServiceBallotmaster->m_pProfileParent)
		{
		// Find the event matching the Event ID
		CEventBallotPoll * pPoll = PFindPollByTimeStarted(pEventBallotSent->m_tsEventID);
		if (pPoll != NULL)
			{
			MessageLog_AppendTextFormatSev(eSeverityInfoTextBlack, "emit onVoteReceived($t)\n", pPoll->m_tsEventID);
			emit onVoteReceived(PGetOJapiPoll(pPoll));
			}
		}
	}
IService *
IService::S_PaAllocateService_YZ(TProfile * pProfileParent, RTI_ENUM rtiService)
	{
	Assert(pProfileParent != NULL);
	Assert(pProfileParent->EGetRuntimeClass() == RTI(TProfile));
	switch (rtiService)
		{
	case RTI_SZ(CServiceBallotmaster):
		return new CServiceBallotmaster(pProfileParent);
	#ifdef DEBUG
	default:
		MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "Unknown service '$U'\n", rtiService);
	#endif
		}
	return NULL;
	}
Example #18
0
void
TContact::TreeItemContact_DisplayWithinNavigationTree()
	{
	Assert(m_pAccount->EGetRuntimeClass() == RTI(TAccountXmpp));
	#if 0
	if (m_uFlagsTreeItem != 0)
		MessageLog_AppendTextFormatSev(eSeverityWarningToErrorLog, "0x$p: TreeItemContact_DisplayWithinNavigationTree($S) - m_uFlagsTreeItem = 0x$x\n", this, &m_strNameDisplayTyped, m_uFlagsTreeItem);
	#endif
	if (m_uFlagsTreeItem & FTI_kfObjectInvisible)
		return;	// Don't display hidden contacts
	TreeItemW_DisplayWithinNavigationTree(m_pAccount);
	TreeItemChatLog_UpdateTextAndIcon();

	if (!m_binXmlRecommendations.FIsEmptyBinary())
		Contact_RecommendationsDisplayWithinNavigationTree();
	}
PSZAC
EnumerationMap_PszFindValueFromEnum(const SEnumerationMap prgzEnumerationMap[], ENUM eEnumeration)
	{
	Assert(prgzEnumerationMap != NULL);
	if (prgzEnumerationMap != NULL)
		{
		while (prgzEnumerationMap->pszValue != NULL)
			{
			Assert(prgzEnumerationMap->eEnumeration >= 0);
			if (prgzEnumerationMap->eEnumeration == eEnumeration)
				return prgzEnumerationMap->pszValue;
			prgzEnumerationMap++;
			}
		}
	MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "Enum value $i could not be found in enumeration map '$s'\n", eEnumeration, EnumerationMap_PszFindName(prgzEnumerationMap));
	return NULL;
	}
CEventBallotPoll *
CServiceBallotmaster::PAllocateBallot(const IEventBallot * pEventBallotTemplate)
	{
	CEventBallotPoll * paEventBallot = new CEventBallotPoll;
	paEventBallot->m_pVaultParent_NZ = &m_oVaultBallots;
	if (pEventBallotTemplate != NULL)
		{
		MessageLog_AppendTextFormatSev(eSeverityNoise, "CServiceBallotmaster::PAllocateBallot() - Template $t\n", pEventBallotTemplate->m_tsEventID);
		Assert(pEventBallotTemplate->m_pVaultParent_NZ != NULL);
		CBinXcpStanzaEventCopier binXcpStanzaCopier(m_oVaultBallots.m_pParent);
		binXcpStanzaCopier.EventCopy(IN pEventBallotTemplate, OUT paEventBallot);
		paEventBallot->m_tsStarted = paEventBallot->m_tsStopped = d_zNA;
		paEventBallot->m_uFlagsEvent |= IEvent::FE_kfEventDeleted;
		}
	m_oVaultBallots.m_arraypaEvents.Add(PA_CHILD paEventBallot);
//	Assert(paEventBallot->m_uFlagsEvent & IEvent::FE_kfEventDeleted);
	return paEventBallot;
	}
OJapiAppBallotmaster::~OJapiAppBallotmaster()
	{
	MessageLog_AppendTextFormatSev(eSeverityWarningToErrorLog, "OJapiAppBallotmaster::~OJapiAppBallotmaster() 0x$p\n", this);	// For debugging, display in the Error Log when the object is destroyed (to make sure we have not missed it)
	// Remove the Ballotmaster from the list
	OJapiAppBallotmaster ** ppBallotmasterRemove = &s_plistBallotmasters;
	OJapiAppBallotmaster * pBallotmaster = s_plistBallotmasters;
	while (TRUE)
		{
		if (pBallotmaster == this)
			{
			*ppBallotmasterRemove = m_pNext;
			break;
			}
		ppBallotmasterRemove = &pBallotmaster->m_pNext;
		pBallotmaster = pBallotmaster->m_pNext;
		Assert(pBallotmaster != NULL && "The OJapiAppBallotmaster should be in the list");
		}
	}
Example #22
0
BOOL
CErrorMessage::FDisplayToMessageLog()
	{
	if (m_err == errSuccess || EError_FuIsSilentError(m_err))
		return FALSE;
	(void)PszuGetErrorDescriptionReFormatted();
	MessageLog_AppendTextFormatSev(m_eSeverity, "$S\n\t$S\n", &m_strErrorDescription, &m_strErrorDetails);
	if (m_eSeverity >= eSeverityWarningToErrorLog)
		{
		#ifdef DEBUG
		MessageLog_Show();
		#endif
		ErrorLog_AddNewMessage(m_strErrorDescription.PszaGetUtf8NZ(), m_strErrorDetails);
		}
	// Finally, make the error silent, so we don't display the same error twice
	m_err = EError_EMakeSilentError(m_err);
	Assert(EError_FuIsSilentError(m_err));
	return TRUE;
	} // FDisplayToMessageLog()
IXmlExchange *
IApplication::S_PaAllocateApplication_YZ(POBJECT poProfileParent, const CXmlNode * pXmlNodeElement)
    {
    Assert(pXmlNodeElement != NULL);
    TProfile * pProfileParent = (TProfile *)poProfileParent;
    Assert(pProfileParent->EGetRuntimeClass() == RTI(TProfile));
    // Find the type of application to allocate
    PSZUC pszClass = pXmlNodeElement->PszuFindAttributeValue_NZ(c_szaApplicationClass_);
    const SApplicationAllocator * pApplicationAllocator = c_rgzApplicationAllocators;
    while (TRUE)
        {
        if (pApplicationAllocator->pszClass == NULL)
            break;
        Assert(pApplicationAllocator->pfnAllocator != NULL);
        if (FCompareStrings(pApplicationAllocator->pszClass, pszClass))
            return pApplicationAllocator->pfnAllocator(pProfileParent);
        pApplicationAllocator++;	// Search the next application
        } // while
    MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "Unable to find application of class '$s'\n", pszClass);
    return NULL;
    }
Example #24
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()
void
CEventBallotPoll::StopPoll()
	{
	Assert(EGetEventClass() == c_eEventClass);
	MessageLog_AppendTextFormatSev(eSeverityNoise, "Stopping Poll ID $t\n", m_tsEventID);
	m_uFlagsBallot |= FB_kfStopAcceptingVotes;
	if (PGetEventBallotSend_YZ() != NULL)
		m_pEventBallotSent->m_uFlagsBallot |= FB_kfStopAcceptingVotes;
	if (m_tsStarted != d_ts_zNA && m_tsStopped == d_ts_zNA)
		{
		// Stop the poll if it was started and not already stopped
		m_tsStopped = Timestamp_GetCurrentDateTime();
		// Notify each Ballotmaster about the poll stopped
		OJapiAppBallotmaster * pBallotmaster = OJapiAppBallotmaster::s_plistBallotmasters;
		while (pBallotmaster != NULL)
			{
			pBallotmaster->OnEventPollStopped(this);
			pBallotmaster = pBallotmaster->m_pNext;
			}
		}
	}
Example #26
0
void
WChatLog::SL_HyperlinkClicked(const QUrl & url)
	{
	QString sUrl = url.toString();
	CStr strUrl = sUrl;		// Convert the URL to UTF-8
	PSZUC pszUrl = strUrl;
	if (FIsSchemeCambrian(pszUrl))
		{
		const CHS chCambrianAction = ChGetCambrianActionFromUrl(pszUrl);
		if (chCambrianAction == d_chCambrianAction_None)
			{
			TIMESTAMP tsEventID;
			PSZUC pszAction = Timestamp_PchDecodeFromBase64Url(OUT &tsEventID, pszUrl + 2);
			Assert(pszAction[0] == d_chSchemeCambrianActionSeparator);
			IEvent * pEvent = m_pContactOrGroup->Vault_PFindEventByID(tsEventID);
			if (pEvent != NULL)
				{
				OCursorSelectBlock oCursor(pEvent, this);
				pEvent->HyperlinkClicked(pszAction + 1, INOUT &oCursor);
				return;
				}
			MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "WChatLog::SL_HyperlinkClicked() - Unable to find matching tsEventID $t from hyperlink $s\n", tsEventID, pszUrl);
			}
		else
			{
			if (chCambrianAction == d_chCambrianAction_DisplayAllHistory)
				{
				CWaitCursor wait;
				m_fDisplayAllMessages = TRUE;
				ChatLog_EventsRepopulate();
				}
			} // if...else
		return;
		} // if
	if (url.scheme() != QLatin1String("file") && !url.isRelative())
		QDesktopServices::openUrl(url);
	} // SL_HyperlinkClicked()
Example #27
0
//	WGrid::QAbstractScrollArea::viewportSizeHint()
QSize
WGrid::viewportSizeHint() const
	{
	MessageLog_AppendTextFormatSev(eSeverityNoise, "WGrid::viewportSizeHint()\n");
	return QSize(m_cxWidthColumns, m_arraypRowsDisplay.GetSize() * m_cyHeightRow);
	}
Example #28
0
//	TreeItem_GotFocus(), virtual
//
//	Notification the TreeItem received the focus (was selected from the Navigation Tree)
//	Each class inheriting from ITreeItem should implement this virtual method, create an object inheriting WLayout and
//	call MainWindow_SetCurrentChatLayout().
void
ITreeItem::TreeItem_GotFocus()
	{
	MessageLog_AppendTextFormatSev(eSeverityErrorAssert, "Object must implement TreeItem_GotFocus()\n");
	MainWindow_SetCurrentLayout(NULL);	// Make sure there are no old layout
	}
void
OJapiAppBallotmaster::OnEventPollStopped(CEventBallotPoll * pEventBallotPoll)
	{
	MessageLog_AppendTextFormatSev(eSeverityInfoTextBlack, "emit onPollStopped($t)\n", pEventBallotPoll->m_tsEventID);
	emit onPollStopped(PGetOJapiPoll(pEventBallotPoll));
	}
OJapiPoll::~OJapiPoll()
	{
	MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "OJapiPoll::~OJapiPoll() 0x$p\n", this);
	delete m_paoJapiPollResults;
	}