示例#1
0
void ChatWindowMenu::onArchiveRequestCompleted(const QString &AId)
{
	if (FSessionRequest == AId)
	{
		if (FSessionNegotiation)
		{
			IArchiveItemPrefs iprefs = FArchiver->archiveItemPrefs(streamJid(),contactJid());
			IStanzaSession session = FSessionNegotiation->findSession(streamJid(),contactJid());
			if (session.status == IStanzaSession::Active)
			{
				bool isOTRSession = isOTRStanzaSession(session);
				if (!isOTRSession && iprefs.otr==ARCHIVE_OTR_REQUIRE)
					FSessionNegotiation->initSession(streamJid(),contactJid());
				else if (!isOTRSession && iprefs.otr!=ARCHIVE_OTR_REQUIRE)
					FSessionNegotiation->initSession(streamJid(),contactJid());
			}
			else if (iprefs.otr == ARCHIVE_OTR_REQUIRE)
			{
				FSessionNegotiation->initSession(streamJid(),contactJid());
			}
		}
		FSessionRequest.clear();
		updateMenu();
	}
	else if (FSaveRequest == AId)
	{
		FSaveRequest.clear();
		updateMenu();
	}
}
示例#2
0
void ChatWindowMenu::onStanzaSessionTerminated(const IStanzaSession &ASession)
{
	if (ASession.streamJid==streamJid() && ASession.contactJid==contactJid())
	{
		restoreSessionPrefs(contactJid());
		updateMenu();
	}
}
示例#3
0
void ChatWindowMenu::updateMenu()
{
	if (FArchiver->isArchivePrefsEnabled(streamJid()))
	{
		IArchiveItemPrefs iprefs = FArchiver->archiveItemPrefs(streamJid(),contactJid());
		bool isOTRSession = FSessionNegotiation!=NULL ? isOTRStanzaSession(FSessionNegotiation->findSession(streamJid(),contactJid())) : false;

		FEnableArchiving->setChecked(iprefs.save != ARCHIVE_SAVE_FALSE);
		FEnableArchiving->setEnabled(FSaveRequest.isEmpty() && FSessionRequest.isEmpty() && !isOTRSession);

		FDisableArchiving->setChecked(iprefs.save == ARCHIVE_SAVE_FALSE);
		FDisableArchiving->setEnabled(FSaveRequest.isEmpty() && FSessionRequest.isEmpty() && !isOTRSession);

		if (FSessionNegotiation && FDataForms && FDiscovery)
		{
			FStartOTRSession->setEnabled(FSaveRequest.isEmpty() && FSessionRequest.isEmpty() && iprefs.otr!=ARCHIVE_OTR_FORBID);
			FStartOTRSession->setVisible(!isOTRSession && FDiscovery->discoInfo(streamJid(),contactJid()).features.contains(NS_STANZA_SESSION));

			FStopOTRSession->setEnabled(FSaveRequest.isEmpty() && FSessionRequest.isEmpty());
			FStopOTRSession->setVisible(isOTRSession);
		}
		else
		{
			FStartOTRSession->setVisible(false);
			FStopOTRSession->setVisible(false);
		}
	}
	else
	{
		FEnableArchiving->setEnabled(false);
		FEnableArchiving->setChecked(false);
		
		FDisableArchiving->setEnabled(false);
		FDisableArchiving->setChecked(false);

		FStartOTRSession->setVisible(false);
		FStopOTRSession->setVisible(false);
	}
}
示例#4
0
QString NormalWindow::tabPageId() const
{
	return "NormalWindow|"+streamJid().pBare()+"|"+contactJid().pBare();
}
示例#5
0
QString ChatWindow::tabPageId() const
{
	return "ChatWindow|"+streamJid().pBare()+"|"+contactJid().pBare();
}
示例#6
0
void ChatWindowMenu::onStanzaSessionActivated(const IStanzaSession &ASession)
{
	if (ASession.streamJid==streamJid() && ASession.contactJid==contactJid())
		updateMenu();
}
示例#7
0
void ChatWindowMenu::onDiscoInfoChanged(const IDiscoInfo &ADiscoInfo)
{
	if (ADiscoInfo.streamJid==streamJid() && ADiscoInfo.contactJid==contactJid())
		updateMenu();
}
示例#8
0
void ChatWindowMenu::onActionTriggered(bool)
{
	Action *action = qobject_cast<Action *>(sender());
	if (action && FSaveRequest.isEmpty() && FSessionRequest.isEmpty())
	{
		if (action == FEnableArchiving)
		{
			IArchiveItemPrefs iprefs = FArchiver->archiveItemPrefs(streamJid(),contactJid().bare());
			if (iprefs.save == ARCHIVE_SAVE_FALSE)
			{
				IArchiveStreamPrefs sprefs = FArchiver->archivePrefs(streamJid());
				iprefs.save = sprefs.defaultPrefs.save!=ARCHIVE_SAVE_FALSE ? sprefs.defaultPrefs.save : QString(ARCHIVE_SAVE_MESSAGE);
				if (iprefs != sprefs.defaultPrefs)
				{
					sprefs.itemPrefs.insert(contactJid().bare(),iprefs);
					FSaveRequest = FArchiver->setArchivePrefs(streamJid(),sprefs);
				}
				else
				{
					FSaveRequest = FArchiver->removeArchiveItemPrefs(streamJid(),contactJid().bare());
				}
			}
		}
		else if (action == FDisableArchiving)
		{
			IArchiveItemPrefs iprefs = FArchiver->archiveItemPrefs(streamJid(),contactJid().bare());
			if (iprefs.save != ARCHIVE_SAVE_FALSE)
			{
				IArchiveStreamPrefs sprefs = FArchiver->archivePrefs(streamJid());
				iprefs.save = ARCHIVE_SAVE_FALSE;
				if (iprefs != sprefs.defaultPrefs)
				{
					sprefs.itemPrefs.insert(contactJid().bare(),iprefs);
					FSaveRequest = FArchiver->setArchivePrefs(streamJid(),sprefs);
				}
				else
				{
					FSaveRequest = FArchiver->removeArchiveItemPrefs(streamJid(),contactJid().bare());
				}
			}
		}
		else if (action == FStartOTRSession)
		{
			IArchiveItemPrefs iprefs = FArchiver->archiveItemPrefs(streamJid(),contactJid());
			if (iprefs.otr != ARCHIVE_OTR_REQUIRE)
			{
				IArchiveStreamPrefs sprefs = FArchiver->archivePrefs(streamJid());
				
				FRestorePrefs = true;
				FSessionPrefs = sprefs.itemPrefs.value(contactJid());

				iprefs.otr = ARCHIVE_OTR_REQUIRE;
				sprefs.itemPrefs.insert(contactJid(),iprefs);
				FSessionRequest = FArchiver->setArchivePrefs(streamJid(),sprefs);
			}
			else if (FSessionNegotiation)
			{
				FSessionNegotiation->initSession(streamJid(),contactJid());
			}
		}
		else if (action == FStopOTRSession)
		{
			if (FSessionNegotiation)
				FSessionNegotiation->terminateSession(streamJid(),contactJid());
		}
		updateMenu();
	}
}
			<div style=\"position:absolute; left:50%; top:50%; width:18px; height:18px; margin:-9px 0 0 -9px; background: transparent url('%6') no-repeat;\"></div> \
			<div style=\"display:none\"> \
				<form method=\"post\" action=\"http://id.rambler.ru/script/auth.cgi?mode=login\" name=\"auth_form\"> \
					<input type=\"hidden\" name=\"back\" value=\"http://history.xmpp.rambler.ru/m/history/talks/%1\"> \
					<input type=\"text\" name=\"login\" value=\"%2\"> \
					<input type=\"text\" name=\"domain\" value=\"%3\"> \
					<input type=\"password\" name=\"passw\" value=\"%4\"> \
					<input type=\"text\" name=\"long_session\" value=\"0\"> \
					<input type=\"submit\" name=\"user.password\" value=\"%5\"> \
				</form> \
			</div> \
			<script>document.forms.auth_form.submit()</script> \
		</body></html>";

	QString html = HtmlTemplate.arg(
		QUrl::toPercentEncoding(contactJid().bare()).constData(),
		streamJid().bare(),
		streamJid().pDomain(),
		FRoster->xmppStream()->password(),
		QString("Enter"),
		QUrl::fromLocalFile(IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->fileFullName(MNI_RAMBLERHISTORY_KRYTILKA)).toString());

	ui.wbvHistoryView->setHtml(html);

/*
	QByteArray body;
	body.append("back="+QString("http://mail.rambler.ru/m/history/talks/%1").arg(contactJid().eBare()).toUtf8().toPercentEncoding());
	body.append("&login="******"&domain="+streamJid().pDomain().toUtf8().toPercentEncoding());
	body.append("&passw="+FRoster->xmppStream()->password().toUtf8().toPercentEncoding());
	body.append("&long_session=0");