[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2451: * some smaller bugfixes (in vidalia/branches/hidden-services/src/vidalia: config help/content/en)
Author: borkdomenik
Date: 2008-03-23 17:35:13 -0400 (Sun, 23 Mar 2008)
New Revision: 2451
Modified:
vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp
vidalia/branches/hidden-services/src/vidalia/config/servicepage.h
vidalia/branches/hidden-services/src/vidalia/help/content/en/config.html
vidalia/branches/hidden-services/src/vidalia/help/content/en/services.html
Log:
* some smaller bugfixes
Modified: vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp 2008-03-23 19:04:38 UTC (rev 2450)
+++ vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp 2008-03-23 21:35:13 UTC (rev 2451)
@@ -36,8 +36,8 @@
_serviceSettings = new ServiceSettings(_torControl);
/* A QMap, mapping from the row number to the Entity for all services */
_services = new QMap<int, Service>();
- /* A QList, consisting of all running services before vidalia starts*/
- QList<Service> _torServices;
+ /* A QMap, mapping from the directory path to the Entity for all Tor services */
+ _torServices = new QMap<QString, Service>();
ui.serviceWidget->horizontalHeader()->resizeSection(0, 150);
ui.serviceWidget->horizontalHeader()->resizeSection(1, 89);
@@ -146,11 +146,13 @@
ui.copyButton->setEnabled(false);
ui.browseButton->setEnabled(false);
// get all services
- _services = new QMap<int, Service>();
- QList<Service> _torServices;
+ _services = new QMap<int, Service>();
+ _torServices = new QMap<QString, Service>();
+ QList<Service> torServiceList;
+
QString torConfigurationString = _serviceSettings->getHiddenServiceDirectories();
- _torServices = extractSingleServices(torConfigurationString);
- QList<Service> completeList = _torServices;
+ torServiceList = extractSingleServices(torConfigurationString);
+ QList<Service> completeList = torServiceList;
// the services stored with vidalia
ServiceList serviceList = _serviceSettings->getServices();
QList<Service> serviceSettingsList = serviceList.services();
@@ -158,7 +160,7 @@
// check whether a service is already in the list because he is published
while(it.hasNext()) {
Service temp = it.next();
- if(isServicePublished(temp, _torServices) == false) {
+ if(isServicePublished(temp, torServiceList) == false) {
completeList.push_back(temp);
}
}
@@ -201,24 +203,29 @@
additionalOptions.remove(0, index+4);
// remove the first appearance of the port
int startindex = additionalOptions.indexOf("hiddenserviceport", 0, Qt::CaseInsensitive);
- int endindex = additionalOptions.indexOf("250", startindex)+4;
- additionalOptions.remove(startindex, (endindex-startindex));
- //remove all appearances of "250"
- while(additionalOptions.contains("250")) {
+ int endindex = additionalOptions.indexOf("250", startindex);
+ if(endindex != -1) {
+ additionalOptions.remove(startindex, (endindex-startindex)+4);
+ //remove all appearances of "250"
+ while(additionalOptions.contains("250")) {
int i = additionalOptions.indexOf("250", 0);
additionalOptions.remove(i, 4);
+ }
+ //quote the values
+ int j = additionalOptions.indexOf("=", 0);
+ while(j != -1) {
+ additionalOptions.insert(j+1, "\"");
+ int end = additionalOptions.indexOf("\n", j);
+ additionalOptions.insert(end, "\"");
+ j = additionalOptions.indexOf("=", end);
+ }
+ additionalOptions.insert(additionalOptions.length(), "\"");
+ //replace the line brakes with a space and create one single line
+ additionalOptions.replace(QString("\n"), QString(" "));
+ } else {
+ additionalOptions = "";
}
- //quote the values
- int j = additionalOptions.indexOf("=", 0);
- while(j != -1) {
- additionalOptions.insert(j+1, "\"");
- int end = additionalOptions.indexOf("\n", j);
- additionalOptions.insert(end, "\"");
- j = additionalOptions.indexOf("=", end);
- }
- additionalOptions.insert(additionalOptions.length(), "\"");
- //replace the line brakes with a space and create one single line
- additionalOptions.replace(QString("\n"), QString(" "));
+
QString address, virtualPort, physAddressPort, serviceDir;
// service directory
@@ -259,14 +266,15 @@
}
Service service(address, virtualPort, physAddressPort, serviceDir, true);
service.setAdditionalServiceOptions(additionalOptions);
+ _torServices->insert(serviceDir, service);
return service;
}
/** this method checks either a service is published or not */
bool
-ServicePage::isServicePublished(Service service, QList<Service> _torServices)
+ServicePage::isServicePublished(Service service, QList<Service> torServices)
{
- QListIterator<Service> it(_torServices);
+ QListIterator<Service> it(torServices);
while(it.hasNext()) {
Service temp = it.next();
if(temp.serviceDirectory().compare(service.serviceDirectory()) == 0) {
@@ -346,7 +354,6 @@
ServicePage::addService()
{
int rows = ui.serviceWidget->rowCount();
- VMessageBox::warning(this, tr("Error"), QString::number(_services->size()), VMessageBox::Ok);
ui.serviceWidget->insertRow(rows);
QTableWidgetItem *address = new QTableWidgetItem("[Created by Tor]");
address->setFlags(Qt::ItemIsSelectable);
@@ -446,13 +453,22 @@
emptyTable = true;
}
int currentRow = ui.serviceWidget->currentRow();
- if(emptyTable == true || ui.serviceWidget->item(currentRow,0)->text().contains(".onion")) {
- ui.browseButton->setEnabled(false);
- ui.copyButton->setEnabled(true);
- } else {
- ui.browseButton->setEnabled(true);
- ui.copyButton->setEnabled(false);
- }
+ if(emptyTable == false) {
+ QTableWidgetItem* item = ui.serviceWidget->item(currentRow, 0);
+ if(item != NULL) {
+ bool b = item->text().contains(".onion");
+ ui.copyButton->setEnabled(b);
+ }
+ }
+ QTableWidgetItem* item = ui.serviceWidget->item(ui.serviceWidget->currentRow(), 3);
+ QString selDir = "";
+ selDir.append(_services->value(ui.serviceWidget->currentRow()).serviceDirectory());
+ QStringList strList = _torServices->keys();
+ if(selDir.length() > 0) {
+ if(strList.contains(selDir)) {
+ ui.browseButton->setEnabled(false);
+ }
+ }
// if the user has clicked on the checkbox cell
if(ui.serviceWidget->currentColumn() == 4) {
Service service = _services->take(currentRow);
@@ -461,34 +477,9 @@
item->setCheckState(Qt::Unchecked);
service.setEnabled(false);
} else {
- // check if directory is unique
- bool unique = true;
- QString dir = ui.serviceWidget->item(currentRow, 3)->text();
- for (int index = 0; index < ui.serviceWidget->rowCount(); index++) {
- // skip own row and non-enabled services
- if(index == currentRow ||
- ui.serviceWidget->item(index, 4)->checkState() == Qt::Unchecked) {
- continue;
- }
- QTableWidgetItem* compareWith = ui.serviceWidget->item(index, 3);
- if(compareWith != NULL) {
- QString actualDir = compareWith->text();
- if(actualDir.length() > 0 && dir.compare(actualDir) == 0) {
- // service directory already in use
- VMessageBox::warning(this, tr("Error"),
- tr("Directory already in use by another enabled service."),
- VMessageBox::Ok);
- unique = false;
- break;
- }
- }
- }
- // if directory is unique, change state
- if (unique == true) {
- item->setCheckState(Qt::Checked);
- service.setEnabled(true);
- }
- }
+ item->setCheckState(Qt::Checked);
+ service.setEnabled(true);
+ }
_services->insert(currentRow, service);
}
}
@@ -561,8 +552,8 @@
}
// compare with directories of other enabled services
for (int index = 0; index < ui.serviceWidget->rowCount(); index++) {
- // skip own row and non-enabled services
- if(index == item->row() || !_services->value(index).enabled()) {
+ // skip own row
+ if(index == item->row()) {
continue;
}
QTableWidgetItem* compareWith = ui.serviceWidget->item(index, 3);
@@ -571,7 +562,7 @@
if(actualDir.length() > 0 && text.compare(actualDir) == 0) {
// service directory already in use
VMessageBox::warning(this, tr("Error"),
- tr("Directory already in use by another enabled service."),
+ tr("Directory already in use by another service."),
VMessageBox::Ok);
item->setText(item->data(32).toString());
return;
Modified: vidalia/branches/hidden-services/src/vidalia/config/servicepage.h
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/config/servicepage.h 2008-03-23 19:04:38 UTC (rev 2450)
+++ vidalia/branches/hidden-services/src/vidalia/config/servicepage.h 2008-03-23 21:35:13 UTC (rev 2451)
@@ -55,7 +55,7 @@
void startServicesInTor(QList<Service> services);
- bool isServicePublished(Service service, QList<Service> _torServices);
+ bool isServicePublished(Service service, QList<Service> torServices);
bool checkBeforeSaving(QList<Service> services);
@@ -72,7 +72,7 @@
/* A QMap, mapping from QString servicename to the Entity service */
QMap<int, Service>* _services;
/* A QList, consisting of all running services before vidalia starts*/
- QList<Service> _torServices;
+ QMap<QString, Service>* _torServices;
/** Qt Designer generated object */
Ui::ServicePage ui;
};
Modified: vidalia/branches/hidden-services/src/vidalia/help/content/en/config.html
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/help/content/en/config.html 2008-03-23 19:04:38 UTC (rev 2450)
+++ vidalia/branches/hidden-services/src/vidalia/help/content/en/config.html 2008-03-23 21:35:13 UTC (rev 2451)
@@ -190,7 +190,7 @@
<h3>Hidden Service Settings</h3>
<p>
Hidden services allow you to provide any kind of TCP-based service, e.g.
-an HTTP service, to others without revealing your IP address.
+an HTTP service, to other Tor users without revealing your IP address.
</p>
</body>
Modified: vidalia/branches/hidden-services/src/vidalia/help/content/en/services.html
===================================================================
--- vidalia/branches/hidden-services/src/vidalia/help/content/en/services.html 2008-03-23 19:04:38 UTC (rev 2450)
+++ vidalia/branches/hidden-services/src/vidalia/help/content/en/services.html 2008-03-23 21:35:13 UTC (rev 2451)
@@ -26,7 +26,7 @@
<h3>What is a hidden service?</h3>
<p>
Hidden services allow you to provide any kind of TCP-based service, e.g. an
-HTTP service, to others without revealing your IP address. The protocol
+HTTP service, to other Tor users without revealing your IP address. The protocol
to provide a hidden service is built on top of the same circuits that Tor
uses for anonymous browsing and roughly has similar anonymity properties.
</p>