File psi-0.14-signing-presence-optional.patch of Package psi
From 91db5b4817e08b2bb0ae0798595b02599e4a995c Mon Sep 17 00:00:00 2001
From: David Flatz <david@kantstrasse.ch>
Date: Sun, 3 Jan 2010 18:48:19 +0100
Subject: [PATCH] Make signing presence optional
This adds a option to the account properties to control whether psi signs
the status or not.
---
src/accountmodify.ui | 17 +++++++++++++++++
src/accountmodifydlg.cpp | 2 ++
src/profiles.h | 1 +
src/psi_profiles.cpp | 5 +++++
src/psiaccount.cpp | 2 +-
5 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/src/accountmodify.ui b/src/accountmodify.ui
index dfd455e..698c4d4 100644
--- a/src/accountmodify.ui
+++ b/src/accountmodify.ui
@@ -331,6 +331,23 @@
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="ck_sign">
+ <property name="text">
+ <string>Sign presence status</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/accountmodifydlg.cpp b/src/accountmodifydlg.cpp
index ad5d976..4e83840 100644
--- a/src/accountmodifydlg.cpp
+++ b/src/accountmodifydlg.cpp
@@ -150,6 +150,7 @@ void AccountModifyDlg::init()
if(PGPUtil::instance().pgpAvailable()) {
gb_pgp->setEnabled(true);
}
+ ck_sign->setChecked(acc.pgp_sign);
pc = psi->proxy()->createProxyChooser(tab_connection);
replaceWidget(lb_proxychooser, pc);
@@ -525,6 +526,7 @@ void AccountModifyDlg::save()
acc.stunPort = le_stunPort->text().toInt();
acc.pgpSecretKey = key;
+ acc.pgp_sign = ck_sign->isChecked();
acc.proxyID = pc->currentItem();
diff --git a/src/profiles.h b/src/profiles.h
index 7c33181..735c083 100644
--- a/src/profiles.h
+++ b/src/profiles.h
@@ -72,6 +72,7 @@ public:
QMap<QString, GroupData> groupState;
QCA::PGPKey pgpSecretKey;
+ bool pgp_sign;
VarList keybind;
diff --git a/src/psi_profiles.cpp b/src/psi_profiles.cpp
index 5f548dc..aea2b5d 100644
--- a/src/psi_profiles.cpp
+++ b/src/psi_profiles.cpp
@@ -136,6 +136,7 @@ void UserAccount::reset()
opt_reconn = false;
opt_connectAfterSleep = false;
opt_ignoreSSLWarnings = false;
+ pgp_sign = false;
proxy_index = 0;
proxy_type = PROXY_NONE;
@@ -228,6 +229,7 @@ void UserAccount::fromOptions(OptionsTree *o, QString base)
if (!e.isNull())
pgpSecretKey = e.pgpSecretKey();
}
+ pgp_sign = o->getOption(base + ".pgp-sign").toBool();
tmp = o->getOption(base + ".allow-plain").toString();
if (tmp == "never") {
@@ -346,6 +348,8 @@ void UserAccount::toOptions(OptionsTree *o, QString base)
} else {
o->setOption(base + ".pgp-secret-key-id", "");
}
+ o->setOption(base + ".pgp-sign", pgp_sign);
+
switch (allow_plain) {
case XMPP::ClientStream::NoAllowPlain:
o->setOption(base + ".allow-plain", "never");
@@ -514,6 +518,7 @@ void UserAccount::fromXml(const QDomElement &a)
if (!e.isNull())
pgpSecretKey = e.pgpSecretKey();
}
+ readBoolEntry(a, "pgpSign", &pgp_sign);
QDomElement r = findSubTag(a, "roster", &found);
if(found) {
diff --git a/src/psiaccount.cpp b/src/psiaccount.cpp
index fdca674..6d724ff 100644
--- a/src/psiaccount.cpp
+++ b/src/psiaccount.cpp
@@ -2375,7 +2375,7 @@ void PsiAccount::setStatusDirect(const Status &_s, bool withPriority)
//printf("setting status to [%s]\n", s.status().latin1());
// using pgp?
- if(!d->cur_pgpSecretKey.isNull()) {
+ if(!d->cur_pgpSecretKey.isNull() && d->acc.pgp_sign) {
d->loginStatus = s;
// sign presence
--
1.6.6