[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1901 - Extractor Extractor/libltdl GNUnet/src/applications
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1901 - Extractor Extractor/libltdl GNUnet/src/applications/fs/ecrs GNUnet/src/applications/fs/fsui gnunet-gtk gnunet-gtk/src/plugins/fs |
Date: |
Thu, 25 Aug 2005 00:45:41 -0700 (PDT) |
Author: grothoff
Date: 2005-08-25 00:45:37 -0700 (Thu, 25 Aug 2005)
New Revision: 1901
Modified:
Extractor/configure.ac
Extractor/libltdl/install-sh
GNUnet/src/applications/fs/ecrs/namespace.c
GNUnet/src/applications/fs/fsui/Makefile.am
GNUnet/src/applications/fs/fsui/check.conf
GNUnet/src/applications/fs/fsui/namespace_info.c
gnunet-gtk/gnunet-gtk.glade
gnunet-gtk/src/plugins/fs/meta.c
gnunet-gtk/src/plugins/fs/meta.h
gnunet-gtk/src/plugins/fs/namespace.c
Log:
namespace update hacking and minor bugfixes
Modified: Extractor/configure.ac
===================================================================
--- Extractor/configure.ac 2005-08-25 06:38:27 UTC (rev 1900)
+++ Extractor/configure.ac 2005-08-25 07:45:37 UTC (rev 1901)
@@ -248,7 +248,7 @@
exiv2=1
AC_MSG_CHECKING([whether to enable exiv2 extractor])
-AC_ARG_ENABLE(printable,
+AC_ARG_ENABLE(exiv2,
[AC_HELP_STRING([--enable-exiv2],[Enable exiv2 support])
AC_HELP_STRING([--disable-exiv2],[Disable exiv2 support])],
[case "$enableval" in
Modified: Extractor/libltdl/install-sh
===================================================================
--- Extractor/libltdl/install-sh 2005-08-25 06:38:27 UTC (rev 1900)
+++ Extractor/libltdl/install-sh 2005-08-25 07:45:37 UTC (rev 1901)
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2004-02-15.20
+scriptversion=2004-04-01.17
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -280,26 +280,35 @@
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
- # Now remove or move aside any old file at destination location. We
- # try this two ways since rm can't unlink itself on some systems and
- # the destination file might be busy for other reasons. In this case,
- # the final cleanup might fail but the new file should still install
- # successfully.
- {
- if test -f "$dstdir/$dstfile"; then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
- || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
- || {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
- } &&
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
fi || { (exit 1); exit; }
done
Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2005-08-25 06:38:27 UTC (rev
1900)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2005-08-25 07:45:37 UTC (rev
1901)
@@ -226,47 +226,49 @@
nb,
sizeof(NBlock) + mdsize);
- keywords = advertisementURI->data.ksk.keywords;
- keywordCount = advertisementURI->data.ksk.keywordCount;
- cpy = MALLOC(size - sizeof(KBlock) - sizeof(unsigned int));
- memcpy(cpy,
- &knb->nblock,
- size - sizeof(KBlock) - sizeof(unsigned int));
- for (i=0;i<keywordCount;i++) {
- hash(keywords[i],
- strlen(keywords[i]),
- &hc);
- pk = makeKblockKey(&hc);
- getPublicKey(pk,
- &knb->kblock.keyspace);
- GNUNET_ASSERT(size - sizeof(KBlock) - sizeof(unsigned int)
- == sizeof(NBlock) + mdsize);
- ECRS_encryptInPlace(&hc,
- &knb->nblock,
- size - sizeof(KBlock) - sizeof(unsigned int));
-
- GNUNET_ASSERT(OK == sign(pk,
- sizeof(NBlock) + mdsize,
- &knb->nblock,
- &knb->kblock.signature));
- /* extra check: verify sig */
- freePrivateKey(pk);
- if (OK != FS_insert(sock, knvalue)) {
- FREE(rootURI);
- ECRS_deleteNamespace(name);
- FREE(cpy);
- FREE(knvalue);
- FREE(value);
- releaseClientSocket(sock);
- freePrivateKey(hk);
- return NULL;
- }
- /* restore nblock to avoid re-encryption! */
- memcpy(&knb->nblock,
- cpy,
+ if (advertisementURI != NULL) {
+ keywords = advertisementURI->data.ksk.keywords;
+ keywordCount = advertisementURI->data.ksk.keywordCount;
+ cpy = MALLOC(size - sizeof(KBlock) - sizeof(unsigned int));
+ memcpy(cpy,
+ &knb->nblock,
size - sizeof(KBlock) - sizeof(unsigned int));
+ for (i=0;i<keywordCount;i++) {
+ hash(keywords[i],
+ strlen(keywords[i]),
+ &hc);
+ pk = makeKblockKey(&hc);
+ getPublicKey(pk,
+ &knb->kblock.keyspace);
+ GNUNET_ASSERT(size - sizeof(KBlock) - sizeof(unsigned int)
+ == sizeof(NBlock) + mdsize);
+ ECRS_encryptInPlace(&hc,
+ &knb->nblock,
+ size - sizeof(KBlock) - sizeof(unsigned int));
+
+ GNUNET_ASSERT(OK == sign(pk,
+ sizeof(NBlock) + mdsize,
+ &knb->nblock,
+ &knb->kblock.signature));
+ /* extra check: verify sig */
+ freePrivateKey(pk);
+ if (OK != FS_insert(sock, knvalue)) {
+ FREE(rootURI);
+ ECRS_deleteNamespace(name);
+ FREE(cpy);
+ FREE(knvalue);
+ FREE(value);
+ releaseClientSocket(sock);
+ freePrivateKey(hk);
+ return NULL;
+ }
+ /* restore nblock to avoid re-encryption! */
+ memcpy(&knb->nblock,
+ cpy,
+ size - sizeof(KBlock) - sizeof(unsigned int));
+ }
+ FREE(cpy);
}
- FREE(cpy);
FREE(knvalue);
FREE(value);
releaseClientSocket(sock);
@@ -552,14 +554,15 @@
&pk);
freePrivateKey(hk);
hash(&pk, sizeof(PublicKey), &namespace);
- if (c->cb != NULL) {
+ if (NULL != c->cb) {
if (OK == c->cb(&namespace,
name,
c->cls))
c->cnt++;
else
c->cnt = SYSERR;
- }
+ } else
+ c->cnt++;
return OK;
}
Modified: GNUnet/src/applications/fs/fsui/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/fsui/Makefile.am 2005-08-25 06:38:27 UTC (rev
1900)
+++ GNUnet/src/applications/fs/fsui/Makefile.am 2005-08-25 07:45:37 UTC (rev
1901)
@@ -27,7 +27,8 @@
fsuitest \
fsuitest2 \
searchtest \
- downloadtest
+ downloadtest \
+ namespace_infotest
TESTS = $(check_PROGRAMS)
@@ -45,6 +46,13 @@
$(top_builddir)/src/applications/fs/fsui/libgnunetfsui.la \
$(top_builddir)/src/util/libgnunetutil.la
+namespace_infotest_SOURCES = \
+ namespace_infotest.c
+namespace_infotest_LDADD = \
+ $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+ $(top_builddir)/src/applications/fs/fsui/libgnunetfsui.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
searchtest_SOURCES = \
searchtest.c
searchtest_LDADD = \
Modified: GNUnet/src/applications/fs/fsui/check.conf
===================================================================
--- GNUnet/src/applications/fs/fsui/check.conf 2005-08-25 06:38:27 UTC (rev
1900)
+++ GNUnet/src/applications/fs/fsui/check.conf 2005-08-25 07:45:37 UTC (rev
1901)
@@ -20,7 +20,7 @@
topology = "topology_default"
[NETWORK]
-PORT = 2087
+PORT = 2080
INTERFACE = eth0
HELOEXCHANGE = NO
TRUSTED = 127.0.0.0/8;
Modified: GNUnet/src/applications/fs/fsui/namespace_info.c
===================================================================
--- GNUnet/src/applications/fs/fsui/namespace_info.c 2005-08-25 06:38:27 UTC
(rev 1900)
+++ GNUnet/src/applications/fs/fsui/namespace_info.c 2005-08-25 07:45:37 UTC
(rev 1901)
@@ -235,11 +235,14 @@
&rating);
if (meta == NULL)
meta = ECRS_createMetaData();
- ret = c->iterator(c->closure,
- name,
- nsid,
- meta,
- rating);
+ if (c->iterator != NULL) {
+ ret = c->iterator(c->closure,
+ name,
+ nsid,
+ meta,
+ rating);
+ } else
+ ret = OK;
ECRS_freeMetaData(meta);
return ret;
}
@@ -260,11 +263,14 @@
&meta,
&rating))
return OK; /* ignore entry */
- ret = c->iterator(c->closure,
- fn,
- &id,
- meta,
- rating);
+ if (c->iterator != NULL) {
+ ret = c->iterator(c->closure,
+ fn,
+ &id,
+ meta,
+ rating);
+ } else
+ ret = OK;
ECRS_freeMetaData(meta);
return OK;
}
@@ -408,21 +414,23 @@
BREAK();
return SYSERR;
}
- fi->meta = ECRS_deserializeMetaData(&uri[pos],
- size);
- if (fi->meta == NULL) {
- FREE(buf);
- BREAK();
- return SYSERR;
+ if (fi != NULL) {
+ fi->meta = ECRS_deserializeMetaData(&uri[pos],
+ size);
+ if (fi->meta == NULL) {
+ FREE(buf);
+ BREAK();
+ return SYSERR;
+ }
+ fi->uri = ECRS_stringToUri(uri);
+ if (fi->uri == NULL) {
+ ECRS_freeMetaData(fi->meta);
+ fi->meta = NULL;
+ FREE(buf);
+ BREAK();
+ return SYSERR;
+ }
}
- fi->uri = ECRS_stringToUri(uri);
- if (fi->uri == NULL) {
- ECRS_freeMetaData(fi->meta);
- fi->meta = NULL;
- FREE(buf);
- BREAK();
- return SYSERR;
- }
*updateInterval = ntohl(buf->updateInterval);
*lastPubTime = ntohl(buf->lastPubTime);
*nextId = buf->nextId;
Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2005-08-25 06:38:27 UTC (rev 1900)
+++ gnunet-gtk/gnunet-gtk.glade 2005-08-25 07:45:37 UTC (rev 1901)
@@ -6313,6 +6313,7 @@
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">0</property>
+ <property
name="mnemonic_widget">namespaceUpdateAnonymitySpinButton</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -6371,6 +6372,7 @@
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">0</property>
+ <property
name="mnemonic_widget">nextIdentifierEntry</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -6384,15 +6386,20 @@
</child>
<child>
- <widget class="GtkComboBoxEntry"
id="nextIdentifierComboBoxEntry">
+ <widget class="GtkEntry" id="nextIdentifierEntry">
<property name="visible">True</property>
- <property name="add_tearoffs">False</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="focus_on_click">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
@@ -6525,6 +6532,7 @@
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">0</property>
+ <property
name="mnemonic_widget">namespaceUpdateMetaValueEntry</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -6666,6 +6674,7 @@
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">0</property>
+ <property name="mnemonic_widget">scrolledwindow31</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
Modified: gnunet-gtk/src/plugins/fs/meta.c
===================================================================
--- gnunet-gtk/src/plugins/fs/meta.c 2005-08-25 06:38:27 UTC (rev 1900)
+++ gnunet-gtk/src/plugins/fs/meta.c 2005-08-25 07:45:37 UTC (rev 1901)
@@ -385,6 +385,13 @@
return keywordURI;
}
+char * updateIntervalToString(TIME_T interval) {
+ if (interval == ECRS_SBLOCK_UPDATE_SPORADIC)
+ return strdup(_("--sporadic update--"));
+ if (interval == ECRS_SBLOCK_UPDATE_NONE)
+ return strdup(_("--no update--"));
+ return timeIntervalToFancyString(interval * cronSECONDS);
+}
int tryParseTimeInterval(GladeXML * xml,
const char * intervalComboBoxEntry,
Modified: gnunet-gtk/src/plugins/fs/meta.h
===================================================================
--- gnunet-gtk/src/plugins/fs/meta.h 2005-08-25 06:38:27 UTC (rev 1900)
+++ gnunet-gtk/src/plugins/fs/meta.h 2005-08-25 07:45:37 UTC (rev 1901)
@@ -58,6 +58,7 @@
struct ECRS_URI * getKeywordURIFromList(GladeXML * xml,
const char * name);
+char * updateIntervalToString(TIME_T interval);
int tryParseTimeInterval(GladeXML * xml,
const char * intervalComboBoxEntry,
Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c 2005-08-25 06:38:27 UTC (rev
1900)
+++ gnunet-gtk/src/plugins/fs/namespace.c 2005-08-25 07:45:37 UTC (rev
1901)
@@ -119,32 +119,30 @@
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(resultList),
-1,
- _("Last ID"),
+ _("Publication Frequency"),
renderer,
- "text", IN_NAMESPACE_LAST_STRING,
+ "text",
IN_NAMESPACE_PUB_FREQ_STRING,
NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(resultList),
-1,
- _("Next ID"),
+ _("Next Publication Date"),
renderer,
- "text", IN_NAMESPACE_NEXT_STRING,
+ "text",
IN_NAMESPACE_PUB_DATE_STRING,
NULL);
-
-
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(resultList),
-1,
- _("Publication Frequency"),
+ _("Last ID"),
renderer,
- "text",
IN_NAMESPACE_PUB_FREQ_STRING,
+ "text", IN_NAMESPACE_LAST_STRING,
NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(resultList),
-1,
- _("Next Publication Date"),
+ _("Next ID"),
renderer,
- "text",
IN_NAMESPACE_PUB_DATE_STRING,
+ "text", IN_NAMESPACE_NEXT_STRING,
NULL);
child = gtk_bin_get_child(GTK_BIN(window));
gtk_widget_ref(GTK_WIDGET(child));
@@ -294,7 +292,6 @@
char * freq;
char * date;
unsigned long long size;
- TIME_T t;
filename = ECRS_getFirstFromMetaData(fi->meta,
EXTRACTOR_FILENAME,
@@ -331,9 +328,14 @@
uriString = ECRS_uriToString(fi->uri);
hash2enc(lastId, &last);
hash2enc(nextId, &next);
- t = nextPublicationTime;
- date = GN_CTIME(&t);
- freq = timeIntervalToFancyString(publicationFrequency * cronSECONDS);
+ if (publicationFrequency == ECRS_SBLOCK_UPDATE_SPORADIC)
+ date = STRDUP(_("unspecified"));
+ else if (publicationFrequency == ECRS_SBLOCK_UPDATE_NONE)
+ date = STRDUP(_("never"));
+ else
+ date = GN_CTIME(&nextPublicationTime);
+
+ freq = updateIntervalToString(publicationFrequency);
gtk_list_store_append(model,
&iter);
gtk_list_store_set(model,
@@ -793,17 +795,6 @@
metaXML = NULL;
}
-typedef struct {
- unsigned int anonymityLevel;
- char * namespaceName;
- TIME_T updateInterval;
- HashCode512 lastId;
- HashCode512 thisId;
- HashCode512 * nextId;
- struct ECRS_MetaData * meta;
-} UUC;
-
-
void on_namespaceUpdateButton_clicked(GtkWidget * dummy1,
GtkWidget * dummy2) {
const char * identifierName;
@@ -814,15 +805,18 @@
GtkWidget * dialog;
GtkWidget * spin;
GtkWidget * update;
+ GtkTreeIter iter;
struct ECRS_MetaData * meta;
HashCode512 nextId;
+ HashCode512 prevId;
GtkWidget * contentList;
GtkTreeSelection * selection;
GtkTreeSelection * selectionNamespace;
- UUC cls;
+ IUC cls;
gint num;
- char * oldName;
- struct ECRS_URI * uri;
+ const char * last;
+ const char * next;
+ const char * freq;
contentList
= glade_xml_get_widget(getMainXML(),
@@ -876,32 +870,56 @@
gtk_widget_destroy(dialog);
return;
}
-
+ if (FALSE == gtk_tree_selection_get_selected(selectionNamespace,
+ NULL,
+ &iter)) {
+ BREAK();
+ return;
+ }
+ gtk_tree_model_get(list->model,
+ &iter,
+ IN_NAMESPACE_LAST_STRING, &last,
+ IN_NAMESPACE_NEXT_STRING, &next,
+ IN_NAMESPACE_PUB_FREQ_STRING, &freq,
+ IN_NAMESPACE_META, &meta,
+ -1);
metaXML
= glade_xml_new(getGladeFileName(),
"namespaceUpdateDialog",
PACKAGE_NAME);
connectGladeWithPlugins(metaXML);
-
- uri = NULL; // FIXME
- oldName = STRDUP("FIXME"); // ECRS_uriToString(uri);
nameLine = glade_xml_get_widget(metaXML,
"identifierLabel");
gtk_label_set_text(GTK_LABEL(nameLine),
- oldName);
- FREE(oldName);
- /* FIXME: set next identifier label! */
+ next);
+ if (OK != enc2hash(next,
+ &cls.thisId)) {
+ BREAK();
+ UNREF(metaXML);
+ metaXML = NULL;
+ return;
+ }
+ if (OK == enc2hash(last,
+ &prevId)) {
+ cls.lastId = &prevId;
+ } else {
+ BREAK(); /* should not happen, try to continue */
+ cls.lastId = NULL;
+ }
+ nameLine = glade_xml_get_widget(metaXML,
+ "nextIdentifierEntry");
+ gtk_entry_set_text(GTK_ENTRY(nameLine),
+ ""); /* FIXME: compute next for sporadic updates (extend
libecrs?) */
update = glade_xml_get_widget(metaXML,
"namespaceUpdateIntervalComboBoxEntry");
- /* FIXME: set update interval! */
-
-
+ gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(update))),
+ freq);
createMetaDataListTreeView(metaXML,
"namespaceUpdateMetaDataTreeView",
"namespaceUpdatePreviewImage",
- NULL);
+ meta);
createMetaTypeComboBox(metaXML,
"namespaceUpdateMetaTypeComboBox");
dialog = glade_xml_get_widget(metaXML,
@@ -926,15 +944,15 @@
return;
}
- meta = getMetaDataFromList(metaXML,
- "namespaceUpdateMetaDataTreeView",
- "namespaceUpdatePreviewImage");
+ cls.meta = getMetaDataFromList(metaXML,
+ "namespaceUpdateMetaDataTreeView",
+ "namespaceUpdatePreviewImage");
spin = glade_xml_get_widget(metaXML,
"namespaceUpdateAnonymitySpinButton");
cls.anonymityLevel
= gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
nameLine = glade_xml_get_widget(metaXML,
- "nextIdentifierComboBoxEntry");
+ "nextIdentifierEntry");
identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine));
if ( (identifierName == NULL) ||
(strlen(identifierName) == 0)) {
@@ -945,15 +963,12 @@
&nextId);
cls.nextId = &nextId;
}
- cls.meta = meta;
- /*
- FIXME:
- gtk_tree_selection_selected_foreach
+
+ gtk_tree_selection_selected_foreach
(selection,
&initiateUpload,
- &cls);
- */
- ECRS_freeMetaData(meta);
+ &cls);
+ ECRS_freeMetaData(cls.meta);
}
gtk_widget_destroy(dialog);
UNREF(metaXML);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1901 - Extractor Extractor/libltdl GNUnet/src/applications/fs/ecrs GNUnet/src/applications/fs/fsui gnunet-gtk gnunet-gtk/src/plugins/fs,
grothoff <=